Modding Discoveries...


This weekend I have been mostly spending time thinking and writing event modding design documents. I still managed to write quite a bit of code but nothing I can brag about yet.

The main thing is that I decided to limit the scope of what I going to do with events for 0.3.3. Since events are the main driving block for the simulation (mostly everything within is handled through events), the event engine is quite extensive and complicated, and adding modability to any part of it is going to take a lot of effort. With that in mind I decided to focus the current sub-goal on modding 'discovery' events exclusively. 

Now, one design problem I encountered right away is that there's no way to mod discovery events without modding discoveries themselves. So, instead of providing a framework to mod events separately from discoveries, what 0.3.3 will provide is a framework to mod discoveries exclusively, and generate the associated discovery events from these.

With that in mind, let me share what would a discovery mod would look like:

{
  "discoveries": [
    {
      "id": "boat_making", 
      "name": "boat making", 
      "gainConditions": "'[NOT]group_has_knowledge:this,shipbuilding_knowledge','cell_is_sea:neighbor'", 
      "holdConditions": "'group_has_knowledge:this,shipbuilding_knowledge'", 
      "gainEffects": "'group_gains_knowledge:this,shipbuilding_knowledge'", 
      "eventTimeToTrigger": 250000, 
      "eventTimeToTriggerFactors": "'neighborhood_sea_presence'"
    }
  ]
}

It looks rather short and simple, and that's the idea (In contrast, the original discovery/event code for 'boat making' amounted in total to 120 lines in C#). Now, the interesting part will be to successfully parse the above script with all its implied nuances. For example, The parser needs to  turn '[NOT]group_has_knowledge:this,shipbuilding_knowledge' into an actual condition that makes sure a the selected group doesn't possess the shipbuilding knowledge already; And  'cell_is_sea:neighbor' should be turned by the parser into a condition that checks that at least one of the terrain cells adjacent to the group has a 'sea' type biome.

So that's pretty much where I'm at right now, 'flexing' my weak regular expression writing muscles. The following weekends are possibly going to be fraught with complications and setbacks. Still, I have hope I will be able to get done with discovery modding by the start of July.

Get Worlds - History Simulator

Leave a comment

Log in with itch.io to leave a comment.