Modding Tutorial: Changing existing parameters

This short tutorial goes into depth on how to easily change the configurations in the games .json files, as done in the “Making your first example mod” Tutorial. Go through that tutorial first.

At the time of writing, the following internal configuration files can be changed by using patches:

  • furniture.json contains definitions for most free standing inanimate objects in the world
  • resource.json contains definitions for all resources in the game
  • construction.json contains definitions for floors, walls, fortifications, and fences
  • equipment.json contains definitions for tools, weapons, clothes and armor
  • animals.json contains definitions for all animals in the game
  • research.json contains all technology and research in game
  • profession.json contains all skills for professions in the game
  • localization.json contains all the texts in the game
  • gameConfig.json all kinds of parameters that control gameplay, balancing, and more

For creating patches, it’s important to know the structure of these .json files. That’s why you can find the ones used in the game in the FFModKit. Let me know if you think they are too out of date and you need an update to make your mod. You can find the localization json files in the community translation GitHub.

FFModKit contains some example patches in the example Mod pasted here for your convenienve:

{
	"replaceOperations": {
		"furniture/crystal/constructable": true,
		"furniture/crystal/modules/resource/resourcesPerRound": 20,
		"construction/floors/woodFloor/costResources": ["wood", "crystal"],
		"construction/floors/woodFloor/costCounts": ["8", "1"],
		"localization/health/english": "Sheer Power of Will",
		"config/daysChildMin": 12,
	},
	"removeOperations": [
		"furniture/crystal/needsUpdate",
		"furniture/crystal/modules/resource/workSeconds"

		// You can even remove objects from the base game.
		// Might cause error messages on the console, depending on the object and its usage in the game.
		//"furniture/crystal",
		//"furniture/appleBasket",
	],
}

Find the up-to-date file here.

The patch file modifies the json files of the base game or the json files of any mods before giving them to the game to process. It was designed to be as self-explantory as possible:

  • replaceOperations replaces values with whatever you put on the right side of the statement
  • removeOperations remove complete elements. Often, this means that the game’s default values are used instead, for example if you delete furniture/crystal/modules/resource/resourcesPerRound, the game will just use a default value.
  • However, if you delete complete objects, like furniture/crystal or equipment/swordWood, they will not be accessible in the game. This can lead to bugs though.
  • The first word of any path is always the file that’s being modified. The rest of the path navigates through the json structure.
  • You don’t need to replace single values, feel free to replace full objects.

image

2 Likes

Some more details for furniture.json

  • when needsUpdate is true, the “Update” function of the Module will be called regularly. What this means is that the furniture will be able to do stuff on its own. For example, crystals will turn their lights on, soil will grow its plants, and enemy houses will spawn enemies. Most objects don’t need these updates, but if you’re unsure, you can leave it on. There will be a performance impact if too many objects have needsUpdate turned on unnecessarily.

I will update this list as more questions arise.