Boids, short for "bird-oids", are one of the first examples of artificial life, an attempt to describe the behavior of living things using only a handful of simple rules. An individual boid is not particularly interesting, but together, they can display complex flocking behavior.
Click to enter interactive mode
Esc to exit interactive mode
Move mouse: rotate camera
W/S: move camera forward/backward
A/D: move camera left/right
E/Q: move camera up/down
Hold shift: move camera faster
HOW IT WORKS
Despite being able to form large clusters, the boids themselves only follow three simple rules: alignment, separation, and cohesion. These rules were determined to best emulate the behavior of animals in nature, like a school of fish or a flock of birds.
This rule states that boids must always attempt to align their direction with that of their neighbors. If a boid is heading left while all of the boids near it are heading right, then our boid should steer right to join the rest of the group.
This rule states that boids must always move towards the center of their local flock. Cohesion ensures that boids form nice, uniform flocks, and that they will fill any holes that arise. However, if we just have this rule, boids will clump up into tight clusters, which is why we have...
This rule states that boids cannot get too close to their neighbors. While this rule is not as clear as the previous two, it's necessary to ensure that boids don't clump together, instead forming evenly spaced groups.
BRINGING IT ALL TOGETHER
Once we have these three rules, we can adjust their strengths to give us a total force applied on each boid. If we increase the separation strength, for example, boids will steer aggressively away from their neighbors, but if we relax the separation strength, they'll take their time to get there. The values chosen for this simulation work well, but they can be adjust with the slider in the top left (you may need to close this description).