The Seven Neighbours
An explorable · starlings at dusk

The Seven Neighbours

A murmuration of thousands of starlings has no leader and no plan. Each bird watches about seven others. This flock runs live on the same simple rules. Change them and see what happens.

birds 0 each watches 7 alignment 0.00
tap the sky to send a falcon
Who a bird watches
View

Three rules, no leader

In 1987 the animator Craig Reynolds showed that you can get a convincing flock from three local rules, applied by every bird to the birds near it. He called his simulated birds “boids.” Nothing in the rules mentions the shape of the flock. The shape comes out of them.

The “alignment” number in the corner of the sky measures how well the whole flock agrees on a direction. At 0 the birds point every which way. At 1.00 every bird flies the same heading.

Which neighbours?

7Reynolds' boids reacted to every bird within a fixed distance. Real starlings don't seem to. In 2008 a team in Rome filmed flocks over the city's railway station with synchronized cameras and rebuilt each bird's position in 3-D. They found that a starling tracks a fixed number of neighbours, about six or seven, however near or far those birds are. Physicists call this a topological rule, as opposed to a metric one.

That difference matters most when the flock is stretched. With a distance rule, a bird at a thinning edge can end up with nobody inside its radius and fly off alone. With a count rule, it always has seven birds to follow, so the flock holds together as it thins, folds and pulses. That's the behaviour you see over a reed bed at dusk.

Try itPress Scatter with “nearest N birds” on, then do it again with “everyone within R” at a small radius. The first flock finds itself again. The second breaks into crumbs that never meet.
Try itTurn on One bird's view. The red bird is drawn with lines to the birds it is watching. Drag N down to 1 and the flock turns into follow-the-leader chains. Push it to 20 and the flock turns sluggish, like a crowd waiting for consensus.

Why the waves

When a falcon dives, only the birds closest to it see it. They swerve, the birds watching them swerve too, and the turn passes from neighbour to neighbour as a wave. Birds far from the falcon turn without ever seeing it. A 2010 follow-up from the same group found that in real flocks these correlations span the whole flock, however big it is.

Try itTap the sky. Watch the dark wave fan out from where you tapped.
Sources
  1. C. W. Reynolds, “Flocks, herds and schools: A distributed behavioral model,” SIGGRAPH ’87, Computer Graphics 21(4), 1987.
  2. M. Ballerini et al., “Interaction ruling animal collective behavior depends on topological rather than metric distance: evidence from a field study,” PNAS 105(4), 2008.
  3. A. Cavagna et al., “Scale-free correlations in starling flocks,” PNAS 107(26), 2010.

The simulation here is 2-D and simplified for the sake of a phone screen. Real starlings fly in three dimensions, and the 2008 study measured between six and seven neighbours, not exactly seven.