A flock finds order: polarization from chaos

In 1987, Craig Reynolds wanted to animate flocks of birds without choreographing each one by hand. His idea — famous ever since under the name boids — came down to three rules that every bird, every boid, applies on its own, looking only at its immediate neighbours. No flight plan, no leader, no bird’s-eye view. And yet, on screen, the flock begins to turn, ripple, split and re-form like a real murmuration of starlings. This is LifeLabs’ sixth experiment, and it asks a simple question: how many local rules does it take for a “group” to appear where there was none? Reynolds’ answer — three — is checked here on the run sheet, reproducible from seed 42.

Three rules, no conductor

The code contains no notion of “flock”, “destination” or “decision”. There are 300 boids, each reduced to a position and a velocity on a torus (a world that wraps around on itself), and a single perception radius: every boid sees only the neighbours within 15 units. At each step, every boid combines three purely geometric urges, computed from those neighbours alone:

  • separation: steer away from neighbours that are too close, to avoid collisions;
  • alignment: turn its velocity towards the average velocity of its neighbours;
  • cohesion: head towards the centre of its neighbours, so as not to be left behind.

That is all. Three vectors, a weighted sum, a speed cap. No boid knows another’s trajectory beyond the present instant; none knows it belongs to a “flock”; none has memory, goal, or any capacity to learn. What we call a group is never written anywhere: it is a word we place, after the fact, on an alignment of vectors that happened to agree without ever talking to one another.

The proof isn’t in the picture, it’s in the curve

To measure order without trusting a pretty frame, we track the order parameter (or polarization): the norm of the mean velocity, once every velocity is rescaled to the same length. It is 0 when the headings point every which way (perfect chaos) and 1 when all boids stream in exactly the same direction (a perfectly aligned flock).

At the start, velocities are drawn at random: the order parameter reads 0.028 — near-total disorder. Then, step after step, the curve climbs. The path is nothing like a straight line: it first stalls around 0.05–0.10, hesitates, occasionally falls back, before taking off past the 300th step and hauling itself firmly into the 0.6–0.77 range. It settles, after 600 steps, at 0.669, a gain of +0.64. The 300 boids have sorted themselves into 6 distinct “groups” (num_clusters), each streaming along a common heading. The automatic classifier, blind to any intent, rules: flocked.

On the video, you can watch the two acts of the story. At the start, the boids are spread evenly across the plane, each pointing its own way — a shimmering scatter with no structure. At the end, they have condensed into a few dense, coherent clumps gliding as one, with wide voids opening around them. Nobody drew those flocks; they are the equilibrium point where alignment and cohesion finally won out over the initial randomness.

The control that rules out an artefact

A rising curve proves nothing on its own: perhaps the mere speed cap, or some bias in the simulation, would be enough to align the boids. To rule that out, we replay exactly the same run — same 300 boids, same seed, same 600 steps — but with the three weights set to zero. No separation, no alignment, no cohesion: the boids keep their initial velocity and never correct it. As a result, the order parameter stays at 0.019 from the first step to the last. It does not rise. So the climb seen in the real run comes neither from the speed clamp, nor from the torus, nor from any artefact: it comes from the three rules, and from them alone. This negative control is the guardrail that turns a nice animation into a result.

Emergence of another kind

LifeLabs has already shown two forms of emergence. With Lenia, it was a pattern: a creature of light sustaining itself in a continuous field, a stable form. With the evolving agents, it was a learned behaviour: a policy honed by trial and error, reward after reward. Boids belong to neither category. Here nothing freezes into a shape, and nothing is learned: there is no reward, no training, no parameter tuned by experience. This is an emergence of collective motion — a kinetic order that arises, frame by frame, from the sheer repetition of three local constraints over immediate neighbours. The “flock” is not an object nor a skill: it is a regime, a state of the swarm.

A word about vocabulary

The quotation marks have to stay. A boid has no intention of joining the group; it communicates with no one; it learns nothing from one flight to the next. “Flock” and “group” are our words, laid over repeated local geometry. What the run honestly demonstrates is at once more modest and more startling than collective intelligence: three instantaneous, purely local rules, with no central coordination and no memory, are enough for ordered motion to emerge from a perfectly random start. That is exactly the LifeLabs thread: global organisation that bubbles up from the local, with no one at the controls.

Try it yourself

The Boids demo runs entirely in your browser. Watch the swarm take shape before your eyes; push the alignment slider towards zero and the flock breaks apart into disordered dust; raise cohesion and the clumps tighten into compact balls; play with the perception radius to widen or shrink the “neighbourhood” each boid takes into account. Nothing is pre-recorded: it is the same local rule as above, recomputed on every frame.

Open the full run sheet for the exact parameters, or the Boids experiment page for context. Everything is reproducible from seed 42. Credit to Craig Reynolds, Flocks, Herds, and Schools: A Distributed Behavioral Model (1987).