SPRITE / FLOCKING

PixiJS Flocking

220 boids rendered via PixiJS 8. Three red predators scatter the flock. Click or tap to spawn food. Tune every force with the sliders below.

BOIDS + PREDATORS

Each boid steers via three local rules: separation (avoid crowding), alignment (match heading), cohesion (flock center). Predators chase nearby boids — the flock splits and reforms. Spatial hashing keeps neighbor lookups O(n).

FOOD

Click or tap to drop food. Boids within range steer toward it. Food fades over 5 seconds. Max 8 active — oldest removed first. Crank Hunger to watch the flock abandon safety for food.

PixiJS 8 · WebGL renderer · Reduced motion: trails disabled, speeds halved. Toroidal wrapping — agents exiting one edge reappear on the opposite side.