Activating Mods

The mod support framework is basically done. In the next version it will be possible to load multiple mod folders into the game before a new world is created through a modified generate world dialog:

The mods are loaded only when the user clicks the "Generate" button on the Generate World dialog, and only if the set of active mods for the new world is changed through the new mod selection dialog.

When loading a world, things are going to be a little different. Instead of asking which mods to use or using the current set of active mods, the game will read from the save file which mods where used to generate the world and it will attempt to load them from the Mod folder.

Finally, I finalized the mod folder structure to be used:





In this case, the 'Mods' folder contains two mods, 'Base' and 'TestMod'. Mod files of different type are separated into type-related folders; biome mod files go in the 'Biomes' folder, region attribute mod files go into the 'RegionAttributes' folder, and so on. Individual files can be named however the modder likes as long as they have the .json extension at the end. And you can have more than one mod file of each type on each folder. The game will attempt to load each of the files and replace items with identical keys if more than one file have the same item defined within them. So, for example, you can load the biomes from the 'biomes.json' file in the Base mod folder and then load the same biomes from the 'biomesPart1.json' and 'biomesPart2.json' in the TestMod folder. Depending on which order they are loaded, the duplicate biomes will replace the previously loaded ones.

All of this took me only two days to implement, which is much less than I expected. So I decided to spend the extra time trying to implement an extra feature, called 'Layers', that will be useful in conjunction with biome modding. A layer is just custom abstract data that is affixed to cells during world generation. Each layer is completely moddable and you can add, through mods, as many layers of extra data as you like to a single world. By default, layers don't interact in any way with the world. But through mods they could be used to condition or restrict biome placement for example. I will go into more detail with layers next week once I can finalize some of the messy parts of the implementation. Hopefully I can get them ready early so that I can get the work started on event modding next weekend.