Boids is a computer model of coordinated animal motion such as bird flocks and fish schools.
The algorithm itself is simple. The flock is modeled as a group of individuals, and the behavior of each individual "boid" is governed by three rules:
- Separation: steer to avoid crowding local flockmates
- Alignment: steer towards the average heading of local flockmates
- Cohesion: steer to move toward the average position of local flockmates
These rules are applied independently to each boid, such that there is no assigned leader.
Some useful resources for implementation:
- Craig Reynold's boids page is the canonical reference, and contains links to many implementations and articles discussing uses of the algorithm.
- Boids pseudocode gives an overview of the basic algorithm and various tweaks to model effects like wind, targeting and scattering.