Muuuh Nature & Wildlife

Natural Selection of "Creatures" - A Simulation

Get a first-hand look at the process of natural selection with this simulation called "Creatures" written in JavaScript using the P5.js library. Experiment with different models and watch as creatures adapt and survive over time. "Creatures" is loosely inspired by Conway's Game of Life. Developed by a biologist with experience in JavaScript programming.

Pool, Planet, Universe ... Whatever

Creatures v4 · Model · Species · Creatures · Cycles




Select Model


For all distribution graphs: x-axis from 0, left, to 255, right; y-axis from 0 to max count. The value of max count may change from render to render. Only counts > 2 are shown.






Setup, Interaction Models and Energy Balance

The map is populated by small creatures with 4 genes (locA, locB, locC and locZ) and a generation counter. Each gene is circular and has 256 different alleles. During a cycle (world map update), the fitness (energy) every creature is updated based on the interaction with the surrounding creatures.

Life Cycle of a Creature

On each cycle, fitness of all creatures is updated based on each creature's neighbors. If fitness passes a certain threshold, a creature undergoes division (mitosis). With division the genes are passed from parent to progeny although at a low probability mutation can occur. The mutated gene must be within a certain threshold (mutation range). Generation counter of the new creature is set to 0 and fitness of both parent and progeny is set to half of the parent's original fitness.

Division is initiated only if there are empty cells around the creature. If different creatures create a progeny into the same cell during a map update, only the progeny with the highest fitness will be placed while the others are discarded (failed).

The generation counter of each creature in incremented by one during a world map update (cycle). A creature's energy is set to 0 after 40 cycles

Interaction Models

There are two interactions tested between a creature and a neighbor. First, can a creature see the neighbor (perception) and second, is the neighbor friendly or not (relationship). Relationship is only tested if the creature can see the neighbor.

Perception and relationship tests are based on comparison of one or two genes. Which genes are used for the tests depends on the selected model. A selected model is described with two codes. The capital letters of a code indicate which genes are used for the test, the leading letter in lower cases indicates the interaction, p stands for perception, r for relationship. For example the code for Model "pAA,rBC" means that creature's locA is compared with neighbor's locA to determine perception and creature's locB is compared to neighbor's locC to determine relationship.

In order to pass a test, the compared alleles have to be similar. The distance cannot exceed a small threshold.

With the model slider, you can change the interaction model used during the world map update.

Energy Balance

In case that a creature cannot see a neighbor, the creature loses energy while the neighbor gains energy. If a creature can see the neighbor and the neighbor turns out to pass the relationship test (friend), both, creature and neighbor gain fitness. Otherwise (foe), both, creature and neighbor, lose energy.


Calculations during a world map updates can be modified using the controls: