Demo Recording Tools
- 1 Introduction
- 2 Basic recording and playback
- 3 Demo Player
- 4 Demo Editor
- 5 Demo Smoother
- 6 Smooth selection angles
- 7 Smooth selection origin
- 8 Linear Interp Angles
- 9 Linear Interp Origin
- 10 Spline Angles and Spline Origin
- 11 Demo Console Commands
- 12 Video Tutorial
- 13 Notes
- 14 Bugs
- 15 See Also
- 16 Wish List
The Source Engine provides a set of tools to record a game to a demo file, playback a recorded game and edit a demo file. These functions are provided via console commands or GUI tools like the Demo Playback window, Demo Editor and Demo Smoother.
Basic recording and playback
To record a game, type in console
record "name", while the file name shouldn't have any special characters or spaces. The demo file (.dem extension) is saved in your current game director, e.g.
\hl2\name.dem. You can start recording anytime within a running game and stop recording with the stop command. If a changelevel occurs while recording, the current demo file will be close and a new demo file name_2 (name_3, name_4, etc.) is created. To playback a previously recorded game, type
playdemo "name". If you want to use demo playback for system benchmarking use
timedemo "name". Timedemo plays a demo as fast as possible and shows performance stats after the playback is finished (total drawn frames, seconds needed for playback, average frames per second and variability).
Anytime while playing back a demo file, the Demo Playback window can be brought up by pressing Shift-F2 or the
demoui command. The Demo Playback window allows to pause and resume, change playback speed or move your camera viewpoint.
To load a new demo file hit the "Load..." button and choose a file from disc. The current loaded demo file name will be shown right beside the "Load..." button. The current and total playtime is shown right below. Using the slider on the right, you can adjust the playback speed between slow-motion and fast-forward (0% to 600%). Under the overall progress bar are the playback control buttons like the toggle button "Play", "Pause", "Resume", step forward ">", go to start "|<", go to end ">|" (some features aren't working yet, like step back "<", fast backward "<<")
Internally recorded demo files use time stamps called ticks to mark single frames within the playback. Like time the current and total ticks are displayed left of the "Goto:" button. You can jump to a specific tick within the demo by entering the target tick in text input field and press the "Goto:" button.
To change the camera's viewpoint, switch to "Camera drive mode" by pressing the "Drive..." toggle button. The button will stay in the pressed-down state as long as the "Drive Mode" is active. To navigate the camera, move the mouse out to the viewport, keep the left mouse button pressed and move around using the W,A,S,D keys. You can move up and down with Z and X, and slow down with the SHIFT key. When the playback is paused, this is a really useful to make screenshot (use
r_drawviewmodel 0 and
cl_drawhud 0 to cleanup the screen). Press the "Drive..." button again to switch back to the normal demo view.
To open the Demo Editor GUI, press the "Edit..." button in the Demo Playback window. The Demo Editor allows you to add and execute a set of commands during demo playback. These demo commands can display text, fade in/out, change the FOV or run any other console command. The Demo Editor can not change the camera view, use the Demo Smoother to do that. The demo commands are not saved within the demo file itself, but in a extra text file named demoname.vdm. These .VDM text files are loaded and executed each time a demo file with the same name is played.
To add a new command, hit the "New->" button and choose a demo command you want to add, for example PlayCommands to execute a console command. Each demo command has a user given name and point of time (clock or tick) to be executed. If you added a new PlayCommands entry, choose a new name ("My command"), set "Start on" to "TimeUseTick", enter a valid tick and enter the console command to be executed, e.g. "echo This is my command". Then hit "OK" and a new demo command will be added to the command list. Existing commands can be changed by pressing "Edit..." or removed with "Delete". Once the demo command list is complete, you can save it to the demoname.vdm file by hitting "Save".
The following list gives an overview about the available demo commands:
|SkipAhead||Skips demo playback ahead to a specified tick and resumes playback.|
|StopPlayback||Stops demo playback immediately.|
|PlayCommands||Executes a console command.|
|ScreenFadeStart||Fade screen in/out.|
|TextMessageStart||Shows a simple text message.|
|PlayCDTrackStart||Starts playing a CD track.|
|PlaySoundStart||Plays a .WAV or .MP3 sound file.|
|Pause||Pauses playback for given seconds.|
|ChangePlaybackRate||Changes the playback speed.|
|ZoomFov||Adds a zoom in/out effect.|
The Demo Smoother is the most complex of all demo tools and allows to override the camera view in demo files. This can be used to smooth out the recorded view or create completely new camera paths. To open the Demo Smoother, hit the "Smooth..." button in the Demo Playback window.
The first thing to do is to pause the playback and load the existing view data from the current demo file by hitting "Reload". Check the "Show All" checkbox to see the complete camera path in your demo file (drawn white). All the time when working with the Demo Smoother, you can still go into "Camera drive mode" and move around the map. If you're not in "Camera Drive mode", you can check the "Back off" checkbox to move the camera backward a bit so you can see some of the path of the camera.
To work with the smoother, you need to have an active selection. To select an part of the current camera track for modification, fill in the "Start Tick" and "End Tick" fields and press "Select". This tick range is now your active selection and the selected samples are now shown in yellow. Click the Show Original button and the camera will follow the path of the selected samples. Notice that we are "backed off" due to the back off button being checked, that's just for the preview. Unclick the back off button for now. Click the lock camera check box and then hold the mouse down on the "Drive Camera" button and you use the WASD keys and mouselook movement to move the camera around. Hit "S" and move back from the current viewpoint.
From this view, the blue box with the red direction line is the current preview position. If you have lock camera clicked and you press the "<<" or ">>" buttons you will move this marker one frame forward or backward. If you don't have the lock camera button checked, then when you press the "<<" or ">>" buttons your view will snap to the new camera position. The white samples at the start and end show you the next few samples just outside your selection range. Clicking the "Process->" button will bring up the menu of currently supported processing types.
Smooth selection angles
Clicking this averages the view angles over a window of about 10 samples, thereby removing some of the high frequency noise from the camera. The smoothed camera directions are shown as purple samples near each yellow sample line. You can preview the processed positions by clicking the "Show processed" button (make sure you turn off "lock camera" if you want to actually see from the camera position, otherwise you'll just see the blue box/red line move across your selection).
Note that the speed scale slider from the "Demo Playback" UI will influence the Show Original/Show Processed (and Drive Camera) speed in the Demo Smoother UI. Okay, that's pure angle smoothing by just averaging the angles over a small window. To undo this change you can just click the "Undo" button.
Smooth selection origin
This is similar to the above, except the window is applied to the origin samples. Clicking this button can be used to remove a bit of high frequency positional jitter. The smoothed camera path is colored yellowish, which deviates from the gray original path. This is the new smoothed path on which the camera will track. Of course, you can apply both angle and origin smoothing to the selection, etc.
Linear Interp Angles
What this tool does it take only the very first sample in the selection range and the very last sample in the range, and then linearly interpolates the view direction smoothly across the entire range.
Linear Interp Origin
Similar to the above, you can linearly interpolate the origin from the start to end sample. As you will see, the camera position follows a direct path from the start to end position, but the original view pitch/roll/yaw data is preserved. You can choose "Linear Interp Angles" if you want to smooth out the angles over this selection as well.
Spline Angles and Spline Origin
The spline functionality, in general, requires you to mark certain samples as "Key Frames" for creating the spline. By default, the first and last samples are automatically included as "anchor" key frames, but you'll want to add at least one if not multiple additional key frames.
The best way to do this is to think of the original samples as a time reference and use the << and >> buttons to move the blue cursor to the sample at the time you want to mark as a key frame. Once you've done that, you need to unlock the camera if it's locked and then press "Set View" to put your eyes into the current sample point.
You can now move that sample point by clicking "Drive Camera" and moving with the keyboard and mouse, etc. Once you have the sample positioned and oriented (just using the camera) as you like, press the "Make Key" button. If you now back the camera up a bit more you'll see a green box which shows the current point as a key. Smoothing out the Edges
The final component of the smoother is useful for dealing with the edges left after post processing a .dem file selection. For instance, chose the last 5 frames to smooth out the right edge at the end of a sample ( type 5 in the Edge Frames box and selected Smooth Right from the Edge-> menu). As you can see in the inset, the processed/purple line is more smoothly integrated with the first non-selected white direction line. You need to use at least 3 edge frames and then select which edges(s) to smooth from the Edge-> menu.
Demo Console Commands
|demo_debug <0/1>||Shows additional demo debug info|
|demo_fastforwardstartspeed <factor>||Go this fast when starting to hold FF button.|
|demo_fastforwardramptime <seconds>||How many seconds it takes to get to full FF speed.|
|demo_fastforwardfinalspeed <factor>||Final playback speed when holding the FF button.|
|demo_interpolateview <0/1>||Enables/disabled view interpolation between demo ticks|
|demo_quitafterplayback <0/1>||Quits game after demo playback|
|demo_recordcommands <0/1>||Record commands typed at console into .dem files|
|demo_pause [seconds]||Pauses demo playback, seconds optional|
|demo_resume||Resumes demo playback|
|demo_togglepause||Toggles demo pause/playback|
|demo_gototick <tick> [relative] [pause]||Skips to a tick in demo. If the relative parameter is 1 the tick is an offset to the current tick. If the pause parameter is 1, playback while be paused when tick is reached|
|demo_timescale <scale>||Set the demo playback speed as a factor, 1.0 is normal playback|
Requires Xvid codec
- You cannot see yourself in POV demos. YOU are the camera.
- When in drive mode, use right mouse to change demo speed.
|Other useful command variables|
|sv_cheats <0/1>||Required for following commands.|
|r_drawviewmodel <0/1>||Hides weapon model.|
|cl_drawhud <0/1>||Hides entire hud.|
|hud_saytext_time 0||Hides chat text, default = 12.|
|hideradar||Hides radar location text.|
|cl_radaralpha 0||Hides new radar overviews (def. = 200).|
This bug list was compiled by Lunchtimemama on January 24, 2005 and is potentially out of date. Bugs listed here may be fixed and other bugs may exist.
- The step-back and rewind buttons are disabled.
- The fast-forward, go-to-beginning, and go-to-end buttons do not work.
- Half of the "Edit" effects are disabled.
- 1. The "Edit" effect configuration windows are immobile and have broken minimize and close buttons.
- 2. With "lock camera" engaged in the Smoother window and "Drive" engaged in the Playback window, the "Make Key" command will incorrectly use the "driven" camera's position instead of the "locked" camera's.
- 3. With "lock camera" and "Drive" engaged, the "Show Original" and "Show Processed" commands will not animate the "locked" camera (though the "step-forward" and "step-back" commands (in the Smoother) will).
- 4. With "lock camera" disengaged and "Drive" engaged, the blue-box camera indicator does not update position when the camera is "driven" around.
- 5. Some demos suffer jumpiness similar to network lag, even those exported from the Smoother.
- 6. "Jump to" in the Smoother does not seem to work properly.
- 7. Some demos will not allow you to make a selection, so smoothing is not possible.
Smoother does not work on srctv demos, cannot make a selection.- Fixed in srctv updates, smoother should work now. (#7 still applies, however. Random bug, can't make a selection)
- 9. When you die, the camera locks to your corpse in "view attacker" mode.
- The "New ->" list in the "Edit" window always opens upward, usually extending off-screen.
- "Goto" is very slow when going to a tick in the past.
- If the blue-box camera indicator suffers movement lag during playback, it does not "catch up" when the demo is paused.
- When "Drive" is engaged, clicking and dragging in VGUI windows will move the camera (making it difficult to highlight text in a textfield).
- 1. dem_forcesrctv <0/1>
* Requested functionality that dem_forcehltv 0/1 had. * Remove recoil. (true free look) Priority 1! * Ability to spectate 1st and 3rd person all other players. (wallhack block notwithstanding of course) * Remove muzzle flash and brass ejection. (not a huge deal, we can use sprites, but would be nice)
- 2. Proper thirdperson mode.
* Functionality is already there. Unlock the "locked chasecam from the side" and make it free chasecam.
- 3. CVAR to override deathcam view.
* When a player dies, any recammed smoother paths will snap back to the player when the ragdoll spawns and lock on viewing the attacker. A cvar to override that, without overriding the smoother path, would be handy.