A demo, short for demonstration, is a recording of settings and in-game commands allowing to reconstitute a playthrough with perfect accuracy. The demo format, however, is very susceptible to engine or level changes. For this reason, ZDoom does not offer backward demo compatibility: if a demo was recorded with too old a version of ZDoom, the program will tell you it cannot play it back.
ZDoom is also not compatible with the vanilla Doom demo format and will therefore not play the demo loop from the various supported IWADs. Because of the lack of backward demo compatibility, it is not advised to put built-in demo lumps in a ZDoom mod, as they risk getting obsoleted. Instead, a scripted TITLEMAP can be used.
The ZDoom demo format is based on the Interchange File Format. It contains a FORM chunk of type ZDEM. It is then followed by several chunks, which can be of the following types:
- ZDHD: ZDoom demo header. Contains engine version, map label, and random number generator seed.
- VARS: Variables. Stores the state of the demo-critical console variables.
- UINF: User information. Contains data about each of the players recorded in the demo.
- NETD: Net demo. Contains no info, but its presence flags the demo as being multiplayer.
- WEAP: Weapons. Contains the list of weapons available in-game during the demo and which slot they use.
- BODY: Body. Contains the bulk of the demo: the commands issued each tic by each player. This chunk may be compressed with zlib.
- COMP: Compression. Contains the total size of the BODY chunk data when uncompressed.
Critical console variables
Demo-critical console variables are those that have either the CVAR_DEMOSAVE flag or the CVAR_SERVERINFO flag. They include:
Currently, the VARS chunk can store up to 32 console variables.