A few days ago I added enviromental variables to the simulation: Enviromental gases like oxygen and CO2 can now change the rate at which microbes can run their processes, affecting how much food they need, and whether they’re able to survive at all (with any amount of food).
Vice versa, microbes are able to affect their enviroment: Photosynthesisers produce oxygen and consume CO2, Aerobic microbes consume oxygen and produce CO2, etc.
This seems to have caused, to put it lightly: ‘Complete Fucking Chaos’.
Populations wildly swing all over the place, no equilibrium ever appears, and I have yet to find a scenario that doesn’t end with everyone dying at some point. I could keep trying to balance this forever, but I believe that’s pointless: This isn’t some wild outlier, it’s an inherent symptom of the way my (and Nick’s) algorithm is built.
We go through the whole scenario month by month, and just sort of hope that after a certain amount of months an equilibrium population will just show up. Every month we also change the amount of compounds and enviromental variables of the patch based on the kind of creatures present, and the amount of creatures changes based on the enviroment present, and it’s a loop. Do you see how quickly this could spiral out of control?
That’s why I’ve decided to do two things:
-
Change my algorithm with a rather weird assumption: Microbes do not directly affect their patch while the population algorithm is still running. Patches are large and ancient, and they do not undergo dramatic changes on a month-by-month basis. For example: If a microbe eats a cloud of glucose, the next month that cloud will simply respawn, no permanent change having happened. If a microbe produces oxygen, that will be ignored by the population algorithm. Changes to the patch can still happen, but they happen over the course of entire editor cycles, not months.
This has some advantages. It makes point 2 (see below) easier to implement. It vastly reduces the amount of chaos in the system. And it makes for a much more player-friendly experience. When players sees in the editor that ‘Glucose: 4%’, they can be confident that that number will stay for at least this editor cycle. They do not have to take into account that glucose could suddenly drop to 0% halfway through running the auto-evo algorithm when they are making their microbes. -
I will (at some point, probably once the discrete version is done) convert the population algorithm into a continuous function, that can be solved directly for the equilibrium population, where Births = Deaths.
Previously I considered this an optimisation, to be done in case the current approach took to long to calculate. Even if we ignore that: yes, it will almost certainly take too long to calculate, I now see that this is not an optimisation but a neccesity. Finding an equilibrium population by calculating the population every month from some starting condition is ridiculous to begin with. If I want to find the equilibrium population, then I must calculate the equilibrium population. Not some incidental stuff that may or may not end up being the equilibrium population.
I might be busy impementing point 1. for a while, but after that I’ll see you in the next update. There, we’ll run the new and shiny population algorithm for a couple of patches that are actually in the game, and see how different species do in different patches.
EDIT: I should add that 1. will not revert the fact that microbes have a limited amount of phosphate and ammonia to work with, because in my model microbes are simply seen as little bags of compounds within the patch (just like compound clouds). A microbe could be built by taking 2 ammonia and 2 phosphate out of a cloud, then die depositing 2 ammonia and 2 phosphate back into a cloud. That’s not considered a ‘net change’ to the patch anymore than taking some ammonia from one cloud and moving it to another is a ‘net change’.