Bird Flocking
Browser-based simulation demonstrating emergent flocking behavior, referred to as "boids", with group of agents (birds) following a set of simple rules, resulting in complex, life-like flock movement patterns, using HTML, CSS (with Tailwind CSS for styling), and JavaScript for the logic and rendering on an HTML Canvas.
Bird flocking
Browser-based simulation demonstrating emergent flocking behavior, referred to as "boids", with group of agents (birds) following a set of simple rules, resulting in complex, life-like flock movement patterns, using HTML, CSS (with Tailwind CSS for styling), and JavaScript for the logic and rendering on an HTML Canvas.

How to run
Open bird-flocking.html
Mechanisms
- Separation: Steer to avoid crowding local flockmates. Birds calculate a repulsive force away from neighbors that are within the
avoidanceRadius
. The closer a neighbor, the stronger the repulsive force.
- Alignment: Steer towards the average heading (velocity) of local flockmates. Birds try to match the direction of their neighbors.
- Cohesion: Steer to move toward the average position (center of mass) of local flockmates. Birds try to stay close to the group.