FreeSimulationNo signup

Boids Flocking Simulator

Three simple rules. Hundreds of agents. Mesmerizing emergent flocks.

Ready
Step 0 / 0
Agents: 0
Group AGroup BEmpty
10/s

Parameters

0.010
00.1
0.050
00.3
0.050
00.3

Tweak parameters, then press Reset to apply.

What you just saw

Each agent looks only at its immediate neighbors, adjusts its velocity according to three rules — stay close, don't collide, match heading — and yet hundreds of agents organize into a coherent flock. No leader, no global plan, no central control. The murmurations you see in starling videos follow exactly this logic.

The science behind it

Craig Reynolds published the boids algorithm in 1987 while working on computer graphics for SIGGRAPH. The three rules — cohesion, separation, alignment — became the template for swarm behavior in film VFX (including Lord of the Rings battle scenes) and robotics. The model is also the canonical example of emergence: complex collective behavior from trivial local rules.

Try these experiments

  1. 1. Classic flock

    Settings: cohesion=0.01 separation=0.05 alignment=0.05

    What to look for: Clean murmuration-style flocking.

  2. 2. No cohesion

    Settings: cohesion=0

    What to look for: The flock disperses. Agents still avoid each other, but they no longer cluster.

  3. 3. No separation

    Settings: separation=0

    What to look for: Agents collapse to a single point and stop moving usefully.

  4. 4. Max alignment

    Settings: alignment=0.3

    What to look for: All agents fly nearly parallel. Rigid, crystalline flock.

Sprint 1 scaffold. Full long-form article, references, and FAQ will land in the content sprints (3–6). The simulation above is already wired to the production worker.
SimLab

Run this at 100x scale

Boids flocking runs in your browser up to 1,000 agents. With SimLab, the same model runs on GPU at 100K+, with ensemble parameter sweeps and publication-ready output.

from scirouter import SciRouter
client = SciRouter(api_key="sk-sci-...")
result = client.simulation.run(
    model="boids",
    params={"num_agents": 100_000, "cohesion": 0.01,
            "separation": 0.05, "alignment": 0.05},
    steps=1000, seed=42,
)

Related simulations

Frequently asked questions

Why do boids look so natural?

Because real animals seem to use rules very close to Reynolds'. Local-only neighbor interactions explain a lot of biological swarm behavior, from fish schools to bird flocks to some insect swarms.

What is the perception radius?

The distance within which each boid sees its neighbors. Larger radius = more coherent, slower-turning flocks; smaller radius = more chaotic, responsive flocks.

Can I add a predator?

Not in this browser scaffold yet. The SimLab GPU version supports predator agents that boids flee from, plus obstacles, waypoints, and wind fields.