Getting Started
Welcome to the SoR mod-making guide featuring RogueLibs! Library and tools provided by RogueLibs really simplify the modding process, but you'll still need some basic C# knowledge to get started. If you have any questions, feel free to ask them in the official Discord's #🔧|modding channel.
Required software
First of all, you'll need to install these tools:
- dnSpy - a .NET assembly editor (and a debugger, but it's way too tedious to make it work for BepInEx and plugins). You're not gonna edit assemblies, just view them to see how the game and/or other plugins work.
- Visual Studio 2022 Community - the Integrated Development Environment (IDE for short) that you'll be working in.
New Way of Modding
Instead of creating a project manually, we'll be using a special template with a ton of advantages!
- The template is SDK-style, which means that:
- You'll be able to use most of the features of the latest C# versions!
- Less messing around with the settings and configurations!
- No DLL Hell. All of the references are in a single designated folder!
- PluginBuildEvents utility will move your mods to BepInEx/plugins automatically!
- The template contains the base code to quickly start developing your mod!
- Most of the stuff you could possibly need is already in the template!
You can just copy-paste the template, and start working on your mod in less than a minute!
Workspace Structure
First of all, download the workspace template and extract the sor-repos
folder.
You should put your repositories close to the root of the drive, so that they have much shorter and more manageable paths, like D:\sor-repos
, F:\rim-repos
(for Rimworld mods), E:\uni-repos
(for university stuff) and etc. This way you'll always know the exact path to your projects, and all errors and warnings regarding the files will be much shorter and will contain less unnecessary information.
Now let's see what this workspace has to offer!
.ref
- References
.ref
directory will contain all of the references for your mods. There are two kinds of them:
Static references (that is, the ones that aren't updated frequently and mostly remain the same) are stored in the static
subdirectory. Most of the stuff that you can find in the /StreetsOfRogue_Data/Managed
directory goes here.
Dynamic references (the ones that change often) are Assembly-CSharp.dll
(that contains the game code) and RogueLibsCore.dll
(RogueLibs library). They are stored in the .ref
directory itself, so you can update them more easily.
Some references have documentation as a separate file, like RogueLibsCore.xml
. Make sure that you place it next to the .dll in the same folder. If you do, you'll be able to look up documentation on types and members right in Visual Studio!
.events
- PluginBuildEvents
PluginBuildEvents is a simple utility for copying your mods over to the BepInEx/plugins directory. The default project template includes it as a post-build event, so you just need to build your mod, and its file will be automatically moved!
If you haven't purchased the Steam version of the game (or if you somehow messed up the Steam's installation path in the registry), then specify the full path to the game's root directory in the properties of your project (right-click on it in the Solution Explorer and select Properties > Build > Events):
"$(SolutionDir)\..\.events\PluginBuildEvents.exe" "$(TargetPath)" "D:\Games\Streets of Rogue"
Solution Folders
All other folders should contain solutions with your projects:
To create a new one, just copy-paste the template one. You can also modify the template to fit your specific needs.