
			   AutoCam for ReMaic
			  --------------------

			      Version 1.32
		       Programmed by Yonatan Donner
		  http://www.geocities.com/Hollywood/4704/

What is AutoCam for ReMaic?
---------------------------

First of all, ReMaic (http://www.planetquake.com/ReMaic/) is a utility
programmed by Anthony Bailey <baileya@cs.man.ac.uk> that takes already
recorded demos and adds a camera into them. The camera locations and angles
are determined by a screenplay, which can take a very long time to write.
This is where AutoCam comes into the picture. AutoCam automatically writes
the screenplay of any demo for a particular level using a data file for that
level. That data file is done by the user (or he can use a ready one, like
the DM4 one I made and included with autocam.zip or those available from the
AutoCam web page) and it can be used to ReMaic every demo for that level. If
you want to ReMaic several demos for the same level, or just a very long demo,
AutoCam will save you the trouble of checking player positions and time values
and will create the screenplay you can use with ReMaic.

Like ReMaic, AutoCam uses LS files. You'll need to convert your demo to LS
format to run ReMaic anyway, so no extra effort is wasted.

How does AutoCam work?
----------------------

AutoCam uses a data file for the level used in the demo to find out which
camera positions and angles to use. The data file defines areas in the level
and camera positions (with an option to specify angles as well instead of
having the camera focus on the player) to be used with those areas. When the
player enters an area defined in the data file, the camera switches to the
right position. When the player is outside all the defined areas (in case the
data file doesn't contain info about the entire level) the view goes back to
his eyes or to a ChaseCam. To prevent the camera from jumping back and forth
rapidly between two points if the player goes between two areas rapidly, the
areas are allowed to intersect and the camera will stay in the same place as
long as the player is still in any area visible from it's location.

Full instructions on how to add a camera to a DEM file
------------------------------------------------------

If you already know how to use LMPC and ReMaic, you can skip this section
and go on reading about AutoCam.

You'll need the following utilities:

AutoCam - you already have it if you read this text file.
LMPC	- available from http://www.physik.uni-leipzig.de/~girlich/games/
ReMaic	- available from http://www.planetquake.com/ReMaic/
ReMaic requires Perl to run. You can download a Perl interpreter for free
from http://www.perl.org/

This example shows how to convert demo1.dem (normal demo) to demo2.dem (with
camera), assuming the level in the demo is DM4:

Convert the DEM files to LS using LMPC:
lmpc -s demo1.dem demo1.ls

Use AutoCam to create demo1.cam from demo1.ls:
autocam demo1.ls demo1.cam dm4.acm

Use ReMaic to create a camera version of this demo: (Note that this line
might change a bit depending on what version of Perl you downloaded)

perl remaic.pl demo1.ls demo1.cam demo2.ls

Convert demo2.ls back to DEM:

lmpc -l demo2.ls demo2.dem

And now you have the new camera-perspective demo.

The data file
-------------

I have included along with AutoCam a sample data file I made for DM4. It
covers every area the player can reach in the level without cheating except
the lava (I hope). You can use it to make a screenplay of every demo recorded
on DM4. Of course, optimally, there should be data files for all levels. If you
make a data file for a level, please send it to me and I'll put it on the
AutoCam page (you will be fully credited of course), so other people can enjoy
it, too. The URL is: http://www.geocities.com/Hollywood/4704/autocam.html

The format of the data file is simple. Note that AutoCam versions 1.3 and
above use a different format than 1.2 and below.

Every line contains a command and parameters. Coordinates are given as
(x,y,z). The possible commands are:

# - comment. Doesn't require any parameters. AutoCam ignores everything from
here to the end of the line.
p - camera position definition. Requires a set of coordinates. All the areas
defined from this point until the next camera definition will have this
camera assigned to them. You can also set a fixed angle to the camera
instead of having it follow the player around. To do that, add "v" (without
the quotation marks) after the camera position coordinates and add another
set of coordinates that is the camera target.
c - cubic area definition. Requires two sets of coordinates which are two
opposite vertices of the cube.
o - spherical area definition. Requires one set of coordinates and one value
which is the radius (in pixels).

Try to let the areas you define in the level intersect a little. This will
ensure that: 1. there aren't little gaps between two areas and the whole
level is covered 2. if the player goes back and forth between two areas
rapidly, the camera will jump less that way.

The order of the areas in the data file is not important unless the switch
/P is used.

Examples:

Place the camera at (0,0,0):
p (0,0,0)

Place the camera at (0,0,0) looking at (100,-100,50):
p (0,0,0) v (100,-100,50)

A cube between (-200,-200,-200) and (200,200,200):
c (-200,-200,-200) (200,200,200)

A sphere centered at (0,0,0) with a radius of 500):
o (0,0,0) 500

Remember that after you define a camera position (and possibly, angle) that
position will be used for all area definitions until the next camera
definition.

Also see my sample DM4.ACM for more examples. (Note: it doesn't use any
spheres or fixed views, because I didn't find it necessary in DM4.)

If you are not sure how to find coordinates, use this simple way: run Quake,
enter the level you want to make a data file for, enter noclipping mode
(type NOCLIP in the console), go to the point you want to get coordinates
for, type EDICT 1 in the console and scroll up until you see a line
beginning with 'origin'. The numbers in that line are the X,Y,Z values of
the point you are floating in. An easier way would be to download the
coordinate grabber patch from the AutoCam page.

The Command Line
----------------

The case is insensitive, so you don't have to use capitals.

Usage: AUTOCAM <infile.ls> <camfile.cam> <datafile.acm> [switches]

<infile.ls>    - the name of the decompiled LS demo source file
<camfile.cam>  - the name of the output CAM file to be used with ReMaic
<datafile.acm> - the name of the data file for the level used in the demo

[switches]   - command line switches

The switches are:

/C	     - use ChaseCam instead of player's view when the player is in an
	       area not defined by the data file. By default, when the player
	       is in an area not defined by the data file, AutoCam will set
	       the camera back to his view. Using this switch, the camera
	       will switch to a ChaseCam. The ChaseCam uses default values
	       of 0.3 second behind and 30 pixels above the player. Maybe in
	       a future version I'll make it possible to change those
	       values. Right now this feature is untested.
/Eentity     - focus on a different entity than the default 1. Sometimes the
	       player in the demo is not entity 1 (for example in client-side
	       demos). Using this switch you can have the camera focus on a
	       different entity number.
/T	     - track projectiles fired by the player. When this switch is
	       used, AutoCam will detect when the player fires a rocket or a
	       grenade and track it until it explodes, or a certain amount of
	       time passes (defaults to one second, can be changed using /L) or
	       the camera switches locations or the projectile is not visible
	       anymore.
/Llength     - specify how long the camera should track projectiles fired by
	       the player. Usually if the projectile doesn't explode
	       after one second, it's useless to look at it anymore, but you
	       can change this value if you want to, or even make it smaller
	       (half a second works well, too, from my experience - depends
	       on what kind of action you like).
/P	     - have area priorities. By default, when two or more areas
	       intersect, AutoCam will try to keep the camera in it's
	       current position if it's possible, even if another position
	       can be used for the player's location. It works that way so
	       that if the player moves rapidly between two areas with two
	       different camera locations (for example, moves forward, fires a
	       rocket and moves back aain) the view won't switch rapidly.
	       However, if you would like to "force" the camera to switch to
	       a certain location every time the player is in a certain
	       area, you can use this switch, and AutoCam will use the last
	       suitable area from the data file (that was the default
	       behaviour in versions 1.1 and below). That way, if you put the
	       intersecting areas at the top of the data file, you can be sure
	       that AutoCam will work well both when /P is used and when it's
	       not used.
/V	     - don't keep tracking projectiles once they're out of the
	       current camera's view as defined by the areas in the data
	       file.

Examples:

Create a screenplay for thresh.ls called thresh.cam using the e1m2 data
file called E1M2.ACM:
autocam thresh.ls thresh.cam e1m2.acm

Do the same when Thresh is entity 2:
autocam thresh.ls thresh.cam e1m2.acm /e2

Do the same but track rockets and grenades fired by Thresh for up to half a
second:
autocam thresh.ls thresh.cam e1m2.acm /e2 /t /l0.5

History
-------

0.80 - initial working version
0.90 - fixed lots of bugs, added sphere definition option
1.00 - added ChaseCam option, finished fixing bugs, AutoCam ready for release
1.05 - fixed bug with times incompatibility between LMPC and ReMaic
1.10 - added /E switch and option to specify fixed views in the data file
1.15 - fully added projectile tracking with /T and /L switches
1.20 - changed default behaviour to try and prevent the camera from switching
       locations rapidly when possible, added /P switch for the old behaviour
1.30 - fixed more bugs (don't ask), changed the data file format to a much
       more convenient one, redid dm4.acm, improved projectile tracking,
       added /V switch
1.31 - fixed a bug which prevented cameras and targets from changing
       sometimes
1.32 - improved the fix from version 1.31, which wasn't complete before,
       finally tested chasecam

Future plans
------------
Many improvements could be made, if you have any suggestions or bug reports
don't hesitate to mail me at <ruthd@post.tau.ac.il>. I'd also like to see
many data files made by AutoCam users.

Information and related utilities
---------------------------------
o You will need Uwe Girlich's LMPC, and you might also want to read his DEM
  specs. Get both from his home page at:
  http://www.physik.uni-leipzig.de/~girlich/games/

o ReMaic is available from: http://www.planetquake.com/ReMaic/

o My homepage: http://www.geocities.com/Hollywood/4704/

Credits
-------
Anthony Bailey for the great ReMaic and some help and suggestions with AutoCam,
and much more unrelated to AutoCam.
Stefan Schwoon and Matthias Belz for very valuable comments and suggestions
for AutoCam.
Uwe Girlich for LMPC.
insane for the coordinates grabber patch.

Yonatan Donner
<ruthd@post.tau.ac.il>
