Successful Runs, Redesigns and Sailing


Discovery modding is progressing with just a few hiccups here and there. This week I managed to make the first crash-free simulation run using a modded discovery (boat making) and, thankfully, the simulation  behavior changed very little compared with the hard-coded version in spite of using a different discovery-making logic. One thing I noticed is that performance dropped somewhat noticeably with the modded discovery, which was expected given that the "simpler" mod logic nevertheless involves traversing more functions and keeping more objects in memory (hard-coding certainly had its advantages).  Once I'm done with discovery modding I'll probably spend a day or two evaluating performance to see if it can be improved somehow.

After doing that I decided to do a redesign of how conditions are evaluated within a mod script to extend the functionality. Previously, certain conditions, like cell_has_sea, needed a parameter identifying the evaluation target, that target could be the terrain cell where the event was to occur, the neighboring cells, or both... Instead of requiring a target parameter on specific conditions, I decided to introduce a set of operators that can be applied to any given condition to specify the target. Here's an example:

'[ANY_N_GROUP](group_has_knowledge:shipbuilding [AND] group_has_knowledge:agriculture)'

ANY_N_GROUP is an operator that checks that at least one neighboring cell group meets the condition it operates on. In this case, for the condition to be true, there must be at least one neighboring group that has knowledge of both shipbuilding AND agriculture. Aside of ANY_N_GROUP, I added ANY_N_CELL that does the same but for terrain cells, ALL_N_GROUPS and ALL_N_CELLS, which require that ALL neighbors (groups or cells respectively) meet the condition, plus other operators that include the event source group or cell as a evaluation target. 

The new operators add a lot more flexibility to the condition evaluation system aside of removing the need to add extra target-defining parameters on specific conditions. The only problem with this new system is that it could be easily misused by creating needlessly complex condition evaluation chains that would slow down the game, or conditions that end up being logically invalid and crash the game (shudders). But hopefully that won't be a frequent issue for experienced modders.

Done with all that, I started working on implementing the sailing discovery as part of the base mod to replace the hard-coded version. For this I needed to implement a new discovery effect to alter a knowledge's level asymptote (now referred simply as 'level limit' to simplify the jargon a little bit). In addition to that I have to implement a way to give cell groups a way to rediscover lost discoveries without having to re-evaluate all discoveries on every cell update. 

Next weekend I'll finish the sailing discovery implementation and try to implement the remaining two hard-coded discoveries as part of the base mod: plant cultivation and tribalism. Once I'm done with that I need to quickly test the save/load system which surely will have many issues resulting from this huge set of changes.

Get Worlds - History Simulator

Leave a comment

Log in with itch.io to leave a comment.