Boids Simulation: How Flocking Works

Explore a flock whose collective motion comes from three local rules. Change the controls to compare separation, alignment, and cohesion, or move your mouse to influence nearby agents. This is a visual simulation of emergent behavior.

What are boids?

Boids is an artificial life program that simulates flocking behavior of birds and other creatures. The name 'boid' comes from 'bird-oid object'. The simulation demonstrates emergent behavior where complex group motion arises from simple rules followed by individual agents.

What are the three core rules of boids?

The three core rules are: 1) Separation - steer to avoid crowding local flockmates, 2) Alignment - steer towards the average heading of local flockmates, and 3) Cohesion - steer to move towards the average position (center of mass) of local flockmates.

How do I interact with the boids?

Move your mouse around the screen to interact with the boids. When your mouse is close to boids, they will be repelled. At medium distances, they will be attracted. The boids continuously follow their flocking rules while responding to your mouse movements.

What is emergent behavior?

Emergent behavior is when complex patterns arise from simple rules. In boids, individual agents follow basic rules, but the group exhibits sophisticated behaviors like flocking, splitting, and reuniting that weren't explicitly programmed.