Population System - Species Splitting

I didn’t read the discussion on discord and I didn’t spend a lot of time reading that pdf, but here’s some points.

This seems very similar to what I suggested. And this doesn’t really address the most difficult calculation: how is the usefulness calculated. My idea solves that by making random mutations that can then be simulated forward in time to determine how good it is.

So I’ll reiterate the main points about my idea:

  • Species can have populations in many patches
  • Each species is simulated with 5 (roughly) random mutations and their usefulness is calculated based on how much they would gain population overall against other species.
  • Based on the usefulness of the mutations the main species will apply the most useful and then the species may split if there is a second very useful mutation.

A few amendments to my idea that I stole got inspiration / idea for from your plan:

  • Each patch’s population tries to send some population to a random connected patch. This will either reinforce the population of the species in that patch or create a new population in a patch which might succeed there and gain a foothold.
  • The chance of splitting the species increases as the global population increases.
  • It is possible for the species to split in only one patch if it has relatively hugely beneficial mutation it can take there. Otherwise the split would be in all patches at once if there isn’t a mutation that greatly benefits only a part of the species. So for example if the species is trying to establish a foothold in a hydrothermal went and it is also in a bunch of other patches then if one mutation is a chemoplast it would be almost guaranteed to split to a new species in that went.

I’m still convinced my idea (with possible tweaks) is the best one :smiley:

And while I appreciate this discussion, even if I don’t have the time to properly participate all the time, I think we just have to go with a basic implementation (my idea is good also in that regard that it doesn’t require much that other ideas wouldn’t also need, so no much wasted work) and then see concretely what these different suggestions do to it. So we could stop speculating as to what works, because we all have no experience in making an evolution simulation, so our intuition and ideas are probably not spot on.

3 Likes

I agree with this. I’ve had enough of discussing it as I think we don’t know how it’s going to feel yet. Lets just implement something simple and then iterate on it.

2 Likes

I had an idea last night which might work to keep species together a bit. If you make a species a group of groups which are in multiple patches then when auto-evo works on that species is runs 5 mutations in each patch locally to see the impact on the species.

Then, from the mutations which were beneficial, it chooses the largest subsets of the groups it can, in order to try and keep the species as blobby as possible.

So for example imagine a species is in 5 patches and the mutations tried had results

no change = control
chloroplast : +4, +3, +1, -1, -5
flagella : +1, +1, -1, +2, +2
pilus :+8, -1, -2, -1, -1

In this situation if auto-evo is run only locally, patch 1 will get pilus, 2,3 chloroplast, 4,5 flagella which would split it in to 3 species. If you just average the results the pilus wins in all patches even though it is detrimental in 4 of them, which is mad.

However the largest subsets algorithm would pick flagella for patches 1,2,4,5 and then chloroplast for patch 3. This means it only splits into two species AND every group in every patch definitely gets a beneficial mutation for it, so it is reasonable that it is adapting like that.

The drawbacks are some really beneficial mutations get missed out on, like the +8 pilus is not chosen, and it’s still a bit “spooky action at a distance” because the mutations are being chosen based on patch conditions in other patches however it might be reasonable.

This would be a way of having a species be made of identical groups in many patches, have them all adapt only to their local conditions and try to keep them together for as long as possible.

1 Like

Exactlly, the way it works right now with populations that go up and down based on successful hunts/death/reproduction etc and split at certain amounts and go extinct at certain amounts, are essentially a stopgap measure for calculating “usefulnes” and if we want to make this work for multiple patches, we need a system that can calculate usefulness and it should do so in a non-biased way (we shouldn’t assign usefulness ourselves because our ideas arent nessessarily the best ones, thats the whole point of an evolutionary algorithm). The reason being s that we cant do proper Darwinian evolution, in a way that would not kill a computer at the moment (at least in thrive, this can be explored easily in smaller simpler games)

1 Like

Here is some discussion from the discord.

OBPSGToday at 01:01

-In response to the concerns that making migrating between patches incur a Muation Point would force the player to choose between expanding to a new patch and improving their species, I propose avoiding that issue by adding a new currency related to migration, let’s call it migration points for now for simplicity. The way this currency works would be similar to as follows: Each species (including the players’) automatically generates a certain number of migration points based on its total population across all patches at each reproduction cycle/auto evo step. Then when a species wants to colonize a new patch, they pay the cost in migration points associated with the link that gives them access to that patch. This dynamic would allow more successful species to spread across patches faster. We can work out the details for calculating migration point costs of each type of link later, and add additional evolutionary restrictions if we would like.(edited)

Goro von BismarkToday at 01:13

wouldn’t it be easier if that currency was directly the species’ population?

If you migrate to another patch half of your cells go to the new one, spreading your species thin

But over more patches

crodnuToday at 02:24

Maybe we could make it so unsuccessful species get more mutation points and more successful ones more migration points?

1n48ygToday at 03:05

I agree with dividing the population when migrating to a new patch. Because at the scale of microbes, when migrating to a foreign environment, the changes that happen to your cell to adapt to the new environment are probably significant enough to label your new cell as a seperate species from the predecesor it evolved from.

TJWhaleToday at 09:23

I think species spreading between patches has been quite a controversial topic, there was a long discussion here with a lot of different ideas.

What I’d suggest is for now we do the simplest possible thing to get the system working and then we play with it, see how it feels, and iterate to make it feel better. Towards that end I’d suggest for ai species simple select some at random to split and move patches each time the player enters the editor. Let me know if that is not easy for any reason. For the player I think we should just offer them the chance to split every editor session if they want without restriction. If this turns out to be too much then we can have a currency to limit them, or limit them based on population etc. However we don’t know yet how often the player should be able to split, every 2 editor sessions, every 3, 4, 5 etc? The idea of a splitting currency is an interesting one if we need it.

Goro von BismarkToday at 09:32

There should be a risk when spliting to new patches so the player has to make sure to adapt to them first. Loosing a good chunk of your pop when traveling to a hostile patch is a good threat to adapt imo

1 Like

One of the main goals for 0.4.3 is to finish this discussion and get this stuff implemented.

Feel free to read the above if you’re interested but TL:DR:

Things which are agreed: We have a set of patches with connections between them. In each patch lives some “population groups” (I’m just calling them that to have a word for it) which are a group of genetically identical individuals. Each “turn” (each time you go to the editor is 1 turn) there will be some amount of a: population groups being split into two, b: population groups being split into two and one half moved to another patch and c: auto-evo editing the population groups.

The goal of this discussion is to finish working out the exact mechanics of how this works.

The first question is “what is a species?” One option is to have each population group be it’s own species and if a population group is split (and maybe some is moved to another patch) then it is now 2 species. This means a species can only ever be in one patch and everything is very straightforward.

Other options people brought up above include that a species is many population groups. For example if a population group is split and half is moved to another patch then those two groups are still part of the same species.

If we have a system like this there’s a bunch of questions we need to answer:

If a species is many population groups in many patches what happens when auto evo suggests different mutations in different patches? Are the auto-evo results aggregated somehow? Can a species have non-identical population groups (such as 2 thylakoid + 3 thyloakoid prokaryotes could be part of the same species) if so how different can they be? If species must be identical population groups under what conditions are they split up?

When can species move? How far can they move? Can each population group only move to neighbouring patches each turn, can it move multiple patches or possibly to the whole map?

When population groups are split inside a patch are they still the same species? When should they split, under what conditions etc?

I think personally I don’t really mind how this works. What I want is for it to be relatively simple without a huge amount of calculations and complexity and also I want to avoid “spooky action at a distance” where if a species is in both some sunlit patches and an abyss then the ones in the abyss get a choloroplast because that was the average auto-evo result or things like that. I think population groups need to adapt to the patch they are in relatively tightly.

2 Likes

I like the option that a species may be in multiple patches at once. I have coded the current system so that everything should work with a species spanning multiple patches. This also allows forcing the player back to a previous patch to work very easily. Just have a bit of code that moves the player back to a patch where they have population if their population in the current patch drops to zero.

In our model a species is uniform. If there would be members of a species with different organelles, then that is a different species.

I coded the current auto-evo to select the mutation (remember the actual population algorithm is random) that leads to the highest global population for the species.

I think there should be a population limit after which the species would have a random chance (that increases with population) to move some population to a mutated version in one of their patches. Also there could be some random chance here that the new species is put into a connected patch.

I’d say each auto-evo cycle each species that isn’t basically extinct (ie. very low population) is given three chances to try to spread with a random fraction of their population in one patch to a neighboring patch. Out of these the move that results in the greatest population gain is selected, if it is positive. ie. if a species would basically just sacrifice a bunch of their population even in their most optimal move, they wouldn’t be allowed to move that auto-evo cycle.

To one connected patch. No multiple moves per auto-evo cycle. Maybe they would be allowed to try to move from each patch they are in, but I like the simplicity of allowing to move from one patch during a single cycle, this would also mean that a widely spanning species doesn’t get a huge buff to spreading to more patches.

Code-wise it would make it unnecessarily complex if a single species is allowed to have different population groups inside a patch. Basically the code stores populations as a tuple: (patch, species, population) This change would require splitting the population variable somehow and I don’t see much benefit in a such a complication.

To me it doesn’t make sense to let AI species move with different limitations than the player.

I also don’t mind that much, but I’m suggesting solutions that are easier to implement taking into account the current code. I have so many other things to work on that I’m hoping someone else will do all the auto-evo changes for next release.

If having unnecessary organelles in the abyss was punishing enough auto-evo would not choose such a choice. Unless it makes their population bloom on the surface, but that could then quickly lead to that species extinction in the abyss.

Having huge penalties for not being optimal would quickly make species extinct that aren’t to your liking (in that patch, they could still have population elsewhere).

We’ll probably also need some emergency splitting algorithm if life is entirely in danger of going extinct (in the old version there was a minimum species threshold which triggered additional species appearing from thin air).

Oh boy, here we go.
As most of you might remember I was (at times too) exited and vocal about my opinions on this topic the last time we discussed it.
So I will try to restrain myself this time around.
Firstly, I agree with hhyyrylainen that A: all members of a species should be identical and B: a species should be able to exist in multiple patches simultaniously.

The way I see it every simulation is inherently a simplification of reality. Therefore, when creating a simulation, one has to decide where stronger simplification makes sense and where it‘s important to not simplify things too much.

A is a simplification which in my opinion makes a lot of sense.
B is the antithesis of a simplification which in my opinion is applied at the wrong place.
This is the simplification that patches are very strongly separated from each other and have very narrow bottlenecks in between them.
In reality the equivalent of „patches“ (which are a construct, not an actual well-defined entity) have very fluent borders. Over the time of one turn (that is multiple millions of years) a lot of microbes will be randomly carried around in between patches by currents. If a species inhabits two adjectant patches it doesn‘t compromise of two clearly separated populations, but rather of one more or less continuous population.

Some rambling, feel free to ignore

Therefore, if a species inhabits two patches, an epipelagic and a mesopelagic one, and 9/10 of its specimens live in the epipelagic layer, a chloroplast has a high chance of evolving in this species as a whole. The chloroplast might be useless in the mesopelagic, but it‘s so useful in the epipelagic that the chloroplast-bearing specimens might even replace the non-chloroplast-bearers in the mesopelagic through sheer numbers, even if they technically face a disadvantage in the mesopelagic. More of them might die off in the mesopelagic compared to their better-adapted brothers, but there‘s a constant supply of chloroplast-bearers from the epipelagic.

Because of this I don‘t think this is a case of “spooky action at a distance”, but rather a normal mechanism of evolution which I think we should implement.

One reason I‘m in favor of this is it helps curb another realism-problem which Thrive faces: Thrives evoltion is too inventive. Real-life evoltion is an innovation-machine, but most of the time it‘s also a pretty conservative force. Pivotal adaptions like a mitochondrion or a chloroplast, as far as I know, only happened once. Once a recepy works, evolution tends to stick with it. There are, as far as I know, no examples of a primary producer becoming a predator or a predator becoming a primary producer. This is because both extremes are effective, while intermediate forms are ineffective. You can‘t bridge the gap with one fast jump and since passing it in small steps leaves you vunerable while you‘re „in the middle“, the gap is not crossed at all.
This approach would help make evolution in Thrive more „conservative“ as it currenlty is.

What worries me about averaging auto-evo results is that it’s blunting the population groups ability to adapt to the patches they are in.

For example if a species is in the vents it might choose to get rid of all chloroplasts and use the H2S as an energy source. However if it is also in 5 sunlit patches then it will never do this because on average that would be a bad idea.

A species which is adapting to the average of a bunch of patches isn’t fully adapting to any of them. How big of a deal this is I’m not sure but in some sense the more patches you spread to the less change you have of making a meaningful adaptation to any of them.

Is it also true for the player that each editor session they are trying to choose organelles for all the patches their species is in not just the one they are swimming in?

I disagree that all patches should somehow be considered as well mixed. I think that kind of defeats the point of having seperate patches. For any neighbouring patches it’s reasonable to consider them as well mixed but as soon as you get a chain going across many patches the idea that they are all well mixed doesn’t make sense. Like an abyss is going to end up well mixed with a tidepool half way across the planet?

Below is some stuff about carnivorous plants which isn’t important.

So there’s venus fly traps etc and I’ve heard a theory that brambles are a predator for sheep (they get tangled and can’t escape). “True carnivory is thought to have evolved independently nine times in five different orders of flowering plants,and is represented by more than a dozen genera.” Link And there’s animals that photosynthesize.

Maybe that’s not so much what you mean though, you mean a tree can’t become a cheetah or something? Single celled yeasts apparently evolved from multicellular ancestors so pretty much anything can evolve into anything else I think, given enough time.

If the population penalty in a patch for not being well adapted is huge, a species will quickly go extinct in a patch in a case where an adaptation is chosen to adapt to another patch. This could probably be implemented as a single configurable variable, meaning that it’s very easy to tweak this later. Whereas if species can’t span multiple patches approach is chosen, we’ll be way more stuck with that choice.

This is a very interesting topic and actually something that will also come up in the Auto-Evo thread in Episodes 2 and 3, so I haven’t thought about it that much. Here are my thoughts for how we could implement it right now though:

I think multi-patch species is the way to go. One patch just seems WAY too small of an area to confine each species to.

@MirrorMonkey2 is right that “spooky action at a distance” is an observed biological phenomenon. I can’t remember if there is a specific term for it, but the way it works is:


Many species exist across different biomes. There will be biomes where they have larger presences than others. Evolutions to that species will be dominated by what helps them the most in the biomes that they have the biggest presences. For example, if a species of butterflies lives in Florida and Cuba, and a mutation to their DNA causes their colour to change making them more camouflaged in Florida (and thus improving their survival) but less camouflaged in Cuba, BUT 75% of their population growth occurs in Florida and only 25% of their population growth occurs in Cuba, then the mutation will overtake the population. Regardless of the fact that it reduces their survival in Cuba. The reasons for this are purely mathematical.

The one key caveat here is that it’s assuming there is constant migration of species members back and forth between the butterflies in Florida and Cuba. If, however, there was very little migration back and forth between Florida and Cuba, and the mutation appeared in the Floridian population, then it would overtake the Floridian butterflies but the Cubans would stay as they were before. And this would be the first step of these two populations deviating into two separate species.

In fact this is the reason that new species typically form at the edges of the geographical range of a current species. It’s because these “frontier” populations have low rates of immigration from the core population, and are likely not very well adapted to the current environment since they were evolved for an environment that is miles away. Thus there’s a lot of potential for them to adapt to their current environment, and there’s little immigration to “overpower” their evolution.


In terms of implementing this to Thrive, here are a few key points we could focus on:

  • A species’ chance of migrating out of a patch is proportional to their population in that patch. If you have more population in a patch, you will have more migrants exploring the neighbouring patches. This creates a sort of diffusion effect centered around the “core” patch of that species.
  • Evolutions are weighted by how much they benefit each patch, and how much that patch contributes to the species’ overall population growth. Lets say a mutation increasing population by 100 in Patch A but -100 in Patch B, but Patch A contributes 80% of population growth and Patch B only contributes 20% of the total species’ population growth, then the calculation would be 100*(0.8) + -100*(0.2), which gives an average benefit of +60 for the species, meaning it’s an overall good mutation.
  • Anytime an evolution is chosen for a species living across multiple patches, each patch has a chance to separate as a species proportional to how little migration there is to their patch. Just as with the butterfly scenario, when there was a lot of migration from Florida to Cuba there was little chance of the Cubans deviating as their own species. But if the migration rates were very low, the mutation in Florida had a very low chance of spreading to Cuba and thus the Cubans differentiate into their own species.

I would create a mathematical model / prototype for this so we could get some quicker implementation, but I’m pretty swamped with exams at the moment so I can get to it in 1-2 weeks.

2 Likes

I see what you mean and I do think there’s a lot of value in species being in multiple patches, that sounds nice, especially the player species.

What about some kind of system where you run AE in every patch and then take the most common positive mutation and in any patches where that is negative you spit off to make a new species.

So if you’ve got a bunch of species all in sunlit patches they tend to stay together as they make similar choices however if you’ve also got one in the abyss as soon as the choroplast start coming out it splits off.

As the player if you work your way up an ocean column I’m not sure it’s going to feel good to then put some chloroplasts on and know all the ones below you will die. However if they are just split off at that point and become cousins maybe that’s better.

1 Like

I think this is close to what Nick is suggesting? I’d like to have some kind of threshold for this because if some change makes you like only 3% less effective in a patch, then I feel like the splitting would trigger too often.

1 Like

Hopefully :slight_smile:

Nick I’m not sure how you would work this out. For example for each patch do you need to work out how much mixing there is with every other patch based on how far apart they are and what patches they are? That sounds tricky.

Re thresholds yeah that’s fine with me, we can adjust it. I’m also really happy to change it if it’s not working. It seems everyone is pretty keen on a species being multiple population groups across multiple patches so it sounds like we’re going down that road.

My biggest fear is around AE that it’s going to be really hard to make it do sensible stuff and adapt the species to the patches well and a mixing/averaging system could make that task harder. However I could be worrying over nothing and it might all be fine. I guess one thing is that if we’re dynamically computing which organelles are useless in certain patches if we just told AE not to put any of them on that would probably make it semi-reasonable at least.

Well I guess my first question is are we planning to allow species to migrate more than 1 patch per generation? If no, then you’d only need to calculate the level of migration to neighbouring patches that your species is in. So for example here’s a patch map with the levels of migration shown on the connections:

Patches with green circles have the species in them. The percentages are the rates of migration between patches (however we decide to calculate that).

The chance of a patch forming a new species is inversely proportional to the average migration it has. One potential formula for this could be:

Chance of forming a new species = (100% - Migration Rate) / 10

So for example if a chloroplast is chosen as the new mutation for the species, the Bathypelagic patch would have a 9% chance to form a new species, the Tidepool and Mesopelagic populations would have a 8% chance to form new species, the Epipelagic on the left would have a 7% chance to form a new species, the Epipelagic on the right would have a 6.5% chance to form a new species, and the Epipelagic patch in the middle would have a 6.3% chance to form a new species.

And if we want to constrain it so that new species can only form one at a time from a parent species. We can do something like this: Every mutation there’s a 25% chance for a species to split. If the species does split, the game randomly chooses a patch weighted by how likely that patch is to form a new species. For example, our species mutates and we hit that lucky 1/4 where the game decides that a new species will split off. This is how the game determines the chance that the new species that splits off is the Bathypelagic population:

9 / (9+8+8+7+6.5+6.3) = 9 / 44.8 = 20%

So there’s a 20% chance that when a new species splits off, it’s the Bathypelagic patch.

1 Like

I think this is an interesting idea. I think maybe it’s best to have it as an improvement we can look at after doing the basic system.

One comment on it imagine the Bathypelagic had a 50% mixing with the Mesopelagic, you would calculate that the Bathypelagic has more mixing with the species as a whole than that Epipelagic in the middle which is mixing with 3 neighbours.


Here’s a summary where we are at:

  1. A species is multiple population groups across multiple patches which are all identical.

  2. Periodically a species is chosen and a patch is chosen and some of that population group is moved a neighbouring patch so the species spreads (I see what you’re saying hh about computing the best moves, I think that’s a good thing to look at later once it’s working).

  3. When AE is run on a species it is run with the same 5 mutations in every patch. The chosen mutation is the one which is most commonly a good one, to try to keep the species together. If there are patches where the change is negative below some threshold that species breaks off to form a new species and takes a better mutation.

  4. To fill up the map we also need a mechanism for species splitting inside a patch. For example the player starts with only their species and if they never moved patches it would never split. So there should be some situations (maybe caused by high population) where a population group is picked in a patch and is split in half with one half becoming a new species. This should happen on the first editor visit so then there will be many species for the player to play with.

Is everyone ok with that? Feel free to keep discussing it if there’s things that don’t seem right or workable.

2 Likes

Yeah it’s something to think about, probably something like what you’re suggesting would be a better simplified implementation of it for now. I’ll revisit the topic again when it comes up on the Auto-Evo thread.

That’s true, and as you suggested I think it should be proportional to the population in that patch, so that patches with a high population of a species in them have it occur more.

1 Like

I admit i have not read the whole post thoroughly but from what i gather, i might be of help somehow.
I have a few specialized open sourced programs that can simulate different species and patches as well as dispersal and migration paterns for management purposes. Otherwise, i have many a notebook or pdfs regarding the actual mathematical models behind the simulations and i have firsthand experience with all these as well.

Give me a shout if you are interested, i could send them over/discuss about it as well.

3 Likes

Yeah sounds interesting. We’re trying to do something pretty simple because we just need to get something working. If you have thoughts or ideas that would be cool to hear. We can also build towards something more complicated later.

Even though there’s no proper consensus, as this being missing is causing issues for other feature implementation I’ve opened an issue and picked the algorithm on roughly how it should work:

2 Likes