This is a PyO3 module that parses .dem packet traces (demo-files) generated by Source games using demostf/parser, yields them as Python objects, and rolls wheels using maturin, motivated by the need for integration into MAC.
Using this library, data storage and annotation can be decoupled from the batch processing of demo-files, avoiding the introduction of a domain-specific format for training of AI models, and hopefully helping separate the concerns of individual applications consuming such data from the pipelines producing and ingesting it.
Haha, you thought. Nah, but this is actually a build section. You can only install from source.
in the project root:
$ python3 -m venv venv # optional: create a virtual environment
$ . venv/bin/activate # you can also activate a different one obviously
$ pip install maturin
$ maturin develop --release # this should automatically build and install a wheel for you
This will build a wheel in the targets/
subdirectory that you can pip install
in other virtual environments. Or if you prefer, you can just run your
application code in this source tree. Go ahead. I'm not the file police.
import demoreel
demo_path = REPLACE_ME
with open(demo_path, "rb") as istrm:
octets = istrm.read()
# all game events, map boundaries, player states, and instances of damage
dtrace = demoreel.dtrace(octets)
- reassess automatic state integration
- dumping an entire state representation is really large
- maybe it's better to just publish sparse state updates (e.g., hurt events)