The Lab
Original — built for the Lab

Murmuration

Ever wondered how a flock of birds or a school of fish moves so perfectly in sync? Here a thousand starlings over a dusk skyline, or a thousand fish over a kelp bed, each follow three local rules and watch their seven nearest neighbours. Scatter them and order climbs from noise to one body that wheels together; send the falcon or the shark through it and the crowd splits, folds and closes behind you.

EmergenceBoidsCollective motionSchoolingCanvasSpatial hashing
After Craig Reynolds' boids, 1986, and the starling studies of the STARFLAG project in Rome, 2008
Loading demo…

On winter evenings over Rome, and over reed beds from Somerset to Denmark, hundreds of thousands of starlings gather before they roost and fly as one dark, shape-shifting cloud. It folds, stretches into ribbons, pours through itself and snaps back. Watching it, it is hard not to assume someone is in charge — a leader at the front, a signal passed along, a plan for the shape.

There is none. In 1986 the animator Craig Reynolds showed that three rules, applied by each bird to the birds around it, are enough: keep a little room, fly the way your neighbours fly, and stay close to them. He called his creatures boids. Twenty years later a team of physicists in Rome filmed real starlings in three dimensions and found a detail Reynolds could not have known: a starling does not react to every bird within some distance. It tracks about seven, near or far, however dense the flock. Seven birds out of a thousand is less than one percent of the flock, and no bird ever sees the shape it is part of.

That is what the numbers under the sky are for. The order tile is the length of the average heading: near zero when every bird points its own way, near one when the flock flies as a single arrow. Press Scatter and watch it climb while the neighbours tile stays at seven. The largest group tells you whether the birds have become one continuous body. Then switch the rules: Gas has no alignment and no cohesion and never organises; Swarm has cohesion but no alignment and becomes a churning ball that goes nowhere, like midges; Lockstep turns alignment up until the flock moves like a marching band.

Then be the falcon. Starlings answer a predator with the moves you can see here: a flash expansion, where the birds nearest the hawk scatter outward, and a wave of alarm that travels through the flock faster than any bird flies, because each bird only has to react to a neighbour that has already reacted. The same handful of local rules describes fish schools turning from a shark, sheep around a dog and crowds in a corridor. The shape belongs to nobody.

Switch the world to Fish and the same rules run under the sea. Sardines and anchovies school for the reason starlings flock: in a crowd of thousands, any one of them is hard to single out. When dolphins, sharks or diving birds drive a sardine school against the surface it packs into a bait ball, a dense, turning sphere that keeps reshaping as the attackers cut into it. The flash of a turning school is real too. A fish's silver flank works like a mirror, so when a whole school changes direction at once the light comes off it in one sheet, and the eye loses any single fish in the glare. And fish do not hold their place by sight alone. Along each side runs the lateral line, a row of pressure sensors that feels the water pushed by the fish beside it, which is how a school keeps its spacing in murky water and in the dark. Here the shark is the pointer: frightened fish flash silver, burst outward and swerve round it, then close up again behind it, the move biologists call the fountain effect.

Next in the Lab
Every Drawing Is CirclesOpen

Draw anything with one line, and watch a chain of spinning circles draw it back — usually with far fewer circles than you would guess.