Local interactions

Three rules. One flock.

You don't animate the flock. You write the rules for a single bird — then run many copies.
The flock is a side effect.

Craig Reynolds published this trick at SIGGRAPH in 1987. Before boids, animating a flock meant scripting every bird's path by hand. Reynolds' insight was don't — write the rules for one bird and run many copies. The method went straight into production: the swarming bats in Batman Returns (1992), the wildebeest stampede in The Lion King (1994), a Scientific and Engineering Academy Award in 1998. It's probably the most-reimplemented agent-based model in existence. And the whole thing is three rules, each one about what a bird does with the birds it can see.

The lab · pick a regime, then try turning a rule off

drag inside the field to play predator · press space to pause

Separation steer away from close neighbours 1.00
Alignment match the heading of neighbours 0.25
Cohesion steer toward the centre of neighbours 0.030
Finer controls — perception, flight, view

Space & creature

Perception

50
10
300°

Flight

260
3.0
0.60

View

Polarization
0.00
0 chaos · 1 perfectly aligned
Rotation
0.00
how strongly it's milling
Nearest neighbour
0.0
average spacing in body lengths
Current state
settling
0 boids · 0 fps
Try turning off separation. Click the "No separation" chip, or uncheck the Separation box above. Within a second or two the whole flock collapses into a single point — perfectly aligned, zero spacing, utterly unphysical. That's what alignment and cohesion do on their own. Now turn separation back on and watch each bird reclaim its personal space. One rule holding up the whole illusion.

What the three rules actually say

Each boid sees only its neighbours — birds inside a vision radius, within a field of view (its own eyes don't look straight behind). From that handful of visible neighbours, three rules each propose a direction to steer:

Short-range repulsion, mid-range heading match, long-range attraction. Weighted sum. The acceleration is clipped to a maximum force; speed is clipped to a range; and that's it. There is no rule in there that says "stay 2 body lengths from your neighbour" — yet watch the nearest neighbour readout. It settles at a stable spacing you never told the model to produce. That's emergence.

Why the clipping matters. Remove the force clip and birds snap instantly to the ideal velocity — the motion looks like particles bouncing. Remove the speed clip and the fastest ones outrun the flock. Those clips are what tip the simulation from "physics toy" to "looks like a flying animal."

Four regimes, one set of rules

The same three rules, with different weights and ranges, produce visibly different collective behaviours. Each preset above is a measured parameter set:

The 2008 Rome starling result

Everything above assumes a metric rule: "I pay attention to anyone within distance R." But that creates a problem — if the flock thins out, each bird sees fewer neighbours, so cohesion weakens, and the flock thins further. It should fall apart. Starling murmurations don't fall apart. Why?

An Italian team led by Andrea Cavagna and Irene Giardina took stereo photos of real starling flocks over Rome's Termini station between 2005 and 2008, reconstructed each bird's 3-D position, and asked: how many neighbours does each bird actually track? The answer was about seven — a fixed count, not a fixed distance. That's "topological" interaction. Switch it on in the Finer controls (the "Count neighbours, not distance" box) or load the Starling preset, and the flock holds together regardless of how spread out it is.

Try the Starling preset, then crank Boids down to 60. With a metric rule a thinning flock would fall apart; with the topological rule it stays coherent. One tiny change in the perception rule — a biological fact — rescues the model from an unphysical behaviour that nobody designed in.

Where boids actually went

The direct uses are the famous ones — the bats in Batman Returns (1992), the wildebeest stampede in The Lion King (1994), countless games and movies since. But the idea travelled further:

Related models

← Life & Local Majority All models →