Modding Biomes...


I have, more or less, started working on implementing biome modability for the next version. Though I went on a long tangent at the beginning of the weekend that culminated on the release of hotfix 0.3.2.2, which includes a new experimental UI feature described in the previous post.

The first step in implementing modding is choosing a language on which to parse mod files. In this case I decided to go with JSON. The reason being that it is a very readable and easy-to-parse data exchange format, and there are already a good amount of parsing modules (internal and third party) which I can use. The drawback to using JSON is that it is not a programming language (which might be a good thing, depending on your POV) and it doesn't support comments. So it won't be possible to add usage guidance within the script itself. I'll probably end up adding a readme file for every mod file added.

I went ahead and wrote a prototype biome definition object as part of an array in JSON:

    {
      "id": "ice_cap",
      "name": "ice cap",
      "color": "FDF4EB",
      "minAltitude": "min_biome_altitude",
      "maxAltitude": 0,
      "minRainfall": "min_biome_rainfall",
      "maxRainfall": "max_biome_rainfall",
      "minTemperature": "min_biome_temperature",
      "maxTemperature": -15,
      "survivability": 0.0,
      "foragingCapacity": 0.0001,
      "accessibility": 0.5,
    },

The 'id' property is unique for each biome and helps identify it within the simulation. The 'name' property is how the biome name will be presented in the UI text elements. The 'color' property (in HTML hex format) will set the base color to assign to terrain cells where this biome is present. The min/max properties define the value ranges for altitude/rainfall/temperature within a cell that can support the biome. And the 'survivability', 'foraging capacity', and 'accessibility' properties define the base adaptation values for human groups that live/interact with said biome. 'survivability' representing how harsh is the environment, 'foraging capacity' how many resources can be extracted, and 'accessibility' how easy can the environment be traversed or to build on.

I'm still working out the details on how I'm actually going to load the script into the game and testing the limitations of Unity3D's JSON module but I hope I can get it all working during the next weekend. Nevertheless I don't think I will be done with biome modding that soon, there are many in-code dependencies on the current hardcoded biomes which will need to be moved to this script, a separate script, or removed altogether. Time will tell how much work will actually be needed. In any case, I'll probably talk about what extra changes need to be done by then.

Get Worlds - History Simulator

Leave a comment

Log in with itch.io to leave a comment.