New CPA system with auto evo

I got the new CPA system prototype working! Each dot is a population (time is on the x axis and pop on the y). The two numbers next to the dot are how many chloroplasts it has followed by how many chemoplasts (e.g. 2 0 means 2 chloro + 0 chemo).

The green lines at the top mean a mutation has taken place and a yellow line means a species has been spit to keep the patch numbers up.

The way it works is that each turn the sunlight is divided equally between all the chloroplasts in the patch. This is your energy income. You also have to spend energy maintaining your population and the dynamics are a simple differential equation which maintains this balance. Basically

change in population = small number (energy income - energy expended maintaining pop)

Then there are random mutations made to each species. I was a bit concerned about the previous idea of “offering each species 5 changes and choosing the best” as I was concerned all the species would end up the same. Moreover, with that system, all the organelles need to be included in the energy model or they will be cut for efficiency. With pure random mutation there is still a driving force which is pushing the species towards being pure photosynthesizers (as you can see there is no hydrogen sulfide in the patch).

About 1 minute in you can see the blue species randomly get rid of it’s chloroplast and die out because of that :slight_smile: :slight_smile: :slight_smile:

All feedback welcome. I think this might be a productive path, it’s all very simple and lets the species adapt to any environment dynamically.

1 Like

Looks awesome @tjwhale illl check out the video after I get out of bed and get ready for the day

I feel like the species should attempt to mimic natural selection instead of the energy balance being used to update the population. I guess this system could also do that with the different species emerging when some die out. But I’d prefer a more complex equation for determining the “effectiveness” of some mutation. So merging that with my current understanding of the goals of auto evo it would work something like this:

  • when the player enters the stage (either from the editor or a new game) all the species information is gathered and sent to a background auto-evo thread.
  • Then we can do some fancy stuff as performance isn’t a huge concern. So this is how I’d imagine the auto-evo step to work:
    • For each biome split it into batches (6 * number of species)
    • Then in each patch (except the first for the species) mutate the genome and calculate how well the changed species coped against the other species in the biome
    • Then each species genome will be replaced once the player enters the editor with the one that did the best
    • And then the population simulation will be ran in each biome with the updated genomes to update population and species dying out in some biome
  • A few things that this doesn’t do is: moving to new biomes and splitting off species (I think species splitting should happen when the population of some species is separated, so it dies out in a biome that then causes the remaining biomes it is in to not be connected)
  • The player can’t enter the editor before the auto-evo is done (this can be hidden with a loading screen)

I like how your simple simulation can have fluctuating populations like that, but like I said (or have said before) we need an evolution simulation.

That’s the general overview of how I think auto-evo should work. Thoughts?

I don’t like the idea of not splitting species off within the same biome as that feels very limiting.

How would that work though? And can it be made realistic? To my understanding speciation occurs when breeding populations separate. And it would be possible for the new species to migrate back to the original biome.

A biome in our case can be a whole ocean there is plenty of room from speciation, let’s say there is a mass die off, instead of just randomly adding new species to fill it in I think we should split remaining species to fill in the new niches that would remain realistic. You don’t need “wide tracks of land” for speciation, just isolation, and common selective pressures. And that is completely possible in a cage of all things (scientists have done studies look up fruit fly evolution experiments)(and perfectly possible within a region that is otherwise the same biome)(you only need to be separated for a couple generations to prefer your own “tribe” so to speak)

Maybe the patch concept would help here, splitting biomes into smaller parts?

1 Like

Firstly I’m very open to all ideas, I’m glad to get a chance to discuss this.

calculate how well the changed species coped against the other species in the biome

How do you imagine doing this working? Basically what you need is a function which takes in a list of all the genomes in the patch and returns the populations of each species. That’s what the “energy model” is trying to do, it’s just trying to turn the number of chloroplasts and chemoplasts into a population number. If you have other suggestions for how to compute this then I’d be interested.

Re speciation it looks like speciation within a geographic region is reasonable. I think it’s called Sympatric Speciation.

If we are going to start the game with one species (single hex of cytoplasm) in a single patch then I think we need this to split into multiple species even before moving to other patches. It will be odd from a gameplay perspective to have just 1 species per patch for ages.

2 Likes

(Updated my post)

Ultimately I’d want to come up with quite a complex model that includes photosynthesisers / chemosynthesisers and then predators and somehow derive from the organelles of the species how well they do. Of course your simple formula could be initially put in the system I described to get something working.

Yeah sounds like we’re on the same page. My thinking was something like:

If you have chloroplasts you get a share of the sunlight
If you have chemoplasts you get a share of the hydrogen sulfide
If you can move you get a share of the scavenging (which would be the only primary energy source in the abyss, for example)
If you have combat strength (maybe 1pt per pilus and 2pts per agent gland) then you get to steal some from other, weaker, slower, species (needs quite a lot of thought)

Other organelles could then be modifiers. For example a lightspot would get you a bonus to your share of the sunlight or an improved pilus would be worth more combat strength etc.

In general I think the best idea is to start as small as possible and get something that works and go from there. I was pleased earlier that if I changed the patch to 0 sunlight and 1000 H2S the cells slowly evolved to have less chloroplasts and more chemoplasts, it’s not perfect but it works. If you, or anyone, wants to make a different prototype going in a different direction that’s fine with me.

2 Likes

Ayy, we need to be careful (if the selection prefers toxins you would eventually just get a cell with lots of toxins , and no pilus for example)

Edit: just watched the video it’s great to see visual competition between different species

1 Like

This is quite cool. So I was working on this a bit more today (have made slow progress in general). If you watch this video the most important stuff is happening in the very top left.

Sunlight = 1000 (23)

means the amount of energy coming in from sunlight is 1000 units and the number of chloroplasts is 23. It’s the same with HtwoS for how much hydrogen sulfide there is an how many chemoplasts.

Periodically the patch changes from 1000 sunglight and 0 H2S → 0 sunlight and 1000 H2S (which is obviously totally unrealistic). What you can see is cool though is that the species adapt and the amount of chloroplasts and chemoplasts adapts to the environment. When there is a lot of sunlight and no H2S the amount of chloroplasts is high and chemoplasts is low.

So this already means we could have a load of different biomes and just run this sim on them and it would make cells which are somewhat adapted to them.

I think maybe the amount of random mutation needs to be decreased and a more intelligent selection system would make this all smoother, but I don’t want every species becoming the same. Anyway nice bit of progress :slight_smile:

2 Likes

Random is fine as long as species that randomly are less adapted then others in an environment go extinct and those that randomly are adapted survive and split off several new species so we have some actual natural selection (as you know, hopefully ,evolution is random but those who are better adapted are the ones who survive, and reproduce to create more better adapted creatures and so it isn’t actually random due to natural selection, those who survive evolve to be better and reproduce those who are badly adapted go extinct and eventually only the well adapted ones actually survive )

1 Like

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

End

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.

2 Likes

Awesome, also super easy to understand nice
I love this idea @tjwhale

1 Like

Also we should make falling debris be a thing you can actually interact with in the microbe stage. I’m not sure how we would do it. But that way the player can play a proper scavenger.

1 Like