Environmental Pressures and Creature Traits

This article describes an investigation of the interaction between a creature's traits (movement speed) and environmental pressures (food availability). The interaction was modeled in primsoup.


An animals environment creates many challenges. Animals that are more successful at overcoming those challenges have a greater chance of reproducing - and passing on their genes. Thus, subsequent generations will be better at overcoming those obstacles than the previous one: their parents were the fittest individuals. I wanted to see how well primsoup could model natural selection.

The Proof is in the Genes

To achieve this, I implemented genetic traits for the creatures. When two creatures mated, they would combine their genetic code to produce an offspring. To keep the process simple, the combination process would just be an averaging. And the genetic traits would be a simple numeric value.

Mutant Powers

Because all creatures are created equal (at least the initial generation), they all start with the same genetic material. This means that our merging would not be very interesting. All the children would have the exact same speed as their parents.

In order to mix things up, I added the possibilities of mutations when genetic traits merge. This mutation is a chance that the genetic trait value is modified. The value could be modified negatively or positively. In a world where the speed trait mutation factor is 2.5, and both parents have a speed value of 10, the child could have a speed trait that is anywhere from 7.5 to 12.5.

I felt that the chances of a large mutation (a value of 2.5 or -2.5 in the previous example) should be much smaller than a small mutation (a mutation of 0). When two traits are merged, mutation values follows a normal distribution.

Setting the Stage

Now that the creatures could pass on their genetic material to their offspring, the stage was set for natural selection. I generated a primsoup world similar to the one that we saw in the food modeling article. The world was allowed to grow some plants first, and then an initial generation of creatures were added.

The population and food supply numbers were the same as when we modeled the world without genetic traits. However, when we look at the genetic trait data, we see an interesting trend.

Natural selection seems to have had a powerful effect in our world! Initially, food was plenty and there was not a great benefit to being a fast creature. As times got tough and food became more scarce, the faster creatures survived. That means that the faster creatures were the ones having babies. So their children were more likely to be fast.

The gains in speed were extreme while the food remained hard to get. The creatures had to suffer intense competition to survive. That pressure pushed their speed trait higher through natural selection.

As the population thinned out, the food supply was able to recover. This made food easier to find for our creatures. The pressure on the creature's speed trait decreased. At that point, we can see the gains in speed slow down. However, they never go flat because food still remains scarce enough to provide a benefit to creatures that were faster than their peers.