Demo

A demo (also called LMP, from the lump file extension) is any recording of a game session that can be played back using the game engine. Internally, it is a sequence of tic commands, keeping track of just the input control states during each frame. Thus, a demo is much more compact than a video capture, or even than a recording of the states of all objects in the level.

Built-in demos
If no game or demo is begun immediately when launching vanilla Doom (either from the in-game menus or by using command line arguments), three built-in demos soon begin to play repeatedly, evoking an arcade game. The demo levels in Doom are:

Ultimate Doom plays the same three built-in demos as Doom, along with a fourth one called DEMO4 which takes place in E4M2: Perfect Hatred.

Final Doom contains the following built-in demos:

Demo levels in Heretic Demo levels in Hexen Demo levels in Hexen: Deathkings of the Dark Citadel Demo levels in Strife

When a GUI launcher, such as the Doom95 front end, is used to start the game, the launcher usually warps to a selected level and the built-in demos are bypassed. They can still be viewed, however, by choosing END GAME from the appropriate menu.

The built-in demos are stored in lumps in the IWAD file named DEMO1, DEMO2, and DEMO3. A PWAD can replace a built-in demo by including a lump with the same name, although an engine crash often results if the new demo is incompatible (see below).

Custom demos
Players can record demos of their own game sessions. This is done using the -record &lt;name&gt; command line argument, which places the recording in a file named &lt;name&gt;.lmp in the Doom program directory. A recording can subsequently be played back using the -playdemo &lt;name&gt; command line argument, where &lt;name&gt;.lmp is the name of the recorded demo. Unlike in the built-in demo sequence and when using -timedemo (see below), it's possible to toggle the automap mode while using -playdemo, because the feature that brings up the menu when pressing input keys or buttons is disabled.

These demo files can then be uploaded to websites and FTP servers to aid other players in the completion of the game, show off tricks, reveal secrets, or for competitive purposes (see Speedrun). It is also possible to record multiplayer games.

The -timedemo &lt;name&gt; parameter can be used as an alternative to -playdemo</tt>. This will render every frame in a demo as quickly as possible for benchmarking purposes.

Technical information
A demo lump is a sequence of instructions which tells the game engine what actions the player will perform: when he will take a step forward, turn around, shoot, switch weapons, etc. It is interpreted by the engine as keyboard and mouse input, thereby allowing anyone to watch a recreation of the original recorded actions. While some elements of the game (such as damage done by attacks) are typically randomized, the usage of a pseudorandom number generator ensures they stay the same with every playback.

The file starts with a header that specifies the map, skill level, and number of players. Versions after 1.2 extend the 7-byte header to 13 (0xD) bytes to also include information about the game version the demo was recorded with, what multiplayer mode was used, whether the -respawn</tt>, -fast</tt>, and -nomonsters</tt> parameters were used, and which player's point of view should be used.

Immediately after this header is a series of player actions for each tic encoded in 4 bytes. There are 35 tics in a second. The first 3 bytes encode movement including speed, strafing, and turning and are read signly. The last byte encodes other actions such as using/opening, shooting, and changing weapon. This structure is repeated for every player in the game.

Following the series is a 0x80</tt> byte at the end of the lump.

Because the demo format is composed of a series of tic commands rather than a video of recorded gameplay, demo lumps are relatively small and were very practical back when computers were slow and Internet bandwidth was scarce. The size of an uncompressed single-player demo lump is 140 bytes per second (or 4 bytes per tic) plus a few (8 or 14) bytes of overhead. Back then, it would certainly have been nearly impossible to distribute demos as video captures due to their large size.

Over the years, a few utility programs have been written to convert LMPs between the original binary format and other formats. One such program is LMPC, which can also be used for hex editing of demos (see TAS).

Demo issues
With few exceptions, demos can only be played back with the same versions of the Doom IWAD and executable or source port as those used during recording. If a demo is played on a different source port, using a different WAD(s), or even with a different version of the same source port or IWAD, it may refuse to run, or the actions of the player in the demo may become nonsensical, with the Doomguy crashing into walls and shooting apparently at random. This is known as "desynch", and indicates that the demo is not compatible with the playback method being used.

Display commands not affecting gameplay, such as chat text and the IDDT cheat code, are not recorded in a LMP file and may be used freely during playback. However, other cheat codes are not recorded either, and will almost certainly corrupt the demo if used during recording, or cause desynch if entered during playback.

Many of the demos on the Internet are of version 1.9 format, because it marks the final versions of the games. Older versions are rarer, as the engine versions they were recorded with are obsolete and did not have as much exposure to dedicated players over time. The idgames archive, for example, purged a number of older demos at one point, keeping only demos of the latest version. Additionally, this is the format used in Compet-n, the premiere speedrunning site for demos in the original levels of the games. Newer demo sites do include a good number recordings for source ports, however, especially of levels from user-made PWADs.

For some players, it is not practical or even possible to use the original Doom executables to play demos. The original executables were written for DOS, and require DOS or a DOS-like OS environment to function properly. While this has been made easier with the development of the multi-platform DOSBox emulator, there are also alternatives among the source ports, as most, though not all, demos recorded with id Software's DOS executables will play properly in PrBoom, the Eternity Engine, or Chocolate Doom because these ports are specifically designed to emulate vanilla Doom as closely as possible. On the other hand, an assortment of modern source ports, such as Doomsday or ZDoom, do not record demos in Doom's original demo format, because their movement code requires the recording of extra data (such as Y-axis viewpoints and trajectories, jumping, or even flat heights and thing dispositions as in a savegame) even if the associated features are not being utilised.

Other issues that can affect recording or playback:
 * Demo desyncing caused by bouncing Lost Souls
 * Demo desyncing caused by menu access
 * Turning resolution is lowered when recording demos