How three simple rules produce the mesmerizing coordination of a murmuration.
A starling murmuration looks choreographed, but no bird leads and no bird knows what the flock is doing. Each bird reacts only to its nearby neighbors; the global pattern emerges.
Craig Reynolds (1986) showed three steering rules suffice: separation, alignment, cohesion. He called the simulated birds "boids."
Each boid looks at its neighbors and computes three steering forces:
Separation. Steer away from neighbors that are too close. This prevents collisions and keeps the group from collapsing into a single point.
Alignment. Steer toward the average heading of nearby neighbors. This makes the group move in roughly the same direction.
Cohesion. Steer toward the average position of nearby neighbors. This keeps the group together instead of drifting apart.
Drag any slider to zero and watch what falls apart. With no separation, birds pile on top of each other; with no alignment, they swirl without direction; with no cohesion, they scatter.
Real birds do not sense every other bird in the sky. They respond to a small number of nearby neighbors inside a roughly 270-degree field of view. Drop the vision radius and the flock fragments into tiny clusters that drift independently; raise it and the flock tightens. Click any boid to highlight it and inspect its vision cone, visible neighbors are drawn in blue, those outside its perception are gray.
The three rules produce flow structures: rivers of birds curving through space, splitting and merging at the edges. Toggle trails to see the coherent streams and eddies.
Click a boid to inspect its vision cone and neighbors
Figure 1. 200 boids following three steering rules plus a limited field of view. Tune the weights, change the vision radius, adjust speed, and toggle trails to reveal the streams and eddies that emerge from purely local interactions.
No bird decides "we should fly east." Each bird adjusts its heading based on a handful of neighbors. The flock-level direction is a side effect.
Different threats shape different responses. A stationary hawk forces the flock to detour. A pursuit hawk chases the nearest bird, splitting tight groups as it weaves through. A wandering fox drifts across the landscape.
Select a predator type and deploy one. Birds within range flee, adding a fourth force that overrides flocking near the threat. The splitting and reforming are emergent.
Click to deploy a predator of the selected type
Figure 2. Three threat profiles. Stationary (red circle) sits and forces a detour. Pursuit (red arrow) chases the nearest boid. Wander (outlined circle) drifts with random steering. Each profile yields a different emergent response.
No bird decides to split the flock. Each bird simply steers away from danger, and the split emerges from hundreds of individual escape responses.
The same three rules govern fish schools, but the medium changes the signal. Fish have a lateral line, a row of pressure sensors running along the flank that detects the minute water displacements of neighbors. Alarm propagates through a school faster than vision alone could carry it, radiating outward from the first fish to twitch as a ripple of disturbed water.
The result is a "flash expansion": a predator dart triggers an explosive outward burst, the school opens around the threat like a vacuole, and then cohesion pulls the survivors back together on the other side. The figure below demonstrates both modes. Click to drop a stationary predator, or press Flash Expansion to send a dart across the school. The red ring is the lateral-line pressure wave propagating outward.
Click to place a predator — watch the alarm ripple through the school
Figure 3. A school of fish reacting to predators. The red ripple represents the lateral-line pressure wave that spreads faster than any single fish could turn. Splitting and reforming emerge from the same separation/alignment/cohesion rules plus local flee responses.
The central lesson of emergence: no leader, no plan, just a population following local rules. Large-scale order is the consequence. Flocking, traffic, markets, neural synchrony — same recipe.