Modding Tutorial: Adding new resources

This tutorial covers how to add new resources to the game.
Make sure to go through “Making your first example mod” Modding Tutorial and “Changing existing parameters” Modding Tutorial, so you can understand this tutorial easier.

To add new resources, we need to modify resource.json, which contains definitions for all resources in the game. To better understand the structure of this configuration file, you can check out FFModKit.

Example Walkthrough on how to add a new Fish resource

1. Folder setup

Go to the mods folder at C:\Users\YOUR_USER_NAME\AppDataLocalLow\Oachkatzlschowaf Interactive\Founders Fortune\mods and create a folder for your mod. Let’s call it “Fish Mod”.

2. config.json file

In this folder, create a file called config.json. Open the file using any text editor and paste the following:

{
	"name": "Fish Resource",
	"version": "1.0",
	"author": "RunTime_Terror",
	"website": "https://dionicsoftware.com/",
	"description": "Fish as an edible resource",
	"compatibleVersions": [
		"Release 1.2.4"
	],
}

These infos are used by the game and by Steam to display your mod properly.

3. Configuring your resource.json file

In order to use any new object in the game, you need to tell Founders’ Fortune about it. This is done by writing json files. In this example, we create a configuration file for a fish resource. Put a file called resource.json in your mod folder.

Let’s add two new resources, a “Raw Fish” and a “Grilled Fish”:

{
	"RawFish": {
		"defaultPrice": 6,
		"buyProbability": 1,
		"sellProbability": 1,
		"typicalTradeAmount": 200,
		"isAlwaysAvailable": true
	},
	"GrilledFish": {
		"defaultPrice": 60,
		"buyProbability": 1,
		"sellProbability": 1,
		"typicalTradeAmount": 100,
		"isAlwaysAvailable": false
	}
}

For more examples, check the game’s resource.json configuration file. We uploaded it to FFModKit

4. Checking which aggregated resources need changing

We need to add these new fish resources to some aggregated resources (e.g. FoodEdible, FoodCooked…) so colonists can eat fish. In this example, we only want to add these two new resources, so we need to check the child resources of these aggregated resources from the game’s resource.json.
We put some of the aggregated resources that need to change for this example here for your convenience:

"FoodRaw": {
        "defaultStockpile": 120,
        "childResources": ["Apple", "Tomato", "Pumpkin", "Potato", "Strawberry", "Wheat", "RawMeat", "Milk"],
 },
    "FoodCooked": {
        "defaultStockpile": 20,
        "childResources": ["BakedApple", "BakedPotato", "BakedTomato", "GrilledMeat", "PumpkinStew", "MeatAndPotatoes", 
            "FruitSalad", "Cheese", "Bread", "StrawberryCake", "AppleStrudel"],
 },
"FoodEdible": {
        "childResources": ["Apple", "Tomato", "Pumpkin", "Potato", "Strawberry", "BakedApple", "BakedPotato", "BakedTomato", 
            "GrilledMeat", "PumpkinStew", "MeatAndPotatoes", "FruitSalad", "Cheese", "Bread", "StrawberryCake", "AppleStrudel"],
 },
"SimpleMeal": {
        "childResources": ["BakedApple", "BakedPotato", "BakedTomato", "GrilledMeat"],
},

5. Configuring patch.json file

Now that we know which aggregated resources we need to change, let’s add “RawFish” and “GrilledFish” to them via patch.json:

{ 
	"replaceOperations": {
		"resource/FoodRaw/childResources": ["Apple", "Tomato", "Pumpkin", "Potato", "Strawberry", "Wheat", "RawMeat", "Milk", "RawFish"],
		"resource/FoodCooked/childResources": ["BakedApple", "BakedPotato", "BakedTomato", "GrilledMeat", "PumpkinStew", "MeatAndPotatoes",
			"FruitSalad", "Cheese", "Bread", "StrawberryCake", "AppleStrudel", "GrilledFish"],
		"resource/SimpleMeal/childResources": ["BakedApple", "BakedPotato", "BakedTomato", "GrilledMeat", "GrilledFish"],
		"resource/FoodMeat/childResources": ["RawMeat", "GrilledMeat", "MeatAndPotatoes", "RawFish", "GrilledFish"],
		"resource/FoodEdible/childResources": ["Apple", "Tomato", "Pumpkin", "Potato", "Strawberry", "BakedApple", "BakedPotato", "BakedTomato",
			"GrilledMeat", "PumpkinStew", "MeatAndPotatoes", "FruitSalad", "Cheese", "Bread", "StrawberryCake", "AppleStrudel", "GrilledFish"]
	},
	"removeOperations": [
		
	]
}

6. Adding localization.json file

Add a localization.json file to your folder. Let’s do some translation:

{
	"resourceName_RawFish": {
		"english": "Raw Fish",
		"german": "Roher Fisch"
	},
	"resourceName_GrilledFish": {
		"english": "Grilled Fish",
		"german": "Gegrillter Fisch"
	}
}

You can also check localization.json in the Example Mod to find out how to add the necessary text for your object. If you want, you can even support different languages :smiley:

7. Done!

Start the game and check the “Mods and Extra Content” point in the main menu. You should be able to see your mod and have it active to play.
Start a game and see if it all works!

image

Additional notes about modding resources

We added a new resource category called “Misc”:
image

This “Misc” category doesn’t need any storage, so you can add any resource you can imagine, like “BEANs” or, heck, even a “Chaos Emerald”.
Happy modding!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.