Patch System


Continuing discussion from the slack, How ARE we going to handle the patch system? Maybe if we got a formulated, written down plan we would have an easier time implementing this system


So here’s a very rough outline of what the patch system should do, from there we can work on how.

Patches are locations in space, which will eventually be geographic regions of a generated planet. The current play area will be one of those patches, and the rest of the planet will contain many more patches. As mentioned many times before, the area outside the current play area will be simulated, but in less detail than what the player sees.

Each patch has a an environment, for now that can be a predefined biome (deep sea, shallow sea, freshwater, ocean vent, etc.), but this will eventually be determined in part by climate.

Patches contain a number of species, a subset of all the species on a planet - some species will not be able to survive in all patches due to environment, others will not be present in a patch because of geographical isolation (think marsupials not existing outside Australia). Species within a patch have a population (from population dynamics), and may evolve in a different direction to the same species in other patches, leading to speciation (vicariance).

The patch system has two responsibilities:

  • replicating the compound, population and auto-evo systems across multiple independant patches. I.e.: the CPA system running in each patch does not need to worry about the state of other patches.
  • distributing compounds, species and populations amongst patches.

This can broadly be seen as a reaction diffusion model, where the dynamics within a patch are calcuated in one step, and the dynamics between patches in a seperate step.

Implementing the above is mostly a case of moving a lot of global systems to local, replicated systems. Where we currently have one CPA system, operating on the singular playable area, we need a seperate CPA system for each patch. More specifically, we need to replicate the data CPA operates on, and tweak the system implementation to iterate over that data - we don’t need multiple systems, just multipel data instances.

The only really complex part of this is balancing compounds, populations and mutations. We need to ensure that compounds and population aren’t lost or gained magically as they’re shuffled between patches, which is relatively simple.

We also need to decide what happens when populations of the same species in neighbouring patches evolve in different directions. Do the mutations merge, does one dominate the other, does speciation occur? Not massively complicated, but requires more thought than I’m going to put into this post.

Finally, we need to think about how the player interacts with the patch system. At least in the early stages, there’s no way an individual creature can move from one patch to another within its lifespan, and that won’t change until we have relatively large (probably flying) creatures. That means that migration happens on a multi-generational timescale, and is best handled during a reproductive step, i.e.: before or after the player goes into the editor. At this point we may give the player the option to encourage their species to colonise a new patch, to move population between patches, or to choose to play in a different patch when they exit the editor. We may or may not want the player to control the evolution of their species in other patches.


We can kinda see in real terms how species react when they inhabit an area, but for reasons that may be social, biological, or some other factor other than isolation, they evolve separate from each other, becoming two different species. Like the finches of the Galapagos, biological differences that didn’t limit reproduction eventually created different species.

At the point that the player is migrating to cover their continent(s), the evolution of the species should have slowed down to be a minor issue. Like with humans, humans migrated across the planet over the course of 20,000 years, at which point the only evolution was changes in skin tone to correct for solar radiation in the region.

Most of the evolution toward sapience should happen before they’re realistically able to leave their niche in the biosphere.


On your first point, the problem isn’t just knowing the situations in which species diverge, the problem is quantifying exactly when we want that to happen. We need a cutoff, otherwise we’ll very quickly generate a vast number of only slightly different species, and we can’t afford to simulate that. We can base that cutoff on something like linkage disequilibrium - measuring how much genertic interaction there is between two species, to decide whether or not they are in fact seperate, but I’m not sure exactly how we implement that, seeing as we don’t have an exact proxy for genetic information.

As for migration not happening on evolutiuonary time, you’re looking at too narrow an example. Modern humans may have only spread around to globe in a relatively short time period (but even then, we have evolved as we’ve spread, if only subtely - darker skin tones near the equator to protect from UV, lighter skin tones near the poles to produce sufficient vitamin D, tolerance of a high protein diet in Inuit, lactase persistence and alcohol tolerance in europeans, etc.). In the history of life, different species will have spread, died out, and respread on differing time scales, some fast, some slow.

Whats more interesting though, is what happens when you approach a patch boudnary, the other side of which you’re not well adapted for. If the gradient is smooth, you may push on and gradually adapt to the new environment. If it’s abrupt, you may have to stop and push against that boundary for a while until you find a mutation that allows you to carry on. This video is a neat example of both - an initially hard boundary, followed by smoother boundaries beyond, as initialy the bacteria adapts to something new and unknown, while later it simply has to improve on a trait it already has. It may be that in some cases, the population that crosses such hard boundaries can no longer be considered the same, but that again is not an easy question.


Perhaps for the species diversification aspect, we could make a genetic proxy, we could have different sequences represent different parts of the body, and individuals of the same evolutionary branch are considered the same species if they have a difference in that code that is less than X%
It’ll need more stock body parts to really work well, but it would be easier to simulate.
So like if two individuals, one several generations removed from the other, are identical in nearly every aspect, except one is 8% taller than the other, or one has 4 fingers instead of 3, they’re effectively the same species, and would both be labeled as “Species Y”

Maybe we can define various terrain types, and species can’t each as many of the plants as in their native biosphere? Or the have to compensate some other way.
Like a Desert dweller that eats cactus’s might be able to eat grass or leaves, but those have a much lower water content, so they’d also need a watering hole to get more water.