Skip to content

Config JSON

Darkly77 edited this page Feb 25, 2023 · 9 revisions

ModLoader supports config files in the JSON format.

Custom configs can be added by users, to a folder named configs (res://configs, ie. a folder named configs in the game's root directory, where the EXE is).

They are named by the mod ID (eg. AuthorName-ModName.json).

See get_mod_config in API Methods for usage in the code.

Defaults

Mod developers can include default settings in a mod's manifest.json file, via extra.godot.config_defaults.

If a mod uses get_mod_config when no custom JSON file exists, that mod's default settings will be used instead (returned as data). This works whether you're using key or not.

{
	"extra": {
		"godot": {
			"config_defaults": {
				"foo": "bar"
			}
		}
	}
}

Special Options

A user's custom config file can use these special settings, in addition to a mod's own settings.

load_from

If specified, their config is loaded from the specified file, instead of the file named after the mod ID.

The load_from JSON file should be in the same directory, and include the file extension, eg:

{
	"load_from": "my-special-config.json"
}

This allows users to multiple config files for a single mod and switch between them quickly. This settings is ignord if the filename matches the mod ID, or is empty.

Clone this wiki locally