HomeArticlesPredator-Prey Evolution

Predator-Prey Evolution: Ecology Meets the Red Queen

Lotka-Volterra population cycles get a second clock — heritable traits under selection — producing a coevolutionary arms race between speed and camouflage.

mysimulator teamUpdated June 2026≈ 7 min read▶ Open the simulation

Two clocks running at once

A predator-prey evolution model layers two different dynamics on top of each other. The fast clock is ecology: predators eat prey, prey reproduce, both populations rise and fall on a timescale of days or generations, classically captured by the Lotka-Volterra equations. The slow clock is evolution: within each species, individuals vary in traits like speed, camouflage or bite force, and whichever variants survive to reproduce pass their traits on, shifting the population's trait distribution over many generations.

dPrey/dt   = r*Prey - a*Prey*Pred        (growth minus predation)
dPred/dt   = b*a*Prey*Pred - m*Pred      (predation gain minus death)
  r = prey growth rate, a = attack rate, b = conversion efficiency, m = predator death rate

Left alone, this classic pair of equations produces neutrally stable oscillations — population cycles that repeat but neither grow nor shrink in amplitude, sensitive to any perturbation. Real populations rarely look this clean, because a, b, r and m are not constants — they depend on the traits currently present in each population, and those traits are themselves changing.

live demo · predators and prey with heritable traits● LIVE

The Red Queen: coevolution as an arms race

When traits are heritable and predation pressure is strong, you get coevolution: prey that are slightly faster or better camouflaged survive more often and pass that advantage on, which increases the average speed or camouflage of the prey population, which in turn selects for predators that are faster or better at detecting camouflage. Neither side ever "wins" outright — both are running just to stay in the same relative position, a dynamic biologists call the Red Queen hypothesis, after the character in "Through the Looking-Glass" who must run constantly just to stay in place. It explains why arms-race traits like cheetah speed and gazelle speed, or the coiling ability of garter snakes and the tetrodotoxin potency of the newts they eat, keep escalating rather than settling at some final optimum.

Selection pressure, heritability, variance

For evolution to happen at all in a simulation, three ingredients are non-negotiable: variation (individuals differ in trait values, usually seeded as a bell-curve around a starting mean), heritability (offspring inherit a noisy copy of a parent's trait, typically the parent's value plus Gaussian mutation noise), and differential survival (the trait must actually change an individual's odds of being eaten or of catching food). Remove any one of the three and the population's trait average stays flat no matter how many generations pass — which is a useful debugging check when building this kind of model.

child_trait = parent_trait + gaussian(0, mutation_sigma)
survival_probability = f(trait, encounter_outcome)   // must depend on trait
next_generation = weighted_resample(population, weights=survival_probability)

Trade-offs keep traits from running away

Speed does not evolve to infinity because it costs energy and reduces the resources left for reproduction; camouflage does not evolve to perfect invisibility because it typically trades off against something else the animal needs, like thermoregulation or mate visibility. A biologically honest model attaches a fitness cost to every trait increase, so the population settles at an evolutionarily stable strategy — a trait value that cannot be beaten by a rare mutant, given what everyone else in the population is doing — rather than escalating without bound. This is why real predator and prey speeds converge to a stable ratio rather than both accelerating forever.

What the simulation lets you explore

This simulation tracks two populations of agents, each carrying a heritable trait (commonly speed and a camouflage/detection value), running real chase-and-evade encounters, and resampling each generation by survival and reproduction. Turning mutation rate up destabilises the arms race into faster, noisier swings; turning it to zero freezes the traits and the system collapses back to plain Lotka-Volterra cycling — a good way to see, directly, how much of the interesting behaviour comes from evolution rather than ecology alone.

Frequently asked questions

Why do the populations oscillate instead of settling at a fixed number?

Predation and reproduction respond to population size with a time lag: prey numbers must fall before predators start starving, and predator numbers must fall before prey can recover. That lag is exactly what produces the classic Lotka-Volterra boom-bust cycle, and it persists even once traits are also evolving.

What is the Red Queen hypothesis?

The idea that predator and prey (or host and parasite) are locked in a coevolutionary arms race where each side's adaptations are largely cancelled out by the other side's counter-adaptations, so relative fitness stays roughly flat even as absolute traits like speed keep escalating.

Why doesn't the predator just evolve to be unbeatably fast?

Because every trait carries a cost — faster predators burn more energy and have less left for reproduction — so the population settles at an evolutionarily stable trait value rather than escalating indefinitely. Without a cost term, simulated traits diverge unrealistically.

Try it live

Everything above runs in your browser — open Predator-Prey Evolution and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Predator-Prey Evolution simulation

What did you find?

Add reproduction steps (optional)