Skip to content

Instantly share code, notes, and snippets.

@p0358
Last active October 23, 2023 04:29
Show Gist options
  • Save p0358/3dc14879babde853356f35cdd8800c8c to your computer and use it in GitHub Desktop.
Save p0358/3dc14879babde853356f35cdd8800c8c to your computer and use it in GitHub Desktop.

Demo

What demos are?

A file type (with the .dem extension) containing recorded events that can be edited and played back in-game. Demos can be edited to change camera angles, speed up, slow down, play music, and other functions. (from Valve wiki)

Benefits

  • You have your every game archived once enabled. Something nice happened to game? You can always get back to it!
  • It takes way less size than a video and about no system resources compared to its recording.
  • You also have every game event registered in parsable format, not just a video data, so you can do interesting stats probably if anybody actually manages to parse its contents :P
  • You can later play it back at any video settings your PC can handle or not (about that later) and record at any video settings quality, even lossless.
  • During playback, you can do many things unavailable to you normally, like using third person view or disabling HUD. Do you imagine those nice cinematic shots already?
  • It is possbible to play tick by tick without view interpolation to see what did server really see and that for example shows that on our screen we didn't miss a shot, but on the demo file we recorded ourselves we did. It is possible to play without view interpolation to see what our shots probably really looked like to server.

How to record demos?

Firstly, you must have a config file.

To create your own custom config I recommend creating a file called autoexec.cfg in your Titanfall install directory (for example save it as C:\Program Files (x86)\Origin Games\Titanfall\r1\cfg\autoexec.cfg). Then open Origin, right-click Titanfall and click Game Properties. A small window will open, add +exec autoexec.cfg and submit. If you already have some text in this box make sure to add a space between. (http://wiki.frontier.tf.s3.amazonaws.com/Config)

Put these lines inside of it:

log 1
demo_enabledemos 1
demo_autoRecord 1
demo_autoRecordName demo
demo_writeLocalFile 1

Once you start up the game, you should notice that r1_dlc1 folder was created inside your Titanfall install dir (ex. C:\Program Files (x86)\Origin Games\Titanfall). Open it. That's where your demo files will be saved at.

If the folder wasn't created, it means that you did something wrong.

Playback

This section is not yet ready, remember - recording is more important, so you have what to play later. :P

The simplest way to play it back is to execute this command: playdemo <filename>

<filename> is the name of demo file placed in r1_dlc1 directory, it can be with .dem extension or without. You can also enter absolute path, but remember to replace forward slashes with backward ones (\ to /).

Currently your only option is probably to bind it to some key like this: bind "F2" "playdemo demo001". Put this in your config file. You could also add some other commands to command line arguments like this: +command 1, or bind a key to toggle it (if it's toggleable): bind "F3" "toggle command".

Load a lobby first at least once before playback (then you can exit back to main menu), or the game will crash.

Useful commands for playback

  • demo_playbackexactframes <0/1> - This by default is at 1, setting to 0 can fix stuttering issues if you encounter one, they may appear if you haven't got constant framerate. If you have no stuttering, and also have stable framerate locked at your monitor's refresh rate, keep this to default. From Titanfall: Play back exactly the number of frames as recorded. Playback speed will vary with framerate. Turned off, the demo will sync to the clock, and be smoother by dropping frames and inserting frames as needed. But that could cause playback to diverge from recording and cause errors.

  • demo_interpolateview <0/1> - When set to 0, it shows you how your aim was really seen to the server and helps understand why your perfect shot was missed somewhat. Useful to bind to a toggle.

  • demo_togglepause, demo_pause, demo_resume - self-explainatory. Bind the first one without prefixing it with toggle.

  • demo_pauseatservertick <0/1> - Pauses demo playback at server tick, this lets you play back game step-by-step when set to 1, and toggling pause with demo_togglepause. or no xD

  • demo_gototick <tick> [relative] [pause] - Toggles demo playback., 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. Warning: very buggy in Titanfall!

  • demo_timescale <scale> - Set the demo playback speed as a factor, 1.0 is normal playback. This doesn't seem to work too well in Titanfall...

  • sv_cheats <0/1> - When enabled lets you use some commands you wouldn't be allowed to use without enabling it. ;) Inb4, no, you cannot enable this on matchmaking servers, sorry.

  • toggle cl_drawhud 0 1;toggle crosshair 0 1;toggle r_drawviewmodel 0 1 - this is what Respawn itself uses to toggle HUD view. That's what you may want to use for cinematic shots. It also disables red screen effect on damage.

  • cam_command <0/1> - Settings this to 1 enables third person view! (there's also thirdperson and firstperson - not sure what's the difference) Testing further, setting this back to 0 seems not to enable back first person view, use firstperson command in this situation.

  • thirdperson; thirdperson_mayamode 1; thirdperson_screenspace 1 - What Respawn uses for third person view. firstperson to switch back.

Converting demo to a video

The most obvious method

Just start playback and record using any external video recording software :)

Other methods

More methods to come here soon, you can see them in the links below.

Useful links

Author of this article is p0358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment