Having thought some more about this I think ultimately the only thing we really need for this whole system is one function. It’s a function which takes the patch information (amount of sunlight, temperature etc) and species data (which species live there and what organelles they have etc) and returns a population number for each of those species. Once you have that function all the rest is quite easy, for example for auto-evo you can make 5 changes to a species and test which is best, by using the function on each of the variations.
So here, in pseudocode, is a suggestion for how such a function could work. It’s incomplete as a lot of organelles aren’t factored in but it is stable (species populations don’t blow up or do anything crazy) and fast (so we can have a lot of patches if we want). All constants can be tweaked.
Step 1: compute energy in the patch
scavenging energy = leftover energy from last turn (explained below) + debris falling into the patch (for example in the abyss some debris should fall from patches above)
sunlight energy = a property of the patch, could be computed from the world model but can just be a number
hydrogen energy = a property of the patch, the amount of energy in H2S which is entering the patch
total patch energy = scavenging energy + sunlight energy + hydrogen energy
leftover energy = 0.1*total patch energy (each turn 10% of what was available this turn is left behind as debris for scavengers to live off)
Step 2: compute how much energy each species gets
sunlight energy per species = sunlight energy * (number of chloroplasts you have / number of chloroplasts in the whole patch)
so basically if you have 2 chloroplasts in your species and there are 30 total chloroplasts in the patch you get 1/15 of the sunlight energy.
hydrogen energy per species = hydrogen energy * (number of chemoplasts you have / number of chemoplasts in the whole patch)
speed score per species = (1 + number of flagella) / total number of organelles of that species
scavenging energy per species = scavenging energy * (speed score you have / total speed score of the whole patch)
total energy per species = sunlight energy per species + hydrogen energy per species + scavenging energy per species
Step 3: compute predation relations
for each species:
take half their energy and put it into a communal pool called predation energy
combat power = 2 * number of pilus + 5 * number of agent glands
once the pool is filled divide it between the species
predation energy per species = predation energy * (combat power I have / total combat power in the patch)
Step 4: compute populations
species population = species energy after predation / (number of organelles the species has)**1.3
This gives the population numbers for each species. Once it works there’s a lot of ways it can be improved, for example if you can move quickly maybe you should reduce the amount of predation energy you have to give to the pool, or maybe you get more back. Every organelle should do something to help you, for example when computing speed score you need to compute how many mitochondria and how much cytoplasm you have to check how much energy you can produce etc. There’s a lot more that can be iteratively factored in.
However I think this is a good place to start. It will adapt to the conditions in each patch and allow some species to be scavengers, some to be predators and some to be autotrophs. All feedback welcome if anyone has any ideas or questions etc.