LmpStats is a simple library to collect statistics from demo files (usually with the .lmp extension) for Doom-engine games and related source ports.
Primary statistics are the demo version, map slot, skill, and length in game tics and time. Additional stats are gameplay flags, players present, and more depending on the format.
This library is intentionally kept basic and command-line oriented, with errors/messages merely echoed. Conversion to a class with exceptions et al, if so desired, is left as an exercise for the reader. :-)
Requirements: PHP
- Doom: v1.0-v1.9, v0.5 alpha
- Heretic
- Hexen
- Strife: v1.01
- Boom/MBF: v2.00-2.04, v2.10-2.14
- CDoom: v2.05-2.07
- Chase, Timer
- Doom64 EX: v1.4, v2.5+
- Doom Classic: v1.11-1.12
- Doom Legacy: v1.29+
- Doom + Doom II (Legacy of Rust)
- DSDA-Doom
- Eternity Engine: v3.29+
- MBF21 v2.21
- PrBoom+ v1.11 longtics
- PrBoom+um v2.5.1.7-v2.6+
- RUDE: v3.1.0pre5+ extended
- TASDoom v1.10, TASMBF v2.03
- ZDaemon v1.09+ (minimal)
- ZDoom v1.11-1.12 (minimal)
- ZDoom-family: v1.14+
lmpStats.php is a command-line script to invoke the library on a demo file, and also shows how to include lmpstats.inc.php in a script and use its results.
lmpStats.php [-d <level 1/2>] [-H|X|A] [-cl] [-z9] LMP-file
The debug flag (-d
) shows all tics and messages at level 2
, or only special tics at level 1
, with tic addressing from the start of the file. For the ZDoom-family, tic addresses are relative to the start of the (uncompressed) body chunk, which is saved in /tmp/body.lmp
at both levels for hex-dump comparison.
The game flag is needed to distinguish Heretic (-H
), Hexen (-X
) and Doom v0.5 alpha (-A
) from version-less Doom v1.0-1.2 demos.
The Classic (-cl
) flag is needed to distinguish Doom Classic format from PrBoom+ longtics format, both v1.11.
The ZDoom v2.0.9x (-z9
) flag is needed for versions 2.0.90-96 to handle the bug where demo command DEM_INVUSE
was changed from 1 to 4 bytes without incrementing DEMOGAMEVERSION.
The return array contains the following entries, if available:
vers
: LMP version (see below)rver
: real version for Eternity, ZDaemon, and ZDoom-familysver
: sub-version for Eternity or minimum version for ZDoom-familyumap
: PrBoom+um v2.5.1.7 flagskll
: skill levelepis
: episode number (always 1 for Doom II)miss
: mission or map numbermapn
: map name for Doom Legacy and ZDoom-familymode
: multiplayer mode: 1 = deathmatch, 2 = altdeath, 0 = single- or cooperativemply
: multiplayer flag for Doom Legacyresp
: respawning monsters flagfast
: fast monsters flagnomo
: no monsters flagcomp
: compatibility flag for Boom/MBF and Eternityinsr
: demo insurance flag for Boom/MBF and Eternityseed
: random seed for Boom/MBF, Eternity and ZDoom-familyview
: which player's point of view, aka console playerply1
: player 1 present (1/0)ply2
: player 2 present (1/0)ply3
: player 3 present (1/0)ply4
: player 4 present (1/0)plys
: total number of playerscls1
: class of player 1 (Hexen: 0-2, otherwise -1; class name for ZDoom-family)cls2
: class of player 2cls3
: class of player 3cls4
: class of player 4long
: tic length in bytes (0 for dynamic tics in Doom Legacy and ZDoom-family)tics
: number of ticstsec
: total demo length in secondsmins
: minutes portion of demo lengthsecs
: seconds portion of demo lengthfoot
: footer string, e.g. in PrBoom+ and Doom Legacy
The Hexen class numbers are 0 = Fighter, 1 = Cleric, and 2 = Mage.
This is a list of LMP version bytes currently recognized and returned by LmpStats:
Version | Engine |
---|---|
-1 | Doom v0.5 alpha |
0-4 | Doom v1.0-1.2, Heretic, Hexen: skill value |
68 ('D') | Doom64 EX v2.5+ ("DM64") |
88 ('X') | ZDaemon v1.09+ ("ZDD") |
89 ('Y') | ZDoom v1.11-1.12 ("ZDEM") |
90 ('Z') | ZDoom-family ("FORM") |
101 | Strife |
104 | Doom v1.4 beta |
105 | Doom v1.5 beta |
106 | Doom v1.6 beta, v1.666 |
108 | Doom v1.8 |
109 | Doom v1.9 |
110 | TASDoom v1.10, Chase, Timer |
111 | PrBoom+ v1.11 longtics |
111 | Doom Classic v1.11 with -cl |
112 | Doom Classic v1.12 debug |
116 | Doom64 EX v1.4 (and other v1.x releases?) |
129-144 | Doom Legacy v1.29-1.44+ |
200-204 | Boom/MBF v2.00-2.04 |
203 | TASMBF v2.03 |
205-207 | CDoom v2.05-2.07 |
210-214 | Boom/MBF v2.10-2.14 |
221 | MBF21 v2.21 |
222 | RUDE v3.1.0pre5+ extended |
255 | Eternity Engine, PrBoom+um v2.6+, DSDA-Doom, Doom + Doom II |
ZDoom_versions.txt provides a list of version numbers in the ZDoom-family.
- Demo specification on the Doom Wiki
- The unofficial LMP format description
- Demo version bytes list
- Boom / MBF demo header format
- Doom + Doom II demo header format
- DSDA Demo format
- MBF21 demo header format
- ZDaemon .zdd version format
- Analysis of CDoom sources
- Analysis of Doom Classic sources
- Analysis of Doom64 EX sources or alternate repository
- Analysis of Doom Legacy sources
- Analysis of DSDA-Doom sources
- Analysis of Eternity Engine sources
- Analysis of PrBoom+ sources
- Analysis of RUDE sources
- ZDoom demo specification on the ZDoom wiki
- Analysis of ZDoom & GZDoom sources and more ZDoom sources
This project is licensed under the MIT license. See LICENSE.md for details.