BoidsPlayground
Good things take a moment — worth the wait!

Watch how a school of fish organizes itself

Click "Radius spheres & distances" (in the panel at right) to see under the hood. Then play with the sliders to see how the schooling changes — with visual cues showing what's going on.

Click the ? button (upper right of the panel) for short descriptions of every slider.

The three rules

Every fish follows just three simple rules — and the schooling emerges on its own:

  • Separation — don't crowd your neighbors
  • Alignment — swim the way your neighbors swim
  • Cohesion — steer toward the group center

Try this

  • Crank Separation strength to max — watch them scatter
  • Drop Alignment strength to zero — the school falls apart
  • Max out Cohesion strength — they cluster into a tight ball

What the spheres show

With "Radius spheres & distances" checked, each sphere shows a fish's awareness range for the selected rule — that's all it can "see." The colored lines show which fish are listening to each other. Toggle between Separation, Alignment, and Cohesion spheres to see how each rule operates.

For a deeper dive, the About Boids page explains the algorithm in detail.

Boids Parameters
Sim speed 1.0 Speeds up the whole simulation uniformly. Parameter effects (schooling, separation, etc.) stay proportional — they just happen faster.
Separation radius 7.5 Fish closer than this push each other away. Raise it and fish give each other a wider berth.
Alignment radius 6.5 Fish within this distance try to match each other's heading. Larger = each fish listens to more of the school.
Cohesion radius 10.0 Fish within this distance steer toward the group center. A large value pulls distant stragglers back.
Separation strength 5.0 How hard fish push away from close neighbors. Higher = more spread out.
Alignment strength 1.5 How strongly fish match their neighbors' direction. High = tight, synchronized school.
Cohesion strength 1.2 How hard fish pull toward the group center. Raise to cluster more tightly.
Tang turn rate 4.0 How quickly blue tangs rotate toward their target heading. Higher = snappier turns.
Triggerfish turn rate 5.0 How quickly the triggerfish rotates along its path. Higher = hugs the curve more tightly.
Vertical damping 0.20 Reduces vertical acceleration. Lower = fish bob up and down more freely.
Distance damping 0.50 Reduces depth acceleration. Lower = fish scatter more toward/away from the camera.
Separation Too close — pushing each other apart Alignment Close enough to match each other's direction Cohesion Drifting apart — being pulled back in Triggerfish Tang is scared away by the triggerfish Spheres Each sphere shows a tang's radius for the selected rule below How close is too close — pair with the separation radius slider Heading-matching zone — the yellow arrow shows the school's average direction Group-pull zone — fish steer toward the center of neighbors in this radius