DLL Modding Guide, Lesson 1 - Setting Things Up

Next Lesson - Reading the Game's Code

Table of Contents

DLL modding Shadows of Forbidden Gods means using the same coding language the game is written in, and the best-supported way to do this is using Visual Studio. This mod was written using Visual Studio Community 2022 - as of November 2023, it can be found for free here. When selecting your add-ons during installation, make sure you include the .NET Desktop Add-On, so Visual Studio will have the functionality you need.

Open up Visual Studio, and click “Create a New Project”. You’ll be met with an unreasonably large number of possible project templates. Type “Class library .net framework” and select the marked option. Make absolutely sure you’re using the correct template, or the game won’t be able to read it properly.

Click “Next”, pick a location where you can find it easily, set your project name to something descriptive (we’ll be using **ShadowsThanosSnap**), then click “Create”.

You should now have yourself a C# project – the only problem is that, right now, the project has no idea what Shadows of Forbidden Gods is or how to interact with it. To fix that, we’ll need to add some new references to the project.

Take a look at the Solution Explorer on the right side of your project, right-click References, then select Add Reference.

This should open up the Reference Manager. If you’ve just set up Visual Studio, we won’t have any recent references yet, so we’ll need to press Browse and find some.

We need two files in particular: Assembly-CSharp.dll (for SoFG stuff) and UnityEngine.CoreModule.dll. You can find these in Shadows of Forbidden Gods/ShadowsOfForbiddenGods\_Data/Managed. Select them to add them to the recent references list, then check the box on their left to add them to the project.

Next step is to create our mod folder. Your local mods are stored in Shadows of Forbidden Gods/data/optionalData, and we’ll be creating an empty folder directly in optionalData – for the purposes of this mod, we’ll call it ThanosSnap.

We’ll eventually be pasting our art assets and code in there, but first we need to create a .json file to give the game some basic data about our mod. If you go back to optionalData, you’ll see that there are a couple mods already populated there – for our learning convenience, the base game Cordyceps Hive Mind is bundled as a mod so we can study how it’s set up. Open it up, copy mod\_desc.json, and paste it into ThanosSnap. If you don’t have a program that can comfortably handle .json files, you can download Notepad++ for free here. It’s very clean and lightweight, and will do just fine for our purposes.

If you open up the mod\_desc.json now in ThanosSnap, you should see something like this:

You can’t safely add or remove anything from this .json, so we’re just going to replace the text in quotes with our own text to better reflect our mod.

“displayedName”: The mod’s name, as displayed in the in-game mod list. We’ll be going with **Thanos Snap**.

“prefix”: This will be used later to identify images and events as being from this mod instead of some other mod. Under normal circumstances, you would come up with something that it’s very unlikely any other modder would use, but to keep things simple for this one we’ll go with **thanos**.

“description”: The mod’s description, as displayed in the in-game mod list. Keep it relatively concise, as the mod description window is quite small.  For us, that’ll be **Adds a new power to every god allowing them to wipe out half the named characters**.

“versionsSupported”: A list of every game version that can load up this mod without giving the player an “are you sure” pop-up. Some modders like to add a bunch of versions that haven’t been released yet so they don’t have to update their mods every time a random update gets published, but we’ll leave it as is for now. If you're reading this after new versions of SoFG have been announced, you may need to change the versions numbers from what's been listed below.

“modCredit”: Put whatever you want to be recognized as here, though I’m pretty sure nobody will see it unless they open up the .json itself.

When all’s said and done, mod\_desc.json should look something like this:

```
{

 "displayedName": "Thanos Snap",

 "prefix": "thanos",

 "description": "Adds a new power to every god allowing them to wipe out half the named characters",

 "versionsSupported":["0.11","0.12","0.13","0.14","1.0","1.1"],

 "modCredit": "The Unofficial SoFG Wiki"

}

```

This concludes Lesson 1. With this, your modding tools are all polished and ready to go. In the next lesson, we’ll learn to work our way around SoFG’s code base.

Next Lesson - Reading the Game's Code

Table of Contents