Getting Setup for Modding - Monster-Train-2-Modding-Group/Trainworks-Reloaded GitHub Wiki
Whether you want to work locally in Visual Studio or use GitHub Codespaces in the cloud, this guide walks you through setup, testing, and releasing your first mod.
💡 Recommendation:
If you’re new to programming or don’t have Visual Studio and Python installed, use GitHub Codespaces.
It includes everything you need and requires no local setup.
- A GitHub account (required for NuGet package access and automated builds / releasing)
- Basic familiarity with Git/GitHub (optional but helpful)
Important
Without a GitHub account, you’ll need to manually set up a Visual Studio project along with all of the dependencies — that’s outside the scope of this guide.
- Go to GitHub and log in or sign up.
- Click the + icon in the top-right → New repository.
- Choose a name (e.g.
MyModProject). - Set Visibility to Public (this is required).
- Check “Initialize with a README” (Important if you are planning on using a GitHub Codespace).
- Click Create repository.
- Go to Thunderstore.io.
- Sign up and log in.
- Navigate to Settings → Teams → Create Team.
- Create your namespace and save the name — you’ll need it later.
We’ll use this token to authenticate with GitHub Packages.
- On GitHub, go to
Profile → Settings → Developer Settings → Personal Access Tokens → Tokens (classic) - Click Generate new token (classic) with the following permissions:
- ✅
read:packages - ✅
public_repo
- ✅
- Copy and store your token securely — you’ll need it in the next step.
For GitHub Codespaces
-
Go to your repo’s Settings → Secrets and Variables → Codespaces → New repository secret
Add:
-
GH_AUTH_TOKEN→ your Personal Access Token
-
-
Go to your repo’s Settings → Secrets and Variables → Actions → New repository secret
Add:
-
GH_AUTH_TOKEN→ your Personal Access Token
-
For Local Visual Studio Users
-
Go to your repo’s Settings → Secrets and Variables → Actions → New repository secret
Add:
GH_AUTH_TOKEN→ your Personal Access Token
To get Pull Requests from Dependabot in case any of the dependencies change:
- Go to Settings → Secrets and Variables → Dependabot → New repository secret
- Add:
-
DEPENDABOT_GITHUB_USERNAME→ your GitHub username -
DEPENDABOT_GITHUB_TOKEN→ your Personal Access Token
-
Option 1: GitHub Codespaces
-
On your repository page, click Code → Open with Codespaces → New Codespace
-
Wait for setup to finish (it may take a minute).
If you added or changed Codespace secrets after creating the Codespace, rebuild the container (see Step 8).
Option 2: Local Visual Studio
-
Clone your repository:
git clone https://github.com/<YourUsername>/<YourRepo>.git -
Open a terminal in the directory where you cloned your repository.
Cookiecutter is a program that generates your mod’s project structure from our template.
-
In Codespaces:
pip install cookiecutter -
Locally (requires a Python installation):
Run the same command in your terminal.
Run this in your terminal:
cookiecutter https://github.com/Monster-Train-2-Modding-Group/Mod-Template.gitcookiecutter will prompt for the following things:
- project_name. Enter your mod's name. This can't be edited easily later.
- description. Enter the short description of your mod. Used as the description of your mod on thunderstore and populates the README.md
- author. Your name.
- mod_namespace. Important this is your mod namespace from Thunderstore from Step 2.
- generate_minimal_clan. Leave this on the default (1). We are getting introduced to modding. Later when you actually want to make a clan mod you can set this to (2) to get a full clan example.
- enable_harmony_patching. Also leave this on the default (1). This just adds code to enable Harmony patches, which we will cover much, much later.
After cookiecutter finishes, you’ll see a new folder created with the same name as your project_name. Now move the contents of that folder up one level with the following command
Important
Replace <YourProjectName> in the command below with the actual folder name that was created.
mv <YourProjectName>/{*,.*} . 2>/dev/nullExample: If you named your project CoolMod, run:
mv CoolMod/{*,.*} . 2>/dev/nullIf you’re unsure what the folder is called, check with:
ls
The output should be the folder name and a README.md file. The folder name is the one whose contents you are moving.
After successfully moving the folder's contents in the bottom left hand corner should be a popup with the text
We've noticed a change to the dev container configuration. Rebuild the container to apply them now.
You can press the green Rebuild Now button. And then press Full Rebuild
Otherwise here are the steps to do this manually
-
Open the Command Palette:
-
Windows/Linux:
Ctrl+Shift+P -
macOS:
Cmd+Shift+P -
(In Firefox, use
F1instead)
-
-
Search for “Rebuild Container” and run it.
Your Codespace will rebuild with updated secrets and dependencies
Visual Studio (Local)
-
Open the
.slnfile. -
When prompted, log in with:
-
Username: your GitHub username
-
Password: your Personal Access Token
-
-
Build the solution.
Output files will appear in thebin/Debug/netstandard2.1/folder.
Codespaces
Run the following command:
dotnet build -c Release --output ./distIf successful, you will see a new dist/ folder containing your compiled mod.
If the command fails run the command
dotnet nuget update source --username $GITHUB_USER --password $GH_AUTH_TOKEN monster-train-packages --store-password-in-clear-textThen attempt to build again. If it fails again please report the build failure to #mt2-modding on discord or file a GitHub issue.
Continue onto Testing Your Mod