Simulation

Flocking Birds

A boids sketch where local steering rules, spatial lookup, and live tuning create convincing flock behavior in the browser.

JavaScript
p5.js
Simulation
Boids flocking simulation with many bird-like agents moving as a coordinated flock

Employer signal

What This Project Shows

This project shows that I can turn an algorithmic idea into an interactive system that stays readable while many independent agents are moving at once.

Problem

What Needed To Be Solved

A naive flocking simulation compares every boid with every other boid. That is easy to write, but it scales poorly and makes tuning feel random because performance noise hides the behavior of the rules.

Approach

How I Built The Solution

I kept the steering model explicit: separation, cohesion, and alignment are separate forces that can be inspected and weighted. For neighbor discovery, the sketch uses a quadtree query so each boid works with nearby agents instead of scanning the full population.

Outcome

What It Demonstrates

The result is a compact simulation that demonstrates agent-based modeling, performance-aware rendering, and the ability to make abstract rules understandable through motion.

Evidence From Source

Source signal

The old p5 source uses `qt.query(...)` for nearby boids and combines `cohesion_weight`, `alignment_weight`, and separation into each velocity update.

Engineering decision

Keeping the force terms visible makes this more useful than a black-box animation because the same structure can be tuned, debugged, or explained.