Python implementation of genieutils.
This library can be used to read and write empires2_x2_p1.dat
files for Age of Empires II Definitive Edition.
Currently, only the recent versions used in Age of Empires II Definitive Edition are supported
(GV_C20
and above, corresponding to FileVersion 7.7 and above).
pip install genieutils-py
The package comes with a handy command line tool that does that for you.
dat-to-json path/to/empires2_x2_p1.dat
from genieutils.datfile import DatFile
data = DatFile.parse('path/to/empires2_x2_p1.dat')
data.techs[22].resource_costs[0].amount = 69
data.save('path/to/modded/empires2_x2_p1.dat')
from genieutils.datfile import DatFile
data = DatFile.parse('path/to/empires2_x2_p1.dat')
for civ in data.civs:
civ.units[434].bird.tasks.pop()
data.save('path/to/modded/empires2_x2_p1.dat')
Before running tests, you need to add sample empires2_x2_p1.dat
files into the tests/testdata
subfolder.
- Create a virtual environment
python3 -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install the dev dependencies
pip install -r requirements-dev.txt
- Install the local checkout of genieutils-py in editable mode
pip install -e .
- Run the test script
./test
HSZemi - Original Author