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.
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:
Final Doom contains the following built-in demos:
|Demo||TNT: Evilution||The Plutonia Experiment|
|DEMO1||MAP01: System Control||MAP17: Compound|
|DEMO2||MAP12: Crater||MAP10: Onslaught|
|DEMO3||MAP13: Nukage Processing||MAP12: Speed|
Demo levels in Heretic
|Demo||Heretic Shareware||Heretic Registered|
|DEMO1||E1M3: The Gatehouse||E2M9: The Glacier|
|DEMO2||E1M6: The Cathedral||E2M5: The Catacombs|
|DEMO3||E1M9: The Graveyard||E3M2: The Cesspool|
Demo levels in Hexen
|Demo||Hexen Demo version||Hexen version 1.0||Hexen version 1.1|
|DEMO1||Hub 1: Guardian of Ice||Hub 1: Guardian of Ice||Hub 1: Winnowing Hall|
|DEMO2||Hub 1: Winnowing Hall||Hub 4: Gibbet||Hub 1: Guardian of Fire|
|DEMO3||Hub 1: Guardian of Fire||Hub 4: Effluvium||Hub 4: Effluvium|
Demo levels in Hexen: Deathkings of the Dark Citadel
|DEMO1||Hub 1: Ruined Village|
|DEMO2||Hub 2: Market Place|
|DEMO3||Hub 3: Chantry|
Demo levels in Strife
|Demo||Strife Shareware||Strife Registered|
|DEMO1||MAP32: Sanctuary||MAP02: Town|
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 Edit
Players can record demos of their own game sessions. This is done using the -record <name> command line argument, which places the recording in a file named <name>.lmp in the Doom program directory. A recording can subsequently be played back using the -playdemo <name> command line argument, where <name>.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 <name> parameter can be used as an alternative to -playdemo. This will render every frame in a demo as quickly as possible for benchmarking purposes.
Technical information Edit
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, -fast, and -nomonsters parameters were used, and which player's point of view should be used.
|up to 1.2||post-1.2|
|N/A||0||game version: 109 for version 1.9|
|0||1||skill level:Values 0 thru 4 indicate "I'm too young to die" thru "Nightmare!", respectively.|
|1||2||episode: always 1 for Doom 2|
|N/A||4||multi-player mode: 1 means deathmatch, 2 altdeath, 0 is used for single-player or cooperative multi-player|
|N/A||5||non-zero value implies use of -respawn|
|N/A||6||non-zero value implies use of -fast|
|N/A||7||non-zero value implies use of -nomonsters|
|N/A||8||which player's point of view to use, zero-indexed (0 means player 1)|
|3||9||set to 1 if player 1 present|
|4||A||set to 1 if player 2 present|
|5||B||set to 1 if player 3 present|
|6||C||set to 1 if player 4 present|
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.
|0||forward/backward movement: Positive values indicate forward movement, negative backward. 50 is normally the highest achievable speed if running. 24 is the walking speed. Any number from -50 to 50 can be achieved with a mouse.|
|1||strafing: Positive values indicate rightward movement, negative leftward. 40 is the running speed, 24 without running. 50 is also achievable in a somewhat complicated way.|
|2||turning: Positive values are left turns, negative right.|
|3|| This byte encodes multiple actions in different bits. Indexing is from the least significant bit.
Following the series is a 0x80 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 Edit
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