A mystery solved by watching neighbours, not the flock
A murmuration is the aerobatic display of thousands of European starlings at dusk, rolling and reshaping like a living fluid with no bird visibly in charge. Early guesses ranged from telepathy to a hidden leader signalling everyone else — the real answer, worked out in the 1980s, is far more elegant: each bird tracks only its nearest neighbours (field studies put the number at around seven, regardless of their distance) and obeys a handful of local rules. Global beauty emerges entirely from local information, with no bird ever seeing the shape of the flock as a whole.
The Boids algorithm: three steering rules
In 1986, computer graphics researcher Craig Reynolds built a program called Boids ("bird-oids") that reproduces flocking with just three steering rules applied to every individual, every frame: separation — steer away from neighbours that are too close, to avoid collisions; alignment — steer to match the average direction and speed of nearby boids; and cohesion — steer toward the average position of nearby boids, to stay together as a group. Reynolds's 1987 paper went on to win an Academy Scientific and Technical Award for its use animating crowds and creature swarms in Hollywood films — the same three rules reproduce flocking birds, schooling fish, and swarming insects.
separation_force += (p_self − p_j) / |p_self − p_j|² for each close neighbour j alignment_force = mean(v_neighbours) − v_self cohesion_force = mean(p_neighbours) − p_self velocity += w_sep·separation + w_ali·alignment + w_coh·cohesion (then clamp to max speed)
Emergence, and where else it shows up
Flocking is the textbook example of emergence: complex collective behaviour arising from simple individual rules with no central control, producing properties the flock has that no single bird possesses. The same pattern recurs everywhere — ant colonies solve shortest-path problems purely through pheromone trails, traffic jams form and dissolve as waves with no accident ever occurring, and consciousness itself emerges from billions of individually unconscious neurons. Beyond biology, Boids-style local rules now steer drone swarms that keep functioning even if a coordinator fails, warehouse robots (like Amazon's Kiva fleet) that navigate via emergent coordination, particle swarm optimisation algorithms used in engineering and machine learning, and agent-based traffic models where each simulated car follows simple local rules.
Frequently asked questions
What are the three rules of the Boids algorithm?
Craig Reynolds's 1986 Boids model uses separation (steer away from neighbours that are too close, to avoid collisions), alignment (steer to match the average direction and speed of nearby boids), and cohesion (steer toward the average position of nearby boids, to stay together as a group). Each bird only reacts to its own nearby neighbours — no bird sees the whole flock.
How many neighbours does a real starling actually track?
Field studies of starling murmurations found that each bird tracks roughly its seven nearest neighbours, regardless of their distance, rather than every bird within a fixed radius. This topological rather than metric interaction is what lets a murmuration hold together and respond as a coherent wave even as local density varies sharply.
What is emergence, and why is flocking a classic example?
Emergence is complex collective behaviour arising from simple individual rules with no central control — the flock as a whole displays properties, like coordinated rolling waves, that no single bird has or intends. The same phenomenon underlies ant colonies finding shortest paths, traffic jams forming without an accident, and brains producing consciousness from individually unconscious neurons.
Try it live
Everything above runs in your browser — open Bird Flock, tune separation, alignment and cohesion sliders, and watch a flock self-organise (or shatter into lonely birds) in real time. Nothing is installed, nothing is uploaded.
▶ Open Bird Flock simulation