Enemy Territory demo decoder
This is a simple tool for extracting popups, chat messages and kill messages from Wolfenstein - Enemy Territory demo files (
*.dm_84). It's been developed and tested for ET 2.60b and ETPro 3.2.6. Other mods might work (depends on various protocol changes), but I'm not interested in them enough to try and adjust the code.
You can simply place the binary in your demos folder and run it, which is the same as running:
etdd -i *.dm_84 -o etdd.log
In other words, decoder will find all demos in current folder and writes data into
etdd.log. Color codes are stripped by default to enhance readability.
-i <pattern>- supply glob compatible pattern (asterisk matches everything but directory separator),
-o <output>- output filename, alternatively you can pass just
--, which means a standard output,
-c- use this flag to disable color stripping.
How it works
This is basically ported and simplified parsing related code from Wolfenstein - Enemy Territory source code (which is more or less compatible with Quake 3). As individual demo messages are compressed and porting the decompressor would be just waste of time (you can find elsewhere how that works), Huffman related code was extracted almost as is and necessary Go binding was made. This slows down the parser a little bit, but it's not a major issue, especially since routines are utilized, so that up to 16 files are processed concurrently.
Unlike the real game client, which isn't synchronized with network, event detection is done right after each of demo messages.
Entity (and player) states are maintained and updated via incoming delta-compressed snapshots, which is necessary to be able to read and output interesting events. Events (such as kill messages) are transmitted as just a special kind of entities.