|Setting Up God-Like Vision During a Game|
This is a technique which allows you to move around the Unreal Tournament world without restriction, invisibly, and to see the world from the perspective of any of your teammates or opponents during a networked game.
Unreal Tournament has a facility to record games and play them back later. The recording is not of the images, but of the state of the game - where everyone is, what they are doing etc - so this allows you to watch a game recording from anyone's viewpoint.
Fortunately, the playback code simply reads the recorded file sequentially - it does not check the file size first, and if the file is extended during playback, it will read past the point where the end of file marker originally was.
This means that you can record a game on one computer, and start playing back that recording seconds after starting it on another computer - you don't have to wait until the end of the game.
Now, on Windows, this would be impossible because the process writing the file would lock out any readers as long as the file was open. However if you have a Unix server running Samba, which the PCs can access, then the locking is not quite so tight.
In fact, done the obvious way, you still cannot open the playback file while it is being recorded, but it is easy to get a Unix process to make a copy of the playback file in realtime, and the copy does not have the PC filesystem locks applied to it.
A simple way to make this copy is:
"tail +0f recording.dem > playback.dem" - more sophisticated code is possible.
When playing back, you need to give the "?3rdperson" option (and note - no spaces in that command between the filename and the option) and the "?timebased" option - this is to stop the playback running faster than the recorder and hitting the end of the file. This would be OK if the file were a named pipe, but in this version of the hack it is not.
So, to summarize.
On a PC where a player is in the game:
On the unix named 'sambaserver':
cd /tmp; tail +0f recording.dem > playback.dem
And on the GodCam PC (or indeed several of them):
The GodCam view accepts the same commands as demo playback - go see the manual. The playback will be a few seconds behind realtime because of buffering and how long it takes you to enter the three commands above, which must be done in that order.
Programmers will see obvious ways to improve the hack above, but this basic and programming-free technique will get you started.
[-Back to the Tutorials-]