Signal and Sensation

Murmuration

Three hundred birds, three local rules, no leader, and the order they reach is deliberately imperfect.

Open fullscreen →

What it is

Three hundred and twenty boids in a sphere of air. Drag to orbit. Each one only knows about its close neighbours and follows three rules: don’t crowd them, point roughly where they point, drift towards the middle of them.

Two buttons turn the interesting knobs.

How it works

There’s no leader and no target direction anywhere in the code. Whatever direction the flock ends up travelling is one it invented.

Flocking is measurable rather than impressionistic. Polarisation, the length of the mean unit velocity, is 0 when everything points in different directions and 1 when everything points the same way. It’s on screen as order, and it starts near zero and climbs.

What surprised me

Twice, and the second one changed the design.

First, my initial rule weights barely flocked at all. Polarisation crawled from 0.15 to 0.26. I’d assumed alignment strength was a matter of taste and picked 1.0. Doubling it to 2.0 took the flock to about 0.4.

So the parameter I’d have tuned by eye turned out to be the difference between flocking and milling about, and the test caught it because it asserted a number rather than looking at a picture.

Second, and better: I couldn’t get polarisation near 1.0 while the model stayed local. Tightening every weight made no real difference. What did work was widening the interaction radius until every boid could see every other, at which point it hits 0.99 and looks completely dead. A rigid block sliding through space.

That reframes the whole thing. Perfect order isn’t the goal local rules are failing to reach, perfect order is what you get when you accidentally stop being local.

Real order in a flock has to travel outward neighbour by neighbour, so it never arrives everywhere at once, and the incompleteness is the murmuration. Domains that align with each other and swirl against their neighbours. Settling at 0.4 is the feature.

Both are tests now. Alignment off gives 0.017 while alignment on gives 0.4, and a global interaction radius gives over 0.95 while the local one stays under 0.8.

What I would do next

A predator to dive through it, since the famous shapes come from being hunted.