Science lab / collective motion

Boids: a flock made from local rules.

Add agents, draw obstacle walls, tune the behavioural weights, and watch a crowd become something that feels alive without a leader directing it.

Brief field note

Why a few rules can look like intention

Boids were introduced by Craig Reynolds in the 1980s as an artificial life model for flocking motion. The idea is intentionally modest: each agent only reacts to nearby neighbours, yet the group can form streams, clusters, waves, and sudden turns that look coordinated from a distance.

The classic version is built around three steering tendencies. Separation keeps agents from crowding each other. Alignment nudges each agent toward the average heading of nearby agents. Cohesion pulls an agent toward the local centre of mass. No agent understands the whole flock. The global behaviour appears because many small local adjustments keep feeding back into one another.

That makes Boids a useful way to think about emergence. It is a compact demonstration of how coordinated-looking group behaviour can arise without central command. In computer graphics and interactive simulations, Boids-inspired implementations often add rules for obstacle avoidance, goals, predators, terrain, or boundaries.

About this simulator

This version keeps the flock inside a bounded canvas, lets you draw obstacle walls, and lets you inject new agents while the simulation is running. Use the controls to push the flock toward tight schooling, loose wandering, obstacle-dodging streams, or chaotic swirls.

References

Article last reviewed for factual accuracy on 20 June 2026.

Deep instrument

Flocking workbench

Draw obstacle walls or add new agents directly into the simulation, then tune the local rules to see how the flock adapts.

The outlined agent exposes its perception ring, dashed separation range, neighbour links, local centre, and average heading.

Flock running

Under the hood

The Mathematics Used in This Simulation

This is an agent-based steering model. Each boid estimates local neighbours inside a perception radius, combines several desired steering vectors, caps the resulting force, and then advances its position.

Local steering

a = wsS + waA + wcC + woO

Separation points away from nearby neighbours, alignment points toward their average velocity, cohesion points toward their average position, and obstacle avoidance points away from the closest point on a wall segment.

Motion update

vt+1 = clamp(vt + a, vmax)

xt+1 = xt + vt+1Δt

The implementation caps steering by a maximum force proportional to speed, then caps velocity so high weights cannot accelerate agents without bound.

Assumptions and limits

Boids are visual agents, not aerodynamic animals. They have no mass, lift, drag, field of view, reaction delay, or energy budget. Boundaries bounce agents back into the canvas, and drawn walls use geometric proximity rather than physical contact.

Further mathematics