Coral Reef School — 2D Boids & Current Lab
A top-down 2D companion to the 3D reef scene: the same boids rules — separation, alignment, cohesion — plus a directional current, predators and food, read as a clean overhead map with live schooling and alert-level readouts.
This 2D companion strips the reef scene down to an overhead view of the same boids mechanics driving the 3D version: each fish steers by three local rules — separation from crowded neighbors, alignment to the average heading within its neighbor radius, and cohesion toward the local flock center — layered under a steady directional current that pushes the whole school and drifts a field of plankton. Predators chase the nearest fish and scatter the school on approach; dropped food pulls nearby fish in and is consumed over time. A live readout panel tracks percentage of fish "in school" (from flock radius), average swim speed, how many fish are near food, and an alert level derived from the closest predator distance — the same signals the 3D version exposes, but readable at a glance without orbiting a camera.
2D top-down boids lab: separation/alignment/cohesion steering, a tunable directional current, chase-AI predators, clickable food, and a live schooling/speed/alert-level readout panel.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install