Flocking

Three steering rules with no leader produce the coherent motion of a flock.

Animation of the Flocking model running in Stigmery

Introduction

Each bird steers by three local urges: avoid crowding nearby flockmates, align with their average heading, and steer toward their average position. None of them sees the whole flock, yet smooth, leaderless flocking motion emerges across the entire group.

Background

Craig Reynolds introduced the Boids model in 1987 to generate lifelike flocks for computer graphics. Its three rules, separation, alignment, and cohesion, became the standard account of how collective motion arises without central control, and have been reused everywhere from films to swarm robotics.

Reynolds, C. W. (1987). Flocks, herds and schools: A distributed behavioral model. Computer Graphics (SIGGRAPH '87), 21(4), 25-34.

How it works

  1. Each bird looks at the flockmates within its vision range.
  2. Separation: turn away from any that are too close.
  3. Alignment: turn toward the average heading of those neighbours.
  4. Cohesion: turn toward their average position.
  5. Combine the three turns, step forward, and repeat.

Parameters

population
How many birds share the world.
vision
How far each bird can sense flockmates. Wider vision binds the flock more tightly.
min_separation
The distance below which birds steer apart, preventing collisions and clumping.
max_align / cohere / separate_turn
Caps on how sharply each urge can turn a bird, which balances the three behaviours against each other.

Open this model in the editor →

Related models