Home▸Nature & Climate▸Coral Reef Boids: 2D Fish-Schooling Simulation

Coral Reef Boids: 2D Fish-Schooling Simulation

A top-down coral reef where a school of fish follows classic boids rules — separation, alignment, cohesion — around drifting coral and rock scenery, with a shark predator and a click-to-attract current you can toggle live.

Nature & Climate2DEasy60 FPS📱 Mobile-adapted⇆ 3D version
2d-ocean-reef ↗ Open standalone

This 2D companion drives the same coral-reef fish flock as the 3D version through a top-down Canvas2D view: each fish steers by the classic boids rules — separation from close neighbours, alignment with nearby headings and cohesion toward the local group centre — while sliders let you tune the flock size and those three rules live, a shark predator scatters the school on approach, and clicking the water sets an attraction point the fish swim toward.

⚙ Under the hood

2D top-down boids flock (separation, alignment, cohesion) over a drifting coral-and-rock seafloor, with a shark predator and click-to-attract current.

boidsflockingcoral reefemergent behaviorpredator-prey

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)