Demo

From DoomWiki.org

Revision as of 08:12, 12 June 2015 by Chungy (talk | contribs) (Built-in demos: Link to the Doom versions properly)


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 majority of demos are recorded on the Ultra Violence skill level, and most end with the player's death.

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).

Doom

Each new version of Doom changed the engine in ways which made the existing demos desync, and so they had to be re-recorded (see issues below). The map choice, game-mode and approach to each demo shows a progression in the recorder's thinking about the purpose of the demos and how much of the game should be revealed.

It's widely believed that the main player recording all demos in Doom and Doom II is John Romero.

Shareware

The shareware releases of Doom necessarily limited the demo loop to maps from Knee-Deep in the Dead. The earliest recorded demos are single player run-throughs and occasionally they show the complete level. Later recordings demonstrate other game modes and the play-style is more "tense": the player takes a lot of damage early on and limps on with very low health. By version 1.6, the players always die before completing the levels.

Version DEMO1 DEMO2 DEMO3
0.99 E1M2: Nuclear Plant
Duration 1:00[1]
E1M5: Phobos Lab
Duration 5:35[2]
E1M7: Computer Station
Duration 1:23[3]
1.1 E1M2: Nuclear Plant
Duration 2:45, completes level[4]
E1M5: Phobos Lab
Duration 6:38[5]
E1M7: Computer Station
Duration 6:28[6]
1.2 E1M2: Nuclear Plant
Duration 4:14, completes level[7]
E1M5: Phobos Lab
Duration 1:20[8]
E1M7: Computer Station
Duration 7:35, completes level[9]
1.4 beta E1M3: Toxin Refinery
Duration 2:58[10]
E1M5: Phobos Lab
Duration 5:14, 2 player cooperative[11]
E1M9: Military Base
Duration 0:53[12]
1.5 beta E1M3: Toxin Refinery
Duration 3:45, completes level[13]
E1M5: Phobos Lab
Duration 4:30, 2 player cooperative[14]
E1M7: Computer Station
Duration 2:26[15]
1.6 beta E1M3: Toxin Refinery
Duration 3:02[16]
E1M5: Phobos Lab
Duration 1:42, 2 player cooperative, turns into DM[17]
E1M7: Computer Station
Duration 3:20[18]
1.666 E1M3: Toxin Refinery E1M5: Phobos Lab
(multiplayer)
E1M7: Computer Station
1.8 E1M5: Phobos Lab
Duration 2:25, Hurt Me Plenty[19]
E1M3: Toxin Refinery
Duration 1:50, Hurt Me Plenty[20]
E1M7: Computer Station
Duration 1:01, Hurt Me Plenty[21]

Registered and Commercial

The earlier versions of demos from the registered games exclusively demonstrate levels from The Shores of Hell and Inferno, perhaps to show the game owner new content, as they will have already seen Knee-Deep in the Dead prior to registering. As later releases of Doom were sold commercially as well as via registering the shareware, Episode 1 demos are brought back into the mix. By version 1.666 there is one demo per episode.

Ultimate Doom introduced a fourth demo, DEMO4.

Version DEMO1 DEMO2 DEMO3 DEMO4
Registered 1.1 E2M4: Deimos Lab
Duration 2:29[22]
E3M3: Pandemonium
Duration 3:52[23]
E3M6: Mt. Erebus
Duration 3:30[24]
-
Registered 1.2 E2M4: Deimos Lab
Duration 5:30, Hurt Me Plenty[25]
E3M6: Mt. Erebus
Duration 2:20[26]
E2M2: Containment Area
Duration 4:44[27]
-
Registered 1.666 E1M5: Phobos Lab
Duration: 0:55[28]
E2M2: Containment Area
Duration: 1:09[29]
E3M5: Unholy Cathedral
Duration: 1:50[30]
-
1.9 As above As above As above -
Ultimate Doom As above As above As above E4M2: Perfect Hatred
Duration: 0:29[31]

Doom II

Version DEMO1 DEMO2 DEMO3
1.666 MAP11: Circle of Death
Duration: 2:07[32]
MAP05: The Waste Tunnels
Duration: 0:57[33]
MAP26: The Abandoned Mines
Duration: 2:08[34]
1.7, 1.7a, 1.8 As above As above As above
1.9 MAP11: Circle of Death
Duration 0:36[35]
As above As above

Final Doom

The Final Doom engine was based on Ultimate Doom, which loops through four demos. However, only three demo lumps are provided, so the game crashes after playing DEMO3. This was fixed in the Id Anthology version of Final Doom.[36]

Game DEMO1 DEMO2 DEMO3
TNT: Evilution MAP01: System Control
Duration 2:12[37]
MAP12: Crater
Duration: 1:44[38]
MAP13: Nukage Processing
Duration: 1:38[39]
The Plutonia Experiment MAP17: Compound
Duration: 3:34[40]
MAP10: Onslaught
Duration: 1:39[41]
MAP12: Speed
Duration: 2:41[42]

Heretic

Following the pattern set by Shareware Doom, the shareware demos are necessarily restricted to the first episode, and the registered version ignores the first episode and focuses only on registered material.

Version DEMO1 DEMO2 DEMO3
Shareware 1.2 E1M3: The Gatehouse
Duration: 1:18[43]
E1M6: The Cathedral
Duration: 1:58[44]
E1M9: The Graveyard
Duration: 0:37[45]
Registered E2M9: The Glacier E2M5: The Catacombs E3M2: The Cesspool

Hexen

Version DEMO1 DEMO2 DEMO3
Demo version Hub 1: Guardian of Ice Hub 1: Winnowing Hall Hub 1: Guardian of Fire
version 1.0 Hub 1: Guardian of Ice Hub 4: Gibbet Hub 4: Effluvium
version 1.1 Hub 1: Winnowing Hall Hub 1: Guardian of Fire Hub 4: Effluvium

Strife

Unusually, the Strife Demo demo is recorded against a "fork" of the Sanctuary map, from earlier in that level's development.

Version DEMO1
Demo MAP32: Sanctuary
Registered MAP02: Town

Custom demos

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

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.

byte purpose
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
2 3 map
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. The last byte encodes other actions such as using/opening, shooting, and changing weapon. This structure is repeated for every player in the game.

byte purpose
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.
bit purpose
0 If set, the weapon is fired.
1 opens a door or flips a switch
2 changes to the weapon specified by the next 3 bits:
000 fist or chainsaw
001 pistol
010 shotgun
011 chaingun
100 rocket launcher
101 plasma rifle
110 BFG 9000
111 super shotgun
6 unused
7 The meaning of bits 1 and 0 is changed:
01 toggles pause
10 saves game to the slot indicated by bits 4 thru 2

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

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 a "desync", 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 a desync 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 premier 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:

Source

External links