Template Alterator

Alter the templates of the original game or any other mod to create your own mod while keeping track of changes done to the original mod.

Template Alterator was created to build gameplay mods from the original game. It aims to be able to change a lot of values while keeping tracks of the changes from the game, for compatibility and new features.

It acts like a compiler with a set of changes to apply on a list of files.


Grab the source code from the link at the bottom of the page and put it wherever you want.

Template Alterator requires Python 2.7 (it may work with Python 3) and maybe an XML lib.

Using Template Alterator

Project directory

First you will require a directory for your mod. This directory will hold the project file and the generated templates. It requires only one file named project.txt


This files list all the changes you want to apply to a given (or multiple) mods. It is a one command per line file.

You can set blank lines and lines starting by a # are comment lines (you cannot add a comment at the end of a line though)

Each line has a <command> <args> structure.


source tells where to find the original templates. The argument is the directory to the mod you want to alter. Every command after this one will use the given mod as a reference. source is the first command you will place in the file, but you can switch to an other mod later on in the file.

source /home/me/games/0ad/binaries/data/mods/public


alter defines the template you want to edit. Its argument is the full name of the template in the source mod. Call alter an other time to switch to an other template.

Note that you can't edit the same template twice. If you do, only the latest changes are saved.

If source has not been called previously, you will have an error.

alter simulation/templates/template_unit_champion.xml


set changes the value of an xml element in the selected template. It takes two arguments: the xml element to alter and its new value.

If alter is not called before, you will have an error.

set Health/Max 120

Sample project.txt

This sample will changes the champions HP to 120 and pikeman hack armour and pierce damage to 3 and 7 respectively from the original game.

source /home/me/games/0ad/binaries/data/mods/public

# Units
alter simulation/templates/template_unit_champion.xml
set Health/Max 120
alter simulation/templates/template_unit_infantry_melee_pikeman.xml
set Armour/Hack 3
set Attack/Melee/Pierce 7

Running Template Alterator

Once you have written your project.txt you can run alterator.py to compile the templates. It takes one argument: your project directory where your project.txt lies.

python alterator.py /home/me/mymod
0adta/start.txt · Last modified: 2017/07/11 11:49 (external edit)
Recent changes RSS feed CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki