All experiments
05SimulationPhysics

Boids / Flocking

Separation, alignment and cohesion — the classic flocking model. Add a predator and watch the shape of fear travel through the group.

Three rules, one flock.

Loading experiment…

What you are looking at

Craig Reynolds described boids in 1986 with three local rules: avoid crowding neighbours (separation), steer towards the average heading of neighbours (alignment), and move towards the average position of neighbours (cohesion). No bird knows about the flock. The flock is what the rules look like when a few hundred agents follow them at once. The predator adds a fourth, temporary rule: run away. Watch how a hole opens in the group and closes again behind it.

How to play

  1. 01Start with the defaults, then push separation up: the flock becomes a loose cloud.
  2. 02Lower cohesion and the group splits into tribes that never merge again.
  3. 03Drag the pointer through the flock to disturb it, and switch the predator on to see the wave of avoidance.