Modding Trench Engr.

Trench Engr. · mod format 1 · updated 2 December 2026

This guide is for version 1.0.0 of the game. An older version refuses some of the fields in it.

A mod is a folder of text files, pictures and sounds. It can change the game's numbers, redraw its soldiers, guns and buildings, replace its sounds and music, and add units, armies, battlefields, battles and campaigns. A mod cannot contain code. Mods work in the game for Windows and on Android.

A battle at night, seen from above. British soldiers fire from a zigzag trench. A flare and two bursting shells light the field in front of it, where the dead come on.
The Risen, a mod we made: a new army with its own pictures and sounds, and four battles.

Six example mods come with this guide, in the downloads: a balance patch, a battlefield, a battle with its campaign, an army, and two sets of pictures. The Risen is a full mod to read after them: get it from the mod store.

The reference lists every id and name of the game, the words of a mission, and the game's messages about mods.

I want toRead
change a numberYour first mod
redraw a soldier, a tank, a gun, a building or an iconPictures
change a sound or the musicSounds, Music
make a battle or a campaignA new battle
make a unit or an armyA new unit, A new army
translate my modLanguages and letters
give my mod to othersSharing a mod
fix an errorTroubleshooting

Downloads

These are the example mods of this guide. Each .zip holds one mod's folder. On Windows, unzip it so that the mod's folder is directly inside your mods folder, and start the game again. On Android, add the .zip itself in Settings > Gameplay > Mods, with Add a mod (.zip).

  • american-army.zip 2 KB
    A new army for custom battles and multiplayer: the Americans of 1918, with their own rifle and units, drawn as British soldiers.
  • first-mission.zip 4 KB
    A new battle in a campaign of its own: a dawn attack on a copse on the Somme, July 1916.
  • magenta-machines.zip 45 KB
    Pictures for a tank, an armoured car and a field gun in magenta, with every picture each of them uses.
  • magenta-riflemen.zip 39 KB
    Pictures and a sound: the British riflemen and the rifle sections' icon drawn in magenta, and a new shot for the British rifle.
  • new-battlefield.zip 1 KB
    A new battlefield for custom battles and multiplayer: the chalk ridges of Artois.
  • veteran-sections.zip 1 KB
    A balance patch: steadier British rifle sections, a faster-firing SMLE, men of every army whose morale recovers faster, and a more forgiving Headquarters.
  • fields.txt 43 KB
    Every field a mod can write, for this version of the mod format.

Your first mod

You make and test a mod on Windows. The game makes a small one for you to start from.

  1. On the main menu, press Mods, then Make a new mod. The game makes a folder named my-mod and opens it.
  2. Open changes.json in a text editor, such as Notepad. Do not use Word. The file has two example changes. Each is on a line that starts with //, and the game skips such a line.
  3. Delete the // at the start of one example's line, and save the file.
  4. On the Mods screen, turn the mod on with its switch. A new mod is off.
  5. Start the game again. The mod's row says "Loaded.", and the change is in every new battle, the campaigns' too.

To see the change, play Skirmish > Custom battle as the British. Then change the number, and start the game again.

To make a second change in the same list, put a comma after the first one:

{
  "weapons": [
    { "id": "smle", "patch": true, "fireInterval": 2.0 },
    { "id": "lebel", "patch": true, "fireInterval": 2.0 }
  ]
}

An id is the game's name for a thing: smle is the British rifle. The reference has every id, with the name you see in the game. The field list has every field, and What the numbers mean the main ones. We do not publish the game's numbers. To find a good one, try a value, play a battle, and change it again.

In mod.json, change the name, and write your name as the author. If your data has an error, the game starts without the mod, and the mod's row says what is wrong.

The mods folder

On Windows it is %LOCALAPPDATA%\TrenchEngr\mods, usually C:\Users\<you>\AppData\Local\TrenchEngr\mods. Press Open the mods folder on the Mods screen to open it. Each mod is a folder in it. To remove a mod, delete its folder and start the game again.

The game's log, log.txt, is one folder up. It has the errors and warnings of every mod.

The Mods screen

Press Mods on the main menu. The button is in the settings too, except during a battle.

The Settings screen on its Gameplay tab. The Mods button is the last thing on the tab, at the bottom left.
The way to the Mods screen.
The Mods screen with one mod, Veteran Sections. Numbers mark the switch, the name and version, the state, and the buttons Mod store, Make a new mod and Open the mods folder.
The Mods screen on Windows.

A mod in the mods folder is on until you turn it off. The game reads its mods only when it starts. After every change, even of a switch, start the game again. At the end of a mod's row is its state:

Four rows of the Mods screen. One says Loaded, one Loaded with these problems, one Not loaded this time, one Can't be loaded. Beside each row stands what it means.
Four mods, and what the screen says of each.

The files of a mod

A mod's folder as a tree: mod.json, index.json, data files, and the folders art, sounds, music and text, each file with what it is for.
A mod with a bit of everything: most mods have only some of these files.

Name the folder after the mod's id. The game goes by the id, whatever the folder is called.

The .json files are plain text. { } holds fields, [ ] holds a list, and text goes in double quotes. Between two fields or two items there is a comma. // starts a comment, which the game skips to the end of the line. Write each field in the letter case of this guide: morale, and never Morale. Save the files as UTF-8 (in Notepad, the encoding "UTF-8").

Sharing a mod

Zip the mod's folder. On Windows 11, right-click it and choose Compress to > ZIP File. On Windows 10, choose Send to > Compressed (zipped) folder. Share the .zip.

On Windows, a player extracts the .zip into the mods folder. In Extract All, choose the mods folder itself as the place.

Two folder trees. Right: mods, veteran-sections, mod.json. Wrong: mods, veteran-sections, veteran-sections again, then mod.json.
The mod's folder holds mod.json directly.

Say in the description which version of the game the mod needs, and which other mods. When you change a shared mod, give it a new version. On Windows, players replace the old folder with the new one.

Mods on Android

A player on Android adds the .zip itself:

  1. Put the .zip on the phone.
  2. In the game, press Mods, then Add a mod (.zip), and choose the file.
  3. Start the game again.

A new version replaces the mod with the same id. Remove on the mod's row takes it out. A .zip for Android holds one mod, is at most 64 MB, and unpacks to at most 128 MB and 4096 files. No two of its names differ only in capital letters.

The mod store

The game downloads mods from its mod store, on the Mods screen. We check and sign every mod, and every new version, before it is there. To have yours in it, send it to us on Discord.

Data files

mod.json

Every mod has a mod.json. This is the one of the example veteran-sections, with a shorter description:

{
  "id": "veteran-sections",
  "name": "Veteran Sections",
  "version": "1.0",
  "author": "Example",
  "description": "British rifle sections steadier under fire.",
  "format": 1
}
FieldNeededWhat to write
idyes1 to 32 characters: a to z, 0 to 9, - and _. It starts with a letter or a digit. Never change it once others use your mod.
nameyes1 to 48 characters.
formatyes1, the mod format of this version of the game.
versionnoAt most 16 characters.
authornoAt most 48 characters.
descriptionnoAt most 400 characters. A line break is \n.
afternoThe ids of mods that load before this one (The order mods load in).

None of these texts can have a tab or an emoji.

Listing your data files

A mod with data has an index.json, which lists its data files. A mod without data has none.

{
  "files": ["scenarios/copse_1916.json", "campaign.json"]
}

Write each path as it is in the mod's folder, in the same letter case, with / between folders. The game reads the files in this order.

A data file is one object, with any of these keys. Most of them hold a list of entries:

KeyWhat it holds
units, weapons, shells, abilitieswhat fights
factions, callIns, aircraft, artilleryTempo, aiPersonalities, doctrinesthe armies, their off-map support and aeroplanes, how much their guns fire, their commanders, and the campaigns' doctrines
mapRecipes, terrain, structuresbattlefields, kinds of ground, buildings and works
scenarios, campaignsbattles and campaigns
callers, calls, requestKinds, commendationsHeadquarters: its telephone, its requests and its report
rules, hq, textsone object each: the rules of every battle, how often Headquarters asks for something, and the telephone's words

Changing the game's numbers

An entry with "patch": true is a patch. It has the id of an entry of the game, or of a mod that loads before, and changes only the fields it names:

{
  "units": [
    { "id": "gb_rifle_section", "patch": true, "morale": 70 }
  ],
  "rules": {
    "patch": true,
    "morale": { "recoveryPerSecond": 1.4 }
  }
}
Three cards: the game's rifle section, a patch that sets morale to 70 and abilities to sprint, and the result. Only those two fields changed. The list of abilities was replaced whole.
A patch changes only the fields it names.

In an object, the fields you leave out keep their value: a cost with only materiel leaves the manpower as it was. A list is replaced whole. [] empties it. rules and hq have no id. Always write "patch": true in them: without it, every field you leave out loses the game's value.

New entries and ids

An entry without "patch": true is a whole entry. With a new id, it is added to the game. With an id the game has, it takes that entry's place, and the fields you leave out take default values. A mod cannot remove an entry.

A new id has 1 to 32 characters, without spaces and accented letters. Start your ids with a short form of your mod's id, as the examples do (nb_, fm_), so that no other mod has the same one. A battle's id does not start with skirmish_ or operation_, and a battlefield's does not start with test.

For a unit, a weapon, an army, a battlefield or a battle, copy one of the examples and change it. For the other kinds, the reference has the fields an entry needs.

The field list

fields.txt has every field a mod can write, and its kind. Search it for the key and the field:

units[].morale: number
units[].members[].count: integer
units[].category: enum
units[].category: enum member Infantry

An enum takes one word of its enum member lines, such as "infantry", in any letter case. Some fields of the kind string take only certain words too.

What the numbers mean

Distances are in tiles (a tile is 4 metres), times in seconds of the battle, speeds in tiles a second.

FieldWhat it means
units[].speed, units[].visionHow fast it walks, and how far it sees.
units[].moraleHigher holds longer.
units[].suppressionResistanceHow much fire frightens it. 1 is normal, lower is steadier.
units[].concealmentHow easily it is seen. 1 is normal, lower is harder to see.
units[].cost, units[].reinforceCostWhat the unit costs, and the manpower each replacement man costs.
units[].deployTimeSeconds from the order until the unit arrives.
weapons[].range, weapons[].minRangeHow far it reaches, and how near it can fire.
weapons[].accuracyNear, weapons[].accuracyFarThe chance of a hit, from 0 to 1, close up and at the end of its range.
weapons[].fireInterval, aimTime, reloadTimeSeconds. Lower is faster.
weapons[].damageHigher is deadlier. A bullet of more damage also stops a man at once more often.
weapons[].dispersionHow far its shells scatter at full range. Lower is closer.
terrain[].cover, structures[].coverThe share of the shots that still hit a man in it. Lower protects more.
terrain[].footCost and the other costsHigher is slower.

A new unit

This is a whole unit. Copy it into a data file and change it:

{
  "units": [
    {
      "id": "my_raiders",
      "name": "Raiders",
      "faction": "gb",
      "category": "infantry",
      "role": "assault",
      "icon": "assault",
      "tags": ["assault"],
      "members": [
        { "role": "officer", "weapon": "webley", "count": 1, "leader": true },
        {
          "role": "rifle",
          "weapon": "smle",
          "secondary": "mills_bomb",
          "count": 6,
          "grenades": 2
        }
      ],
      "speed": 3.3,
      "vision": 25,
      "morale": 75,
      "abilities": ["sprint"],
      "cost": { "manpower": 45 },
      "reinforceCost": 6,
      "deployTime": 18,
      "ai": { "attack": 0.8, "assault": 0.9 },
      "description": "Picked men for a raid on the trench opposite."
    }
  ]
}
A part of a unit's entry, with numbers on its name, its icon and its two members. Beside it, the same numbers on the name, the grenade icon, one officer and six riflemen.
A part of a unit's entry, and what the player sees of it.

A custom battle offers the units of an army's units list. To add yours, patch the army: { "id": "gb", "patch": true, "units": [...] } in factions, with the army's whole list and your id at its end. It offers a unit only from its year to its lastYear. A battle of your own offers the units of a side's availableUnits.

A man is drawn as the figure his role names. A rifleman's weapon can change his figure. With a pistol he is an officer, or a bomber if his role is assault. With a submachine gun he is an smg, and with an anti-tank rifle an atrifle.

Eleven soldiers seen from above, each with its figure's name and the role that chooses it: rifle, gunner, officer, sniper, engineer, crew, bomber, flame, smg, atrifle and cavalry.
The eleven figures, and the role that chooses each.

Most bullets that hit a man stop him at once, whatever his health. The rest take some of his health. A unit's toughness, from 0 to 1, changes that. With "toughness": 0.75, three of four bullets that would have stopped him only take some of his health, and he falls when it is gone. The game's own units have no toughness.

A new army

A mod can add an army to the game's three: the British (gb), the French (fr) and the Germans (de). The example american-army.zip adds the Americans of 1918. Its army.json has these entries:

  1. A weapon of its own, the rifle us_springfield. An army can also use the game's weapons.
  2. Its units. Their faction is the army's id.
  3. Its stretcher bearers: one unit of two men with no weapon and no ability, with "category": "infantry", "nonCombatant": true, "canDig": false, "canCapture": false and "canGarrison": false. Copy us_stretcher_bearers.
  4. The army, in factions: its id, name, adjective ("the American line"), color, like, stretcherBearers, the units it can buy, and the startingUnits it has at the start of a custom battle. One of its units is infantry with "role": "rifle": its staff buys those by itself.
  5. An artilleryTempo entry: how much its guns fire without orders. Copy us_1918.

like names the army it borrows from. Give every army one. With "like": "gb", it has the British soldiers' figures, emblem, voices and telephone. It carries no flag: only the game's three armies have flags.

Choose your army in Skirmish > Custom battle. A battle of your own uses it as a side's def, and a campaign as its faction.

The Battlefield and Sides boxes of a custom battle. The battlefield is Artois ridge, the player is American and the enemy is Risen. Numbers mark the fields these come from.
Where a custom battle shows a mod's battlefield and armies.

An army's emblem is the name of a picture of your own, art/ui/emblem/<name>.png. With "headquarters": false, its player gets no requests, and the telephone never rings. If it has nobody who digs, or no gun and no call-in, the tools for that are grey. With "playable": false, a custom battle offers the army only as an enemy or an ally. (A multiplayer room offers every army.)

Guns and aeroplanes

A new army has no off-map support until you list call-ins in its callIns: some of the game's, or your own. This is a barrage for the Americans:

{
  "callIns": [
    {
      "id": "us_field_barrage",
      "name": "Field barrage",
      "faction": "us",
      "kind": "barrage",
      "icon": "fire_he",
      "cost": { "materiel": 100 },
      "cooldown": 90,
      "delay": 8,
      "weapon": "offmap_field",
      "shell": "he",
      "rounds": 16,
      "pattern": "area",
      "radius": 5,
      "duration": 15,
      "description": "Two batteries fire on the target."
    }
  ]
}

A call-in's icon is a picture of icon/cmd/. An army borrows no aircraft. For a battle's air_raid and raise_balloon, name them in its bomberAircraft and balloonAircraft.

An army's soldiers

The soldiers are drawn from two figure sets: spriteSet, and spriteSetEarly before steel helmets. To draw the Americans as the French, write "spriteSet": "fr" and "spriteSetEarly": "fr14".

Six riflemen seen from above, one of each figure set: gb14, gb, fr14, fr, de14 and de, with the dates each is used and the figures it leaves empty.
The six figure sets, each shown by its rifleman.

Most sets have empty figures. To give your men a look of their own, draw them there, and give the army that set as its spriteSet and spriteSetEarly. Draw every picture that the set's rifleman has: for unit/fr14/rifle/walk/0, draw art/unit/fr14/flame/walk/0.png. A man with "role": "flame" is then drawn from it. (How to draw a soldier.)

Three kinds of the dead, seen from above: Shamblers in the figure flame, The Quick in smg and Brutes in atrifle, each with its folder, its role and its icon.
The Risen's men, drawn in the figures that the set fr14 leaves empty.

The wounded, the stretcher bearers and the fallen are drawn as the set's own soldiers. So that none of your men lies wounded in their place, give the units "neverWounded": true. A hit then kills a man where it would wound him. To draw your own fallen, put them in art/unit/<army>/<figure>/, under the same names as the set's: body/0 to body/13, fall/fwd/0 to 4, fall/back/0 to 2, fall/side/0 and 1, fall/gas/0 to 3, and fall/blast/0. Such men drop no weapon when they fall.

Your men talk, call and cheer with the sounds of the army it is like. To give them voices of their own, add sounds with the army's id: spot_talk_risen, spot_call_risen and charge_cheer_risen for the army risen. Men that a script or a horde sends do not cheer.

A commander

defaultAi is the army's commander, an entry of aiPersonalities. An army without guns can have one with "attackStyle": "horde". It plans no attacks, and sends its men straight at the nearest enemy it knows of, in groups, again and again. A commander's armies are the armies that can have it. Without them, every army can, the game's too.

A new battlefield

A battlefield is an entry of mapRecipes. Skirmish > Custom battle and the multiplayer room list it beside the game's own. This one works, and the example new-battlefield.zip has more fields:

{
  "mapRecipes": [
    {
      "id": "nb_artois_ridge",
      "name": "Artois ridge",
      "width": 288,
      "height": 224,
      "baseTerrain": "grass",
      "villages": 4,
      "villageBuildings": ["cottage", "cottage", "farmhouse", "barn"],
      "landmarks": ["windmill", "chateau"],
      "props": ["cart", "well", "crates"]
    }
  ]
}

baseTerrain is a terrain. villageBuildings, landmarks and props are structures. With "climate": "winter", the map lies under snow.

A battlefield seen from above: a village with a windmill by a road, trenches, shell holes, woods and fields of many colours.
A battle on Artois ridge, the example's battlefield.

A new battle

A battle is a mission of a campaign. The example first-mission.zip has both. Copy its folder into the mods folder. In mod.json, change the id. In campaign.json and scenarios/copse_1916.json, change the ids that start with fm_. index.json lists the two files. Then change the battle piece by piece, and start the game again after each change. The campaign is under Campaign on the main menu.

You can also patch one value of the game's own battles, such as music, timeLimit or startHour. Lists, such as units and triggers, are replaced whole.

The campaign

campaign.json has an entry of campaigns. Every mission is fought as the army in its faction, and the campaign offers that army's doctrines. Do not put a battle into one of the game's campaigns: a patch replaces their whole list of missions.

The campaign's card and its staff map. Numbers mark the campaign's name, army, description and mission, the mission's marker and place, the town Bapaume and the river Ancre.
The example's campaign, on the Campaign page and on its staff map.

The map and the sides

The battle is the entry of scenarios in scenarios/copse_1916.json, which has comments. The reference has every part of a battle. Places are in tiles, [x, y] from the north-west corner. An area is [x, y, width, height], and a line or a shape is its corners, [x1, y1, x2, y2, ...]. Angles are degrees: 0 is east, 90 south, 180 west, 270 north. Times are seconds of the battle.

The map of the example battle, 160 by 112 tiles, with numbers along its edges. Marks show the sector The Copse, the trenches, six sections 20 tiles apart, the supply dump, the headquarters, the rear edges, the forest and the craters.
The example's battle, and the fields of its file that place everything on it.

"weather": { "initial": "fog", "dynamic": false, "script": [{ "at": 600, "weather": "rain" }] } starts in fog and brings rain after 600 seconds. The kinds are clear, overcast, rain, storm, fog and snow. With "dynamic": false, only your script changes the weather.

A battle can have its own scenery, with landmarks and props in its map. With "hq": { "requests": "scripted", "telephone": false }, Headquarters asks only what your script asks, and no telephone rings.

Leave out difficulty, setup, orderBudget and rearLine, which the game sets, and lines, remark, orders and step, which are for lessons.

Objectives and triggers

A side wins when all its primary objectives are done, or when all its enemies are beaten. It loses when one of its primary objectives fails. An objective with "primary": false is optional. When the timeLimit runs out, survive, hold_sectors and protect_units are done if they still hold, and an open primary objective of any other type has failed.

A message on a battle's screen and the list of objectives. Numbers mark the fields they come from: slip, from, title, text and stamp, then date, text and awardsStar. An objective's entry stands beside them.
What the player sees of a message and of the objectives.

When the player has won and a star objective is still open, the battle goes on for up to three minutes. The victory is already sure.

A trigger runs its actions once, when all its conditions hold. Mission words lists the types of objectives, conditions and actions, and the fields each one reads.

Three triggers of the example. Each row has the trigger's name, its conditions joined by and, an arrow, and its action.
Three triggers of the example: when all the conditions hold, the actions run.
{
  "id": "take_our_line",
  "faction": "opfor",
  "type": "capture_sectors",
  "sectors": ["our_line"],
  "primary": false,
  "text": "Take the British line"
}

A wave

This trigger sends four German sections at the British trench after 300 seconds. Put it in the example's triggers:

{
  "id": "wave_1",
  "conditions": [{ "type": "time", "time": 300 }],
  "actions": [
    {
      "type": "spawn_units",
      "faction": "opfor",
      "unit": "de_rifle_section",
      "count": 4,
      "at": [140, 56],
      "spread": 12,
      "fromEdge": false,
      "tag": "script:wave_1"
    },
    {
      "type": "move_units",
      "faction": "opfor",
      "tag": "script:wave_1",
      "to": [40, 56],
      "spread": 6,
      "mode": "fast"
    }
  ]
}

Difficulty

Regular plays the battle as you wrote it. Recruit has fewer enemies, and gives the player more resources. Veteran does the opposite. With "difficultyScale": 0, the enemy's units are as many as you wrote on every level.

On Recruit and Veteran, a stat condition on the player's soldiersLost changes, in a trigger that fails a star objective or defeats the player. The number is rounded to 50, is never below 50, and takes the old one's place in the texts. For a smaller limit, use the condition casualties: it never changes.

Pictures

A mod can replace any picture of the game except its letters, and add new ones. Such a mod is a folder in the mods folder with two things in it: a file mod.json, and a folder art with PNG files. This is the whole mod.json:

{ "id": "my-pictures", "name": "My pictures", "format": 1 }

Each picture of the game has a name, such as unit/gb/rifle/advance/0. Your file for it is art/unit/gb/rifle/advance/0.png. The reference lists which pictures each unit is drawn from, and pictures.txt has the name and the size of every one.

We do not give out the game's pictures. Start from the two magenta examples: magenta-riflemen.zip has every picture of the British rifleman, and magenta-machines.zip every picture of a tank, an armoured car and a field gun. Copy an example's folder into the mods folder, change the id in its mod.json, and draw over its pictures. Start the game again after each change.

Riflemen in bright magenta attack across a green field with shell holes, in front of a trench. The fallen are in khaki.
The example in a battle: it does not change the pictures of the fallen.

Save each picture as PNG with 8 bits per channel, not interlaced, at most 1024 pixels on a side, under a name in lower case. In GIMP, use File > Export As, choose PNG, turn "Interlacing" off and choose "8bpc RGBA". The normal PNG export of Aseprite and Paint.NET works. Any colours work. All the mods' pictures together fill at most two pages of 2048 x 2048 pixels.

Names that are new to the game are in log.txt. That is right for a new picture. If you meant to replace one, check its name.

How to draw them

Everything is seen from above. Soldiers, vehicles, guns and aircraft face right. The game turns them and draws their shadows, so light them from straight above and draw no shadow. A building has north at the top. Light it from the top left.

Draw a picture that replaces one at the size pictures.txt gives, and it is drawn where the game's was. At another size it is drawn at the same scale, so a larger picture is larger in the battle. The pictures under ui/ are stretched at another size: keep theirs.

Ten of the game's pictures at one scale on a grid of tiles, with their sizes: a rifleman of 31 by 21 pixels, guns, vehicles, a rider and an aeroplane of 92 by 144.
The sizes of some of the game's pictures, all with a d of 3.

art/sprites.json gives the pictures in your art folder their pivot and their scale. The pivot, px and py, is counted in pixels from the top left corner. The scale, d, is a number from 1 to 4: a picture with "d": 3 is drawn at a third of its size. A picture that replaces one of the game's has that one's pivot and scale, and needs no entry. A new picture without an entry is drawn at full size, with its pivot in the middle of its bottom edge.

{
  "unit/fr14/flame/aim/0": { "px": 9, "py": 10, "d": 3 }
}
A soldier's picture of 31 by 21 pixels, facing right, with its pivot at px 9 and py 10, counted from the top-left corner. Beside it the same man turned four ways about the pivot.
A soldier's pivot is the middle of the man.
The same soldier drawn three times on the battle's tiles: small with d 3, larger with d 2, and three times as large with d 1.
The same picture with a d of 3, 2 and 1.

Soldiers, vehicles, guns and aircraft have a d of 3. A tile is then 24 pixels of your picture. Buildings have 2, and a tile is 16 pixels. Icons have 1.

Soldiers

A set has a folder for each figure: unit/gb/rifle, unit/gb/officer and so on. A figure is a set of animations, and an animation is a row of numbered frames. You can replace any frame. You cannot add frames or change their speed. In battles before steel helmets, the soldiers are drawn from other sets, unit/gb14, unit/fr14 and unit/de14.

Every picture of a British rifleman, by animation: walk, advance and run with 8 frames each, crawl with 4, throw with 3, fire, kneel_fire, prone_fire, dig, melee and down with 2, idle, aim, kneel, prone and fidget with 1.
The 48 pictures of a British rifleman, in unit/gb/rifle/.

The fallen and the wounded are not in a figure's folder. A set has one of each for all its men: fall, body and hurt. The stretcher bearers are in hurt too.

The pictures of a fall forward, back, to the side, by gas and by a shell, the wounded crawling and lying, and the fourteen bodies, 0 to 13.
The fallen and the wounded, in unit/gb/.

Icons

A unit's icon names its picture: "icon": "rifle" is icon/unit/rifle. For an army other than the British, the game first looks for the picture with the army's id, such as icon/unit/rifle_us.

The rifle icon large on its 18 by 18 pixels, sixteen unit icons with their names, three emblems of 16 by 16 pixels and three icons of 12 by 12 pixels.
Unit icons, emblems and the icons of a battle's top bar.

Buildings

A building's pivot is the top left corner of the tiles it stands on. What you draw outside them is drawn round the building.

A supply dump intact, with the tiles it stands on outlined. The pivot is the top-left corner of those tiles, at px 4 and py 12. Beside it the same building damaged, ruined and as rubble.
A building's four pictures, with the tiles it stands on outlined.

A new structure with "sprite": "my_hut" is drawn from structure/my_hut/intact, damaged, ruined and rubble. Without damaged or ruined, intact is drawn. A hut with a width and a height of 2 is a picture of 32 x 32 pixels, with this entry for each state:

{
  "structure/my_hut/intact": { "px": 0, "py": 0, "d": 2 }
}

The game's houses are drawn from many pictures: the farmhouse from 518. To redraw it with four, give it a sprite of your own. This is a patch in a data file. A mod with a data file also needs an index.json, which magenta-machines has.

{
  "structures": [
    { "id": "farmhouse", "patch": true, "sprite": "my_farm" }
  ]
}

Draw art/structure/my_farm/intact.png and the other three states, with the entry above for each. For how large, look up structure/farmhouse/intact in pictures.txt. A patch is data, so online you then meet only players with the same mod.

Vehicles and guns

A new vehicle or gun needs an entry in art/sprites.json for each of its pictures, with "d": 3 and the pivot.

Two captures of the same battle. With sprites.json the tank is a little larger than the soldiers near it. Without it the tank is three times too large and its turret is off its place.
The same mod with its sprites.json and without it.

A vehicle's pictures are in art/vehicle/<sprite>/, where <sprite> is the sprite of the unit's vehicle. Only hull/0 is needed.

The patch that gives a tank the sprite magenta_tank, then the folder art, vehicle, magenta_tank with its pictures, then that tank in a battle.
The sprite of a vehicle is the name of its folder.
PictureWhat it shows
hull/0The hull. Its pivot is the point the vehicle turns about.
hull/1 to hull/8The hull with its tracks moved on. The number is 3 x the left track's position + the right's. In hull/5 the left track is at 1 and the right at 2.
hull/9The tracks blurred, for a tank driving fast.
damaged/0 to damaged/9The same pictures for a vehicle that has lost more than half its hull.
turret, turret_damagedThe turret of a vehicle with "hasTurret": true. Its pivot is put on the hull's pivot.
stripes, stripes_damagedStripes drawn over the hull in battles from June 1918, on a vehicle without strips.
wreckThe vehicle destroyed.
The hulls 0 to 8 of a tank in a table: the rows are the left track's three positions, the columns the right track's. Under them hull 9 with blurred tracks, and one track large in its three positions.
The ten pictures of a tank's hull, with a mark on the same link of each track.

With hull/0 alone, the tracks do not move. Draw all ten hulls, or only the first.

A tank's hull and turret, each with its pivot, then the turret turned on the hull. Under them the damaged hull, the damaged turret on it, and the wreck.
A tank's turret, its damaged pictures and its wreck.

Cars, lorries and the Mark I tanks have one hull, hull/0, and strips drawn over it for their moved wheels or tracks: run/l/1, run/l/2 and run/l/b (blurred) for the left side, and run/r/1, run/r/2 and run/r/b for the right. Draw all six. The strips in run_damaged go over damaged/0. A strip's pivot is measured from the strip's own top left corner, so it can be outside the strip.

A car's hull with the strips run/l/1 and run/r/1 outlined on its two sides. Arrows show the right strip's pivot, px 15 and py -10, counted from the strip's corner. Beside it the six strips.
A car's hull, and the six strips that turn its wheels.

A gun's pictures are in art/weapon/<sprite>/, where <sprite> is the sprite of the unit's crewWeapon. Only idle/0 is needed. The pivot of every picture but packed/0 is the point the gun turns about.

PictureWhat it shows
idle/0The whole gun, ready to fire.
mount, barrelThe gun in two parts, drawn in place of idle/0 when it has both. The barrel slides back when the gun fires.
baseWhat stays still when the gun turns: the shells beside a field gun, or an anti-aircraft gun's lorry.
packed/0A machine gun, a mortar or an anti-aircraft gun on the move.
coverThe canvas covers of a field gun or howitzer on the move. A gun with covers has no packed/0.
A field gun's mount, barrel, cover and base, each with its pivot. Under them the base, mount and barrel together on one pivot, with the flash at the barrel's right end, the whole gun as idle/0, and the gun on the move with its covers.
A field gun's pictures, apart and together.
A machine gun's four pictures, each with its pivot: idle/0 set up, mount, barrel, and packed/0 being carried.
A machine gun, set up and carried.
A table of five guns and their pictures. The machine gun and the mortar have idle, mount, barrel and packed. The field gun and the heavy howitzer have idle, mount, barrel, base and cover. The anti-aircraft gun has idle, mount, barrel, base and packed.
The pictures each kind of gun has.

The flash is at the right end of a gun's barrel, at the right end of a turret, and for a gun in the hull at the outermost pixels of hull/0 on its side.

Give a new vehicle or gun a sprite name of its own. The game looks first for that name with _gb, _fr or _de at its end, by the army's figure set (a vehicle's needs a wreck). So one sprite can have a look for each army: weapon/fieldgun_gb is the 18-pounder, and weapon/fieldgun the German gun. For a gun, a folder with the id of its weapon comes before both.

Two units of one side with the same weapon are drawn as the same gun. For two looks, give them two weapons. The Mark I tanks are always drawn from vehicle/mk1_male and vehicle/mk1_female.

Aircraft

An aeroplane is drawn from aircraft/<sprite>/0 and aircraft/<sprite>/wreck, with "d": 3 and the pivot in the middle of the machine. Some of the game's aeroplanes change with the battle's date: the reference has the pictures of each.

An aeroplane seen from above, facing right: picture 0, in the air, 92 by 144 pixels, and picture wreck, shot down, 91 by 141. Each has its pivot marked.
An aeroplane's two pictures, in aircraft/<sprite>/.

Sounds

Put WAV files in a folder named sounds. sounds/rifle_shot_smle.wav replaces the sound rifle_shot_smle. For several takes, of which the game plays one each time, make a folder: sounds/rifle_shot_smle/one.wav, sounds/rifle_shot_smle/two.wav. The reference has the names of the sounds. The game's loud sounds have a near, a middle and a far version, and your file replaces all three. It loops if the game's sound does.

A name the game does not have adds a new sound, which never loops. Use it as the sound of a weapon, as the destroySound of a structure, or in a battle's sound action. The game's rifles, and every howitzer with an explosion radius of 5 tiles or more, always play their own: replace rifle_shot_smle, rifle_shot_lebel, rifle_shot_g98 or heavygun_fire. To change an engine, replace tank_engine, tank_tracks, truck_engine or aircraft_engine.

Export each sound as WAV, Signed 16-bit PCM, mono or stereo, at 8000 to 48000 Hz, under a name in lower case. In Audacity, use File > Export Audio, "WAV (Microsoft)", "Signed 16-bit PCM", 44100 Hz. The game does not read MP3 and OGG. It plays your file as loud as it is, so listen to it in a battle. A sound is at most 60 seconds long. All the mods' sounds together last at most about 4 minutes 45 seconds in mono at 44100 Hz, and half that in stereo.

Music

Put WAV files in a folder named music. menu.wav, briefing.wav, battle.wav and elegy.wav replace the game's four pieces. The elegy is for some battles, and for the report of a lost one. Any other name of 1 to 32 lower-case letters, digits and _ is a new piece: a battle plays music/verdun_theme.wav with "music": "verdun_theme".

A piece plays, rests a while, and starts again. The game's battle music grows with the fighting. A mod's piece plays the same all the time.

Export each piece as WAV, Signed 16-bit PCM, at 44100 or 22050 Hz, 2 seconds to 6 minutes long, at most 64 MB. The game plays music in mono at 22050 Hz, where a minute is about 2.6 MB. A mod has at most 16 pieces.

Languages and letters

The game translates its own texts. Yours are shown as you wrote them. To translate them, put a file for each language in a folder named text: fr.json, de.json, es.json, ru.json and tr.json. Each has your texts, letter for letter, and their translations:

{
  "exact": {
    "The Risen": "Les Revenants",
    "Hold the line until dawn": "Tenez la ligne jusqu'à l'aube"
  }
}

Translate each name, adjective, description, briefing, intro, epilogue, date, location, displayName and mapName, each objective's text and short, and each message's title, text and from. A title and its text are two entries. If a text has a limit on losses, also translate it with the numbers of Recruit and Veteran (Difficulty). Where the game has the same English text, such as "Rifle Section", its own translation is shown.

The game's font has these characters, and draws any other as a space:

Multiplayer

Players play together only when they have the same data. Pictures, sounds, music and translations do not count.

A multiplayer battle is a custom battle. It uses a mod's battlefields, armies, units, weapons and rules, and none of its campaigns. The list of public battles shows the battles whose host has the same data as you.

When you join a battle by its room code and the host plays with mods from the mod store, Download and join gets them, starts the game again with them, and joins. Your own choice of mods comes back at the next start. If one of the host's mods is not in the store, you need the same mod to join.

Saves

A saved battle goes on only with the data it was played with. If you turn a data mod on or off, or change its data, Continue and Load saved battle do not offer an older save. The game keeps it, and the main menu says which mods it needs. A campaign of a mod that is off is not shown, and its progress is kept.

The order mods load in

The game loads its own data first, then each mod that is on. A patch changes the entry as the mods before left it. When two mods replace the same entry, picture or sound, the later one wins.

Four cards with arrows between them: the game, a-mod, b-mod and the battle. a-mod changes morale and the rifle icon, b-mod changes speed, and the battle has all three changes.
Each mod changes what the ones before it left.

A mod loads after the mods named in its after, if they are there. Apart from that, mods load in the order of their ids, character by character: - first, then digits, _, and letters.

What a mod cannot change

Troubleshooting

A mod loads but changes nothing

Open log.txt, one folder above the mods folder, and search it for Mods and Content. It has warnings that the Mods screen does not show. Then check that:

Messages

Fix the first error, start the game again, and read the row again: some errors show only when the ones before them are gone. In a message, units[0].morale is the morale of the first entry of units, because a list counts from 0. The reference has all the messages. These are the common ones:

MessageWhat to do
Line N, column M: not valid JSON. ...Look at that place, and before it, for a missing comma, bracket or double quote.
The file ends too soon: a }, a ] or a closing quote is missing.Close every {, [ and " that you opened.
Line N, (path): "Y" is not a field the game knows. ...Fix the name's spelling or letter case, or move it to its right place. If the guide has the field, the game is older than 1.0.0.
Line N, (path): must be ...Write a value of the kind it names. If it ends "without quotes.", take the quotes off.
This folder has no mod.json.The mod's folder is inside another one. Move the inner folder into the mods folder.
X: rename it mod.json, in lower case.Rename the file.
The file is not UTF-8 text: save it as UTF-8.Save the file again with the encoding "UTF-8".
The mod's id must be 1 to 32 characters ...Use only a to z, 0 to 9, - and _.
Two folders hold the mod 'Y' ...: keep one.Delete one folder, or give one of the mods another id.
X: Listed in index.json but missing.No file has that path, in exactly that letter case.
X: Patch of an unknown entry of "units", 'Y': ...Check the id, and that the mod that adds it is on and loads first.
units/Y: Unknown member weapon 'Z'.Any "Unknown": the id is misspelt, or its mod is off or loads later.
units/Y: Morale must be positive.A value is out of its range. The message says the rule.
factions/Y: Missing stretcher bearers.Give the army stretcherBearers.
factions/Y: startingUnits must list ...Give the army startingUnits, with a unit that fights.
X: Unsupported PNG ...Export it again as an 8-bit PNG, not interlaced.
X: ...: left out. Export it as WAV, ...Export it again as the message says.
X: 'Y' is not a language the game translates into ...Name the file fr.json, de.json, es.json, ru.json or tr.json.
The archive holds more than one mod.json: ...Android: zip one mod's folder.

If a message is not clear, ask us on Discord.