Modding Tutorial: How to decompile Founders' Fortune

The Founders’ Fortune license allows decompiling the Founders’ Fortune source code for the purpose of creating mods and for education. This is how you do it.

1. Download and execute dnSpy

Other programs will work just as well, but dnSpy is a good starting point.

2. Open the Founders’ Fortune code

Using the open dialog in dnSpy, navigate to your Founders’ Fortune install directory, go to Founders Fortune_Data\Managed\ and open Assembly-CSharp.dll

You should now be able to see and search through all of Founders’ Fortune’s code.

3. Get to know the code

This is a short description of the most important parts of the code. Tell me if you notice that parts of it are out of date. Most things written like this are class name you can search for in dnSpy.

  • WorldScripts gives you access to lots of managing classes handling all kinds of things in the world. For example WorldScripts.Instance.weatherManager
  • HumanAI is the base class for all humanoid creatures. HumanManager handles instances of HumanAI and Faction
  • HumanAI contains a lot of informative properties, like HumanAI.health or HumanAI.wishManager
  • Simlar to WorldScripts, CanvasHandler gives you access to all kinds of UI stuff via CanvasHandler.Instance
  • AI behavior is defined in YieldMicroInteraction, though it might be difficult to modify.
  • The most important interactable objects in the world are HumanAI, Furniture, Floor, Wall
  • Everything people can interact with has an Interactable object, which has a reference back to the object. For example, there is HumanInteractable.
  • Most static things in the world are Furniture objects even if they’re not made by humans. For example, trees, crystal, ships, etc. This is a poor naming choice that’s now just part of the code :smiley:
  • Furniture objects contain Module subclasses that help define the behavior of the object. For example, a workbench contains a ProductionModule. See furniture.json for the definitions which furniture contains which modules.

Make sure you also use the in-game object inspector to traverse the data structures live while playing the game!

4. Ask away!

There is no documentation that will tell you all the things that could be relevant to making your mod. So, after investigating yourself, feel free to ask other community members and us devs for help on how to solve your problem :slight_smile:

1 Like