Introducing: Modding Refactor

Hello everyone!

Barotrauma development is rolling along, and it’s time to lift the veil on something that we have been working on for an extended time, behind the scenes and under the hood: a complete overhaul of the codebase for modding.

That may sound alarming – what about all that player-made content already on the Steam Workshop? The modding refactor should not affect most existing mods adversely. More importantly, it will make it a lot neater and more intuitive for you to use mods and for us to update the game without breaking them too often.

Modding refactor – why?

As we are soon three years into Early Access, it may seem that this is coming very late. Shouldn’t we have taken care of it in 2019? Well, in 2019, we rewrote just about the entire networking code and made other big changes that, in hindsight, we would ideally have done even before releasing on Steam. It was then that we also got our first real, post-release player feedback, and the need for changes in the modding code gradually became evident.

So, not too long after that, one of our programmers started planning a modding overhaul that has been quietly churning in the background ever since. It’s been slow going because there are substantial changes, and it’s all been done while we’ve also been advancing our content update plan for the game. This year, we’ve finally got the modding refactor to a place where the whole team has been able to start testing it internally.

A couple of weeks ago, we released the modding refactor to the Unstable test version, so you can now test it, too! Without further ado, let’s take a look at the big changes, from the player’s and modder’s perspective.

Modding refactor – what?

Managing mod settings

Previously, mod settings have been in several places user interface-wise. Now they will all be in one place – we’re adding a new Modding tab under the Settings menu, and everything to do with modding will be found there.

With regard to managing your mod settings, there are two big changes: instead of a tickbox next to each mod to enable or disable them, the list of mods is split into two, one for the enabled mods and another for the disabled ones. The game will now also ask you to manually update mods instead of automatically installing updates.

This should help you see more easily what you have enabled and manage mod load order all in the same place. Importantly, these changes also prevent our future updates from scrambling your mod load order like they have so far.

New mod settings view for Barotrauma

Downloading mods from the server

Another improvement for using mods is being able to download any kind of mods directly from the server you’re playing on, just like custom subs. This should make it more appealing to play with mods in multiplayer even without a well-established crew, when everyone on the server can access the needed mods instantly rather than look for them on the Workshop separately.

Barotrauma downloading mods from server

Streamlining the Publish tab

Under the new Modding tab is the familiar Publish tab for publishing your work on the Steam Workshop. We’ve made an additional, important change here: you will no longer be required (or, indeed, able) to define content types in this menu. Having to do that here was more hindrance than help, so in the future, defining content types will be done in .xml instead.

New Publish tab for Barotrauma mods

Creating and updating custom subs (and other mods)

Remember all those times your progress was accidentally overwritten when you were trying to update your sub on the Workshop? We’ve revised the mod folder structure to prevent this from happening.

In a nutshell, there will be two folders for all mods, going forward: Local mods will contain all mods you have made; Workshop mods will have all mods published to or downloaded from the Workshop. This way, changes you have made locally will not get accidentally overwritten by Workshop content, as rather than moved, your files will be copied to the appropriate folder.

New Barotrauma mod folder structure

Referencing content in a mod

To those modders who make something other than custom subs, a more technical note: Following the modding refactor, referencing content in a mod will require the %ModDir% prefix rather than a direct reference to its location relative to the game’s executable (i.e. no longer does Mods/MyMod/ work).

The game will automatically convert old mods that used the previous referencing mechanism to use the prefix instead, so you should not need to make changes to conform to the new requirements. We will cover this change in more detail in the upcoming new modding guide.

Barotrauma modding: referencing content

Character mods

Lastly, the modding refactor is going to be of interest for human character mods, because character gender will no longer be hardcoded. (Previously, gender and race were hardcoded and handled specially in numerous locations in the code. This made things inflexible and error-prone and imposed unnecessary restrictions on modding.)

With the modding refactor, hardcoded genders will be superseded by an arbitrary tagging system. The previous way of implementing gender is deprecated but still supported, so existing character mods should not break, and you should not need to update yours. We will write more about character mods in our upcoming modding guide, so you can find out how to make the most of the new tagging system in your future mods.

Barotrauma character modding improvements

New modding guide

Besides all the ways the modding refactor will hopefully improve modding, it also makes our work easier for a number of reasons. One of those is that the new codebase is now structured so we can produce documentation much more easily.

As such, we’re working on a more extensive modding guide than those we’ve had before, and instead of a Steam guide, we’re thinking about publishing it on GitHub. The big advantage there is that you can submit suggestions for additions and changes to the guide as pull requests. We realize many of you will have much to say on the finer points of modding, and we will be happy to incorporate your advice directly into the guide.

The guide is planned for release along with the modding refactor itself. Initially, it may not be very broad, but it should cover everything relevant to the present changes, in more detail than we could achieve in this blog. Later, we hope to merge all our other modding guides into it, too, so you can find all the official modding documentation in one place.

Modding refactor – when?

All of these modding changes are going to be included in the next content update, planned for release in the latter half of April. They’re already available for testing in the Unstable test version for anyone who’d like an early look.

More news about the upcoming update coming in a couple of weeks; for now, thank you for being brave and modding an early access game! We hope modding will require a little less bravery after these changes.

Barotrauma Stema Workshop screenshot with number of items
Number of items on our Steam Workshop as of the day before publishing this post. That’s a lot of mods!


  • March 19, 2022

    Please add the mod list to save the preset function.
    like `Rimworld mod manager` , `stellaris` , `arma3`

Post a Comment