A demo is a recorded game: not pictures, but the player’s inputs, tic by tic. The game
replays it by running the same map with the same inputs, so a demo only plays back
correctly in the version of the game that recorded it. The IWADs hold the demos the title
screen shows, DEMO1 to DEMO3 (and DEMO4 in The
Ultimate Doom); players record their own to .lmp files in the same
format.
Header
Doom 1.4 and later start with the version that recorded the demo, and write 13 bytes:
| Offset | Size | Name | Description |
|---|---|---|---|
| 0 | 1 | version | 104 to 109 for Doom 1.4 to 1.9. The game refuses a demo of another version. |
| 1 | 1 | skill | 0 to 4, from “I’m too young to die” to “Nightmare!”. |
| 2 | 1 | episode | The episode; 1 in Doom II. |
| 3 | 1 | map | The map number. |
| 4 | 1 | deathmatch | 0 for co-op or single player, 1 for deathmatch, 2 for altdeath. |
| 5 | 1 | respawn | 1 when monsters come back. |
| 6 | 1 | fast | 1 for fast monsters. |
| 7 | 1 | nomonsters | 1 for no monsters. |
| 8 | 1 | consoleplayer | The player whose view is shown, from 0. |
| 9 | 4 | playeringame | One byte for each of players 1 to 4: 1 when the player is in the game. |
Doom 1.2 and earlier wrote no version and only 7 bytes: skill, episode, map and the four player bytes. Their first byte, the skill, is 0 to 4, which tells them apart. The source code released in 1997 writes version 110.
Tics
Then, for each tic (a 35th of a second), four bytes for each player in the game, in player order:
| Offset | Size | Name | Description |
|---|---|---|---|
| 0 | 1 | forwardmove | Signed: forwards when positive, backwards when negative. |
| 1 | 1 | sidemove | Signed: right when positive, left when negative. |
| 2 | 1 | angleturn | The high byte of the turn: the game reads it as this byte × 256, and positive turns left. |
| 3 | 1 | buttons | Bit 0 fire, bit 1 use, bit 2 change weapon to the one in bits 3 to 5. With bit 7 set, a special: bit 0 pause, bit 1 save the game in the slot in bits 2 to 4. |
The byte 80 where a tic would start ends the demo. Doom 1.91 and source
ports that keep the full 16 bits of the turn (“long tics”, version 111) use 5 bytes a
player.
0Header6D 02 01 01 00 00 00 00 00 01 00 00 00: version 109, skill 2, E1M1, player 113 bytes13Tic 019 00 00 00: forwards 254 bytes17Tic 1E7 00 00 01: backwards 25 and fire4 bytes21End801 byte
Other games
Heretic, Hexen and Strife record more for each tic, such as looking up and down and using an artifact, and source ports such as Boom have headers of their own. The explorer decodes Doom’s demos and shows the others as bytes.