Quick Modding Tutorial: Workhouse

Modding Guide
20 Sep 2022, 2 p.m.

Here's a quick tutorial on how to mod a new city upgrade into Airships - a Workhouse, which increases city industry but also raises unrest.

(See actual historical work houses and their awful history, for example the Andover Workhouse Scandal, whose Wikipedia article has a section named "Bone-gnawing".)

You can download the completed mod here for reference.

Mods work by adding new entries to the game data, or changing existing ones. All the data can be edited using freely available tools. You need:

  • A plain text editor. Notepad will do on Windows, though a better editor like Notepad++ is recommended. The built-in text editor on Linux should work fine.
  • A graphics program. I recommend GIMP, but anything that can produce transparent PNGs works fine.

To start out, go into the game's mods folder, which you can find here:

  • Windows: %APPDATA%\AirshipsGame\mods
  • Linux: [home]/.airshipsgame/mods

Create a new folder in the mods folder called "workhouse".

To make the mod, we need to specify the following things:

  • Information about the mod in info.json
  • A mod logo in logo.png
  • The workhouse upgrade in CityUpgradeType/workhouse.json
  • Text in strings/en.properties
  • Pictures in images/workhouse.png

JSON is a pretty simple text-based data format. You can read more about it here.

The info.json file should look like this:

{
    "id": "workhouse",
    "name": {
        "en": "Workhouse"
    },
    "description": {
        "en": "Mod that adds a workhouse."
    }
}

So this specifies the mod's ID (which should be unique, so call it something like "steve_workhouse") and its name and description - in English, or in multiple languages if available.

The logo.png file should be a 512x512px PNG file. For simplicity's sake, I've grabbed some public domain art and cropped it appropriately:

Next, the meat of the matter is in CityUpgradeType/workhouse.json. The folder name tells the game what kind of information to expect. The file looks like this:

[
    {
        "name": "workhouse",
        "forTown": false,
        "production": 1,
        "unrest": 10,
        "maintenance": 0,
        "extraCost": -300,
        "icon": { "src": "workhouse", "x": 32, "y": 0 },
        "icon32": { "src": "workhouse", "x": 0, "y": 0 }
    }
]

So this specifies:

  • the internal name of the upgrade is "workhouse"
  • it's for cities, not towns
  • it adds 1 point of production
  • it adds 10 points of unrest
  • it costs $0 maintenance
  • it's $300 cheaper than the base city upgrade price
  • the small 16x16px monochrome icon can be found at x=32, y=0 in workhouse.png
  • the larger 32x32px colored icon can be found at x=0, y=0 in workhouse.png

So "workhouse" is the internal name of this upgrade, but we also need to give it a proper name and description. To do the English text, create strings/en.properties, which looks like this:

cityUpgrade_workhouse=Workhouse
cityUpgrade_desc_workhouse=Putting the surplus population to work, whether they want to or not.

Or some similarly unpleasant description. Did I mention that you're not exactly playing the good guys in this game? With all the war? Anyway. City upgrades need two pieces of text, cityUpgrade_[name] for the name and cityUpgrade_desc_[name] for the detailed description in tooltips.

Finally, we need pictures of this place! So fire up GIMP or some other graphics program and create an image like this:

So this is a 64x64px PNG with the two pictures we previously referenced in workhouse.json. Note how the simple image is white-on-transparent, so that it can be colored by the game.

And that's it! You can now start up the game, and the mod should be listed in the mods list, and you can build workhouses in-game.

If you're on Steam, you can publish it directly from the mods list, or you can also zip up the folder and share it on NexusMods.

To build on this, make a mod that adds some different kind of city upgrade. Look at data/CityUpgrade/upgrades.json in the install folder to see what kind of parameters are available, and experiment with them.

You can also consult the rest of the in-depth modding guide. And if you need assistance, you can ask in the Discord.