Murmuration
How it works
What is a murmuration?
A murmuration is a great flock of starlings that swirls in the sky at dusk, just before the birds settle down to sleep. The name comes from murmur, a low, soft sound: the hum of many thousand wings. No bird leads. Each bird only watches the few birds next to it. The shape you see comes from all those small choices added up.
Three rules
I use boids, a way to make flocks that Craig Reynolds wrote down in 1987. Many times each second, every bird looks at its nearest neighbours and does three things:
- Keep apart (Separation). If a bird is too close, turn away from it. Personal space sets how close is too close.
- Line up (Alignment). Turn to fly the same way as the neighbours.
- Keep together (Cohesion). Steer toward the middle of the neighbours.
Each slider sets how hard a bird heeds that rule. Too much “keep apart” and the flock breaks into dust. Too much “keep together” and it sinks into a tight ball.
Seven neighbours, not a set distance
In 2008, a team in Rome filmed real starlings in 3D. They found that each bird keeps track of about six or seven of its nearest birds, however near or far those birds are. So here each bird follows its closest few (Neighbours), as long as they are within Reach. That is why a thin flock still holds together.
Birds also care more about birds at their own height. Vertical awareness makes a bird above or below seem further away, which flattens the flock into sheets and ribbons.
How hard a bird can turn
A bird can only turn so hard in one moment. When the rules, the wind and the walls all pull at once, I add their pulls and cut the sum down to that limit (Agility). Low agility gives wide, slow arcs. Birds also try to hold their Cruise speed, so they turn rather than brake, and a crowd passes through the flock as a wave.
Why the hawk makes waves
Birds near the hawk flee hard. Their neighbours see them turn and turn too, then the neighbours of those birds, and so on. The turn passes from bird to bird like a ripple on water. That ripple is the dark band that sweeps through the flock. Without a threat, real flocks drift more calmly, so the hawk is the main way to bring out the shape.
The other pushes
- Wind is a slow, shifting air current over the whole box.
- Roost pull draws birds toward a sleeping spot that slowly moves, so the flock circles instead of drifting off.
- Wander gives each bird a small, steady wobble, so a calm flock still shimmers.
- Walls push birds back well before they reach the edge of the box.
- Your pointer scares nearby birds, a bit like a small hawk.
“Heading order”
The number under the sky tells how much the birds agree on where to go. Take every bird's heading as an arrow of length one, add all the arrows, and divide by the number of birds. 100% means they all fly the same way. Near 0% means they fly every which way.
Keeping it fast
With 2,000 birds, checking every bird against every other bird is 4 million checks, many times a second. Instead, I cut the box into small cubes and sort the birds into them. Each bird then only looks in the cubes around it, and skips any cube too far off to hold a nearer bird. That is why a few thousand birds still run smoothly.
Where it falls short
Real starlings see with eyes that have blind spots, and they do not know exact distances. They flap, glide and tire. This model has none of that. It shows how simple local rules can make the look of a murmuration, not how a starling's mind works.