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. Classic flock
Settings: cohesion=0.01 separation=0.05 alignment=0.05
What to look for: Clean murmuration-style flocking.
2. No cohesion
Settings: cohesion=0
What to look for: The flock disperses. Agents still avoid each other, but they no longer cluster.
3. No separation
Settings: separation=0
What to look for: Agents collapse to a single point and stop moving usefully.
4. Max alignment
Settings: alignment=0.3
What to look for: All agents fly nearly parallel. Rigid, crystalline flock.
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
Predator-Prey Simulator
Wolves hunt sheep, sheep eat grass. Tune reproduction and energy; watch the famous Lotka–Volterra oscillation emerge.
Sugarscape Wealth Simulator
The Epstein–Axtell economy. Heterogeneous agents harvest sugar under lookup rules; watch Pareto wealth distribution emerge.
Schelling Segregation Simulator
Watch neighborhoods self-segregate from mild individual preferences. Drag the tolerance slider and see the 1971 model come alive.
Conway's Game of Life
Conway's 1970 cellular automaton. Drop gliders, guns, and spaceships on the grid, or draw your own and watch them evolve.
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.