- Explore separation, alignment and cohesion in a repeatable two-dimensional boids simulator.
- Inspect local perception, compare matched starts and disturb the flow with soft repellers.
- Share the applied rules and recorded input timeline, or save a labelled flock card.
- Nobody Leads, Everybody Reacts
- Three Priorities Shape the Crowd
- Local Really Means Local
- Opposite Edges Are Neighbours Too
- Be the Disturbance
- Compare the Same Beginning
- A Global Score Cannot Count Flocks
- Model Seconds Are Animation Units
- Share a Replay With Its Inputs
- Keep a Picture of the Collective Pattern
- What This Boids Simulator Leaves Out
- More Worlds Made From Local Rules
A flock turns, stretches and gathers without a bird issuing instructions to the entire group. A surprisingly simple animation model can produce a similar collective pattern from local reactions.
ContentBASE Flocking Lab is an interactive boids simulator inspired by Craig Reynolds’s classic work. Change three steering priorities, inspect one agent’s neighbourhood and place a disturbance in the flock’s path.
Flocking Lab
Explore local boid steering rules, inspect a neighbourhood and replay recorded disturbances in a seeded flock.
Loading Flocking Lab… Enable JavaScript to explore.
Start with free Canva bundles
Browse the freebies page to claim ready-to-use Canva bundles, then get 25% off your first premium bundle after you sign up.
Free to claim. Canva-ready. Instant access.
1. Nobody Leads, Everybody Reacts
The default scene starts with 200 invented agents, called boids, at seeded positions with different headings. Each agent sees only a local neighbourhood when choosing its steering response.
There is no global destination, leader or pre-drawn flock path. The moving pattern develops from repeated local updates.
The initial animation runs automatically unless your device requests reduced motion or you opened a shared replay. Those cases start paused. Use Play, Pause or +5 model seconds to explore deliberately.

2. Three Priorities Shape the Crowd
The steering controls give different weights to three ideas:
- Separation: turn away from nearby crowding.
- Alignment: steer towards the motion of local neighbours.
- Cohesion: steer towards the local group’s position.
The weights are relative animation-rule multipliers, not measured biological traits. The lab combines their steering vectors, adds any repeller influence and limits the resulting acceleration and speed.
This is an independently implemented two-dimensional variant. Reynolds’s original work involved a richer three-dimensional model, so the tool documents its own choices rather than claiming an exact reconstruction of every historical rule.
3. Local Really Means Local
The neighbourhood radius controls how far each boid looks. It sees other agents within that distance in all directions, excluding itself.
Enable Show one local neighbourhood and select an observer. The observed boid becomes white; its current neighbours become amber. The ring shows the selected perception radius.
That local view helps explain why several groups can emerge and why an individual’s steering need not match a global average. The agent does not consult the alignment percentage printed above the scene.
The mean-neighbour counter describes the previous completed update. The observer’s caption describes the current visible configuration. Those measurements can differ as the flock moves.
4. Opposite Edges Are Neighbours Too
The world is a finite 900×600 rectangle with joined opposite edges. Boids leaving the right side reappear at the left; the same applies to top and bottom.
Perception, cohesion and repeller distance use the shortest wrapped displacement. Two agents close across an edge can therefore influence each other without trying to travel through the centre of the picture.
The display breaks motion trails at a wrap, avoiding a misleading line across the entire world. The perception ring and repeller influence can also appear on both sides of a joined boundary.
5. Be the Disturbance
Enable Click the scene to place a repeller, then select a location. You can also enter world coordinates and choose Place repeller there.
A repeller adds a local avoidance force that declines with distance. It is a soft steering influence: agents can pass through its region, and it does not represent an impenetrable obstacle or a predator that consumes boids.
At most four repellers are active. Adding another replaces the oldest, while Clear repellers removes the current set.
Every add or clear input is recorded at the displayed model tick. A shared run can therefore reproduce the disturbance at the same stage of the model’s evolution, rather than merely starting with a vaguely similar picture.
6. Compare the Same Beginning
Compare five seeds runs five fresh flocks for 20 model seconds using the applied steering rules, count and radius, without repellers. Compare the final heading alignment and mean neighbours in the table. The reported range and median describe those chosen starts; they are not a confidence interval or a count of flocks. Your current run and recorded disturbances are kept separate.
The four steering presets keep the current count, radius and seed, clear recorded disturbances and open paused:
- Find the flock: balance separation, alignment and cohesion.
- No social steering: set all three weights to zero. Without repellers, agents travel straight and wrap around the world.
- Crowd together: remove separation while giving cohesion more weight.
- Give me room: strengthen separation and reduce cohesion.
These comparisons reveal how much depends on the rule mixture. More of one steering term is not automatically a better or more realistic flock.
Changes to the sliders, radius, count or seed are staged. Start fresh run applies them and clears the input timeline. New seed & start changes the initial arrangement as well.
7. A Global Score Cannot Count Flocks
Global heading alignment measures the magnitude of the average unit heading vector. It approaches 100% when every agent points the same way.
Two well-organised groups moving in opposite directions can cancel in that average and produce a low score. A low global value therefore does not prove that all local motion is disorganised.
The graph samples this score every half model second. The current counter uses the visible state. Neither measurement counts distinct flocks, evaluates animal intelligence or measures the health of a real population.
Colour by heading is another visual aid. Its hues represent directions, not different species or permanent teams. The triangular symbols show direction even when colours are difficult to distinguish.
8. Model Seconds Are Animation Units
The engine updates at a fixed 1/60 model second. Each update reads the previous positions and velocities for every agent, then applies their changes together.
The displayed world units and model seconds are invented animation units. They are not calibrated metres or measured seconds of actual bird flight.
Playback speed changes how much model time passes per real second. It does not change the steering time step. Each run stops at 120 model seconds.
The clock includes time spent in background tabs. Throttled or suspended execution catches up through bounded batches, calculating the missing updates rather than silently skipping them. On slower hardware, a catch-up status can appear.
A deliberate pause remains paused after you return. Reduced-motion devices start paused and use less frequent visual updates when you choose to play.
9. Share a Replay With Its Inputs
Copy run link stores the applied steering weights, count, radius, seed, speed and recorded repeller timeline. The link opens paused at model time zero.
Choose Play to replay the same inputs when their recorded times arrive. Replay same run does the same locally, while Start fresh run clears the timeline.
The replay holds up to 32 recorded inputs. That keeps links and experiments bounded. The interface reports the active repellers, recorded count and next scheduled replay input.
Observation, heading-colour and trail settings affect only the view and are omitted from the replay recipe. Tiny numerical differences between platforms can affect much later details, so a link preserves the experiment’s rules and inputs without promising bit-identical trajectories everywhere.
10. Keep a Picture of the Collective Pattern
Preview or save a 1500×1000 flock card showing the current scene, model time, heading alignment, steering weights, seed and recorded-input count.
Use motion trails to make the recent flow visible in a still image. Save the card for the pattern, and include its run link when you want someone else to explore the disturbance.
Simulation, replay-link creation and image rendering happen locally. This tool does not upload the flock or its input timeline.
11. What This Boids Simulator Leaves Out
There is no measured bird biology, reproduction, predation or physical collision handling. Separation is a steering preference, rather than a guarantee that drawn triangles never overlap.
The model uses a full-circle local neighbourhood, periodic boundaries and a weighted steering combination. Those choices differ from other boids implementations and can change the resulting motion.
The useful experiment is to connect a stated local rule to a visible collective outcome, then change one thing and see what follows.
12. More Worlds Made From Local Rules
Explore local preferences without continuous flight in Neighbourhood Lab, brake a single car in Traffic Jam Lab, or watch concentration fields develop in Reaction–Diffusion Lab.
Browse ContentBASE Tools for more interactive simulations, revived classics and original experiments.