Development Continues…

The last few weeks I’ve been devoting my time to working on adding mod support to the game. It’s been nice to stretch my coding legs by doing something other than bug fixing.

When initially writing the game engine for Banished, allowing users to modify the game wasn’t something I thought about. It just wasn’t in scope – I was more interested in finishing the project in a reasonable amount of time. Hence mods, multiplayer, and a few other features that could have been great additions were off the feature list before it was even written.

Luckily, the toolset I wrote for the game to help speed development is suited fairly well for mods – it just needs a few more features.

There’s a single tool that compiles all resources into the binary format that Banished uses. There’s a version of the game that has extra debugging features in it, and it can compile resources as the game loads, and additionally it detects resources file changes at runtime, so textures, models, and other resources can be reloaded without shutting down the game (most of the time). The tool also can pack all the resources into a single package for easy distribution.

That sounds good so far.

What’s missing is the ability to have multiple people make additions to the game without having to patch each others raw data to combine them. I think it will be typical that many users will use more than one mod at a time – such as a translation mod, a mod that adds some pretty objects, like trees, shrubs, statues, and fences, and other mods that add buildings and professions to the game.

So what I’ve been mostly working on is support for multiple mods at once. The game can now load multiple packed data files, and new resources can be overridden or added. Mods can be loaded and unloaded at anytime, so if you’ve started a game without mods and want to load one, it’s possible (although slightly dangerous if the mod drastically changes things…)

I’ve still got some details to attend to before mod support is complete. The major one is that I built all the game data thinking that if it was expanded, it would be by me. So there are a few static lists in the data, such as professions, inventory, and the toolbar that need to become dynamic. If two different mods change the toolbar and profession list to add new placable objects, then there’s a conflict – since both mods modify the same resources. Only one will take effect.

The mod interface lets you know when this happens (all the red in the image above), but once I finish, this problem should be minimal if mods are built properly. But clearly you can’t load two translations or two UI changes at the same time without conflicts.

Save games also need to record which mods are in use, and reload them – this way you can have multiple save games using different mods if you’re wanting to try out different mods while playing different towns.

I’ve also got to decide what to do about achievements. Some mods, like translations shouldn’t change the difficulty in getting achievements, but other mods can allow placing buildings for free and adding resources and citizens with the press of a button. That clearly nullifies the achievement process.

There’s also Steam workshop support, but the mods will be the same regardless of where they come from. They’re just dumped in the data directory and the game will find them.

The mod kit will ship with most of the original game data, to show how things are put together, and to allow game rebalances or full texture and model changes. I guess I also need to make some example mods and write some basic documentation.

Lots to think about… so I’m going to get back to it!