Changes

From DoomWiki.org

Demo

94 bytes removed, 12:58, 11 January 2016
m
Doom: remove TTs
=== Doom ===
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 <tt>{{c|-respawn</tt>}}, <tt>{{c|-fast</tt>}}, and <tt>{{c|-nomonsters</tt> }} [[parameter]]s were used, and which player's point of view should be used.
{| {{prettytable}}
! up to 1.2 !! post-1.2
|-
| N/A || 0 || [[Versions of Doom and Doom II|game version]]: <tt>{{c|109</tt> }} for version 1.9
|-
| 0 || 1 || [[skill level]]:Values <tt>{{c|0</tt> thru <tt>}} through {{c|4</tt> }} indicate "I'm too young to die" thru through "Nightmare!", respectively.
|-
| 1 || 2 || episode: always <tt>{{c|1</tt> }} for Doom 2
|-
| 2 || 3 || map
|-
| N/A || 4 || [[multiplayer|multi-player mode]]: <tt>{{c|1</tt> }} means deathmatch, <tt>{{c|2</tt> }} altdeath, <tt>{{c|0</tt> }} is used for single-player or cooperative multi-player
|-
| N/A || 5 || non-zero value implies use of <tt>{{c|-respawn</tt>}}
|-
| N/A || 6 || non-zero value implies use of <tt>{{c|-fast</tt>}}
|-
| N/A || 7 || non-zero value implies use of <tt>{{c|-nomonsters</tt>}}
|-
| N/A || 8 || which player's point of view to use, zero-indexed (<tt>{{c|0</tt> }} means player 1)
|-
| 3 || 9 || set to <tt>{{c|1</tt> }} if player 1 present
|-
| 4 || A || set to <tt>{{c|1</tt> }} if player 2 present
|-
| 5 || B || set to <tt>{{c|1</tt> }} if player 3 present
|-
| 6 || C || set to <tt>{{c|1</tt> }} 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 in a special format.
For this last byte, game events - namely, saving the game and pausing - are signalled signaled when the highest bit, bit 7, is set to <tt>{{c|1</tt>}}. If so, the lowest two bits are then checked. If the value is <tt>{{c|01</tt>}}, the game issues a pause or unpause command. If the value is <tt>{{c|10</tt>}}, the game saves to the slot encoded in bits 2, 3, and 4, which is treated as a three-bit value from <tt>{{c|000</tt> }} to <tt>{{c|101</tt>}}. If there is a game event, the game does not check for any other button presses.
If the highest bit is not set, the game next looks to see if bit 2 is set. If so, the game executes a weapon change, using the values in bits 3, 4, and 5, treating the value like a 3-bit number, from <tt>{{c|000</tt> }} to <tt>{{c|111</tt>}}, and activating a change to the weapon number key corresponding to one greater than the value, namely, from 1 to 8.
Finally, the game checks for a use command on bit 1, and a fire command on bit 0.
! byte !! purpose
|-
| 0 || forward/backward movement: Positive values indicate forward movement, negative backward. <tt>{{c|50</tt> }} is normally the highest achievable speed if running. <tt>{{c|24</tt> }} is the walking speed. Any number from <tt>{{c|-50</tt> }} to <tt>{{c|50</tt> }} can be achieved with a mouse.
|-
| 1 || [[strafing]]: Positive values indicate rightward movement, negative leftward. <tt>{{c|40</tt> }} is the running speed, <tt>{{c|24</tt> }} without running. <tt>{{c|[[straferunning|50]]</tt> }} is also achievable in a somewhat complicated way.
|-
| 2 || turning: Positive values are left turns, negative right.
|}
Following the series is a <tt>{{c|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.
7,722
edits