Demo Badger: Source

The personal demo assistant for Source games.

Update Sep 18 2012: Demo Badger is no longer being actively developed or supported. With the advent of the Replay Tool in TF2, much of Demo Badger's usefulness is (or will become) redundant over time. That being said, Demo Badger should still work on most current Source-engine games and will likely continue to work without modification for some time into the future. As such I am releasing the source code to the public domain.

 Download latest version of Demo Badger here

 Contact author

Demo Badger: Source

Version 1.0

By Foozalicious aka joelpt demobadger@joelpt.net

http://joelpt.net/demobadger

Demo Badger: Source is a demo recording and movie generation utility for Source engine games such as Team Fortress 2, Counter-Strike Source and Left 4 Dead. With Demo Badger you can easily create and 'bookmark' demos while playing any Source game, then turn those demos into standard AVI movie files automatically.

Demo Badger has been tested on Windows XP, Vista, and Server 2008 32-bit. It will probably work on 64-bit or pre-XP systems too.

Demo Badger is freeware.

Features

Quick start for the impatient

Launch Demo Badger and a Source game (in either order); Demo Badger will start demo recording automatically once you're in-game.

While playing, type Alt+B, then follow the prompts to save a demo bookmark.

Later, use Alt+G from the game's title screen to generate AVI movie files from your bookmarks.

Default hotkeys:

Alt+B           Bookmark
Alt+Q           Quick Bookmark
Alt+C           Check Demo

Ctrl+Alt+B      Bookmark Set Start
Alt+L           Save Last Demo
Alt+Z           Toggle Autosave

Alt+G           Generate Movies

Ctrl+Alt+R      Trash Demo
Ctrl+Alt+Q      Reload

Right click Demo Badger in the system tray to access the preferences panel, read the manual, and show the hotkeys tip box.

Badger basics

Demo Badger is a demo recording and movie generation assistant that works with most Source games.

Whenever you're in a Source game, Demo Badger will automatically keep a demo recording at all times. Whenever something happens that you want to "capture on film", Demo Badger lets you instantly create a "demo bookmark" that it will later use to create a movie file from.

When you start Demo Badger, make sure your speakers are on. Using speech synthesis, Demo Badger should announce the list of games it has been installed for (first launch only).

Launch your Source game of choice (only the most well-known Source games will be recognized without editing games.ini). Demo Badger should detect the game window and play an announcement letting you know. Note that Demo Badger can be started either before or after launching a game.

Join a game server. Shortly after entering the game, Demo Badger will automatically start demo recording. It will continue to do this between map changes and game restarts.

DB has several hotkeys that operate in-game. The most important of these is the Bookmark hotkey: Alt+B by default.

Any time during play, press Alt+B. This will set a new bookmark, ending at the moment you pressed the button.

A prompt will appear asking you for a bookmark title and a duration (see below). The duration you enter here determines the starting time for the bookmark.

To understand the purpose of bookmarks and their duration, let's jump over to the movie generator function of Demo Badger.

Generating movies from your demos

Demo Badger automates the process of generating movie (AVI) files from your demos and bookmarks. To begin, launch your game of choice. Once it's up, press Alt+G to start Demo Badger's movie generator.

A file selection box will appear. Select one or more previously saved demos (.dem files) to generate movies from.

Here's where bookmark duration comes into play. When you press OK on the file selection box, Demo Badger will start playing back your first selected demo. Once the demo is playing, it will first be fast- forwarded to the starting time of the demo's associated bookmark. The game engine will then be instructed to begin movie recording, and stop it at the bookmark's ending time.

Demo Badger also work with .dem files saved prior to Demo Badger installation as well: it just makes a movie of the entire demo. Also see the "Creating and modifying .dbs files" section for details on editing bookmarks prior to movie generation.

At the end of the movie generation process, the newly created AVI files will be moved to the folder specified in your preferences. (default C:\movies).

Taken together, the "always on" recording, bookmarking, and movie generation features greatly simplify the demo-to-movie creation process in Source games. Have a go and let me know what you think! demobadger@joelpt.net

For best results

Movie generation in Source games is still quite flaky and prone to crashes. To maximize your chances of success:

Autosaving and multiple bookmarks per demo

With the default options, Demo Badger only keeps those demo files which you create a bookmark in. Un-bookmarked recordings are silently discarded. If you would like to instead save every demo recorded (every round you play), enable the Autosave Complete Demos option in Preferences->Saving Rules.

Demo Badger also stores only one bookmark per demo by default. When you create a bookmark, Demo Badger stops the currently recording demo, saves it, then starts a new demo. This minimizes disk space usage. On the downside, your game will be laggy for a few seconds after demo recording is restarted.

As an alternative, you can enable the Multiple Bookmarks Per Demo option in Preferences->Saving Rules. When this is on, Demo Badger will not restart demo recording every time you create a bookmark. Instead, the demo will be allowed to continue recording, and DB will store multiple bookmarks for that demo. Later, during movie generation, if you select that demo to create movies from, each bookmark stored for that demo will be turned into its own movie file.

Quick bookmarking

A related feature is Quick Bookmark. When you press Alt+Q (default), Demo Badger will create a Quick Bookmark. You will not be prompted for a bookmark title or duration; a default title and duration (30 seconds, modifiable in Preferences->Default Durations) will be used. The currently recording demo will not be restarted. This is very useful when you're in the heat of battle and you want to create a bookmark but don't want any interruptions to gameplay.

It is also possible to bind the Quick Bookmark key to a bare key in Preferences, such as the x key, making it very easy to grab quick snippets of gameplay as you play.

For more details on multiple bookmarking, see the section titled "Creating and modifying .dbs files" below.

Creating and modifying .dbs files

Demo Badger creates a .dbs file along with every .dem file it saves. It records your bookmarks in this file as a series of simple timestamped commands.

When a .dem file is selected during movie generation, Demo Badger reads the contents of the .dbs file and generates a Source-compatible .vdm file. The .vdm file is used by the game when a .dem of the same name is played, and controls what happens during demo playback. Demo Badger uses this .vdm to control movie recording and fast-forwarding.

The file format is as follows:

duration m:ss
m:ss command
m:ss command
[...]

where m:ss is a time code in minutes:seconds format and 'command' is one of:

start title      // start recording a movie with filename 'title'
stop             // stop recording movie
console command  // any console command

For example, here we record the last 30 seconds of a 2 minute demo:

duration 2:00
1:30 start lastbit
2:00 stop

Besides 'start' and 'stop', you can insert any normal game console command and it will be sent at that time of demo playback. For example, if we wanted to also record the first 30 seconds of our 2 minute demo at 60 frames/sec (DB defaults to 30 frames/sec), we could use this:

duration 2:00
0:00 host_framerate 60
0:00 start firstbit
0:30 stop
1:30 host_framerate 30
1:30 start lastbit
2:00 stop

You can create new .dbs files for older .dem files that you have recorded. Just give the .dbs file the same name as the .dem file. It is not necessary to include a 'duration m:ss' line.

Changing the voice

Demo Badger uses Windows Speech Synthesis to produce voice announcements while you play. It is possible to change the voice that is used:

Windows comes with a few different voices. You can find more voices online (most are commercial products):

http://www.research.att.com/~ttsweb/tts/demo.php

http://www.bytecool.com/voices.htm

http://www.microsoft.com/speech/evaluation/thirdparty/engines.mspx

Using a scratch disk

By default, Source games output movie files to the game's root folder within your Steam subfolder (same folder as hl2.exe). This can consume disk space from a hard disk you may not have space on, and (especially if you generate TGA files during movie generation) can also have a negative effect on the movie generation speed.

Under Windows Vista, you can set the Scratch Folder option in Preferences->Folder Settings to have DB use a different 'scratch' folder for this temporary location.

Even when Scratch Folder is not used, DB still moves finished movie files to MovieOutputPath (in demobadger.ini).

Note that this only works under Vista because DB utilizes the mklink command (unavailable in XP) to create an NTFS junction for the scratch folder within each game's folder. The need for this is a consequence of a technical limitation of Source's .vdm file format (can't embed double quotes which would let us specify a full path to startmovie).

It is possible, with some manual configuration and some Windows expertise, to configure Demo Badger to use a scratch folder under XP. To do so, you'll need to download the JUNCTION.EXE utility:

http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

Use it to create a junction folder named 'scratch' within each of your Source game's root folder (where hl2.exe resides) pointing to your desired scratch folder. Once this is done set Scratch Folder in Preferences->Folder Settings to the target scratch folder.

Adding new games

By default Demo Badger just recognizes a handful of the most popular Source-based games. If a game isn't recognized by DB, it will be disabled while in that game.

If you'd like to add new games, see the games.ini file, which has instructions for adding.

Caveats

Changelog

0.99b9.01 (2009 08 31)

0.99b9 (2009 08 27)

0.99b8 (2009 08 20)

0.99b7 (2009 08 17)

0.99b6 (2009 08 15)

0.99b5 (2009 08 12)

0.99b4 (2009 08 12)

0.99b3 (2009 08 12)

0.99b2 (2009 08 10)

0.99b1 (2009 08 01)