Creating a mod
- Requirements
- Creating a mod template
- Attempt to build and run
- The assets folder
- Scripts
- Mod metadata
- Sharing with others
- Troubleshooting
Requirements
- Visual Studio 2022
- If you don't want to install Visual Studio, dotnet by itself is sufficient (comes with the SDK)
- .NET 8.0 SDK
- Madness Interactive Reloaded
Creating a mod template
Your mod starts with a generated mod template. Mod templates provide scaffolding, allowing you to immediately start programming/drawing your ideas. Open the mod template generator.
You should see these inputs. Your thumbnail is optional, and you can always set it later. Mod name is the name visible to players. Author should be your own name. Mod ID should be similar to your mod name, but as short as possible to make things easier for yourself later. The default values are valid.
Press the download button and save the zip file in your game's mods
folder. If there isn't one, create it. Unzip the archive to its own folder, such that the structure looks similar to this:
- 📁 MIR root directory
- 📁
mods/
- 📁
Your.Mod/
meta.json
Your.Mod.csproj
- etc.
- 📁
- 📁
It is now safe to delete the original zip archive.
Attempt to build and run
Open the .csproj
file using Visual Studio 2022.
It should look something like this. To make sure everything is set up correctly, press F5 to start debugging. This should open Madness Interactive Reloaded and your mod should be visible in the mod menu. If this does not happen, refer to the Troubleshooting section. You should build your mod whenever you change anything. Building is done whenever you start debugging or manually by pressing Ctrl + B, or via the Build menu at the top of the window (Build -> Build Project).
The assets folder
You may have noticed an assets/
folder in your mod. It should be full of more empty folders. This folder structure is a "shadow" of the base game asset folder. This means it contains no actual content, just the scaffolding. When you build the project, the assets folder is "packaged" into an asset package (assets.waa
). This package will appear in your mod folder when you first build.
Most asset types can be created in a text editor like Visual Studio or a bitmap editor like Paint.NET. For more information on how specific assets work, refer to the Assets section. An important mechanic to remember is that, in general, the game will consider the last loaded asset package to be the deciding package. If you add an asset to your asset folder at the same address of an existing base asset, you are effectively replacing the original asset.
For example, if you create a file at assets/textures/main_menu_background.qoi
, it'll be displayed as the main menu background because it also exists in the game's base folder. This "override" mechanic is useful for asset replacement mods. If you create a file that doesn't overlap a base asset, it won't replace anything and simply be added as a new asset.
Most game assets like textures, sounds, etc. have no designated location. You can put them basically anywhere. However, other assets will only be properly registered if they're put in a specific folder. These include:
- Weapons (
data/weapons/*.json
) - Campaigns (
data/campaigns/*.json
) - Levels (
data/levels/*.json
) - Cutscenes (
data/cutscenes/*.json
) - Melee sequences (
data/melee_sequences/*.seq
) - Character stats (
data/stats/*.stats
) - Character looks (
data/looks/*.look
) - Character animations (
data/animations/*.anim
) - Factions (
data/factions/*.json
) - Language tables (
locale/*.json
) - Head armour/skin (
data/armour/head_armour/*.armour
) - Body armour/skin (
data/armour/body_armour/*.armour
) - Hand armour/skin (
data/armour/glove_armour/*.hand
)
When the game launches, these locations are scanned and all valid files are registered.
Scripts
Scripts are written in C#, and your entry point is located in ModEntry.cs
. This file contains comments, so I won't get into it much. For examples, look at WIP.
Mod metadata
The mod folder contains a meta.json
file, which contains basic metadata for your mod. Most of this is already set up by the mod template generator, but you might want to add a proper description as well. The id
field contains your mod ID, which you really shouldn't change unless you absolutely know what you're doing. This ID will be important if you're ever using an in-game editor and want to reference your custom assets.
Your thumbnail file should be either PNG or QOI, square, non-transparent, and ideally somewhere around 256x256 in size. However, these are not enforced and you could technically put a 2000x9000 JPEG in there, although you might encounter issues and I recommend sticking with the guidelines.
Sharing with others
To package and share your mod, you could technically just zip up the whole folder and send it to others. However, it might be desirable to clean up a bit before you do so. Lots of files are actually safe to remove before distribution, because they are only necessary during mod development. Make a backup to continue development later, and you may safely delete:
- The
obj
folder - The
bin
folder - The
.vs
folder - Even the
assets
folder - The
.config
folder ModEntry.cs
- The
.csproj
file
These are not required for the mod to function. In fact, if your mod contains no script at all, you can even delete the .dll
file and remove the binaryPath
line from the meta.json
. This lowers the size of your mod on disk and in memory.
Troubleshooting
ERROR: The command dotnet tool restore
...
It is likely that the tool manifest has been blocked by Windows. Navigate to your mod folder and open the .config
folder. You should see a file called dotnet-tools.json
. Right click it, open Properties, and select "Unblock". Try to build again.
MIR.exe not found
Double check that your mod project is at this address: [mir game folder]/mods/Your.ModName/Your.ModName.csproj
. This is absolutely necessary.