Modding Tools - brandonandzeus/Trainworks2 GitHub Wiki

Modding Tools

The following are commonly used when modding, and it is recommended that you download them.

1. Any C# decompiler

We use a decompiler to browse the code for Monster Train, finding out how the game works at a deeper level, and determining existing functions that need to be patched. It is an essential tool for any modder.

Here are some options on a C# decompiler

Start up the decompiler. Navigate to the MonsterTrain_Data/Managed folder and open up Assembly-CSharp.dll in it. This is the dll that contains all the code for the game. Later we'll talk about patching methods with Harmony; for now, just know that this is how you figure out which methods to patch.

If you spend some time looking around, you'll notice that the cards are nowhere to be found. There's no Frozen Lance in the code. That's because cards don't have their own classes; they're loaded from Unity assets. In order to view them, we'll need another program:

2. A Unity asset explorer

The unity asset explorer is essential for dumping data from the game. All of the game data can be found in an asset explorer.

There's really only one good option for this right now, and it's AssetStudio

Using it's a bit unintuitive. Follow these instructions exactly.

  1. Open AssetStudio
  2. File -> Open Folder
  3. Select the MonsterTrain_Data folder and open it; it'll take a minute to load
  4. Switch to the Asset List tab at the top
  5. Search for a card. For example, Frozen Lance is called StarterIceSpear. Click it.
  6. Another folder chooser will pop up with absolutely no explanation. Choose the Managed folder. If you don't, you'll have to close the whole program and go back to step 1.
  7. You should now see all of Frozen Lance's data on the right side. If you only see a small stub, it's because you didn't choose the Managed folder.

3. Runtime Unity Editor

The Runtime Unity Editor by ManlyMarco

This is a BepInEx plugin. Install it as you would any other mod. Then, while in game, hit F12, and you should see a big, scary Unity GUI. This shows all the objects in the current scene. It's very convenient for both exploration and debugging.

Next: Using Harmony