Live swarm lab

Flocking Simulator

How do starlings, fish and bees move as one without a leader? Each animal follows three simple rules — keep some space, match your neighbours' direction, stay close to the group — and a flock appears. Tune the rules live, add hawks or a shark, and measure how ordered the swarm becomes.

ANIMALS0
ORDER0%
GROUPS0

How ordered is the flock?

100% = all fly the same way
SeparationDon't crowd your neighbours.
AlignmentFly the same way as your neighbours.
CohesionMove toward the centre of your neighbours.

Use the sliders under the sky to change the three rules live. Hold the mouse to attract or scare. Space play/pause · F full screen

How the simulation works
  1. Each animal looks at neighbours inside its vision radius and field of view (behind it is a blind spot).
  2. Separation steers away from neighbours that are too close, alignment steers toward their average direction and cohesion steers toward their average position. The three are added with your weights.
  3. Animals flee predators they notice. Predators chase the nearest animal they can see and catch it on contact.
  4. Order (polarization) is the length of the average heading: 0% means everyone points a different way, 100% means all move in the same direction. Groups are clusters of at least three animals within reach of each other.

Based on Craig Reynolds' classic "boids" model (1986). Everything runs in your browser.

Using Flocking Simulator

See how flocks of birds, schools of fish and swarms of bees form without a leader. Every animal follows three local rules — separation, alignment and cohesion — and the group behaviour emerges. Tune the rules live and add predators.

  1. Press Play: scattered birds soon join into flocks that fly in the same direction.
  2. Move the Space, Align and Group sliders under the sky to change the three rules while it runs.
  3. Use the tools: hold to attract or scare the flock, click to add animals, a predator or an obstacle.
  4. Try the examples: starling murmuration, fish school with a shark, hawk attack, insect swarm, no rules, narrow vision.
  5. Follow order, number of groups and spacing in Charts, and download the data as CSV.

Example

Classic flock: order rises from about 5% (random) to over 90% as groups merge into one flowing flock.
No rules: with all three rules at zero, no flock forms and order stays near 0%.

Questions & answers

What are boids?

Boids ("bird-oids") are simulated animals from Craig Reynolds' 1986 model. Each one only reacts to nearby neighbours using separation, alignment and cohesion, yet realistic flocks appear.

What do the three rules do?

Separation keeps animals from crowding, alignment makes them fly the same way as their neighbours and cohesion pulls them toward the group's centre. Change their weights to see what each one does.

What does Order mean?

Order (polarization) is the length of the average direction of all animals: 0% means random directions, 100% means everyone moves exactly the same way.

How do predators work?

Predators chase the nearest animal they can see and catch it on contact. Animals that notice a predator flee faster, which splits and reshapes the flock.

Why do real starlings form murmurations?

Each starling tracks about seven neighbours. Fast, local copying of direction lets waves of turning spread through thousands of birds, especially when a falcon attacks.

Can I use it for experiments?

Yes. Runs are repeatable with a seed, all parameters are adjustable and you can export order, groups, spacing and catches as CSV.

Does it run on my device only?

Yes. Everything runs in your browser.

Help improve this tool

Report a problem or suggest an improvement

Describe the issue without pasting private tool input. Feedback goes to our admin inbox.

Find another tool · Read practical guides