Boids 3D
Craig Reynolds' boids algorithm in projected 3D space. Each agent follows three simple local rules — separation, alignment, cohesion — producing the emergent flocking behavior seen in birds and fish schools. Drag to rotate the view.
About this lab
Craig Reynolds introduced the "boids" model in 1987 to simulate the coordinated motion of bird flocks and fish schools. Despite its simplicity, the model produces remarkably lifelike behavior from three local rules applied independently to each agent: (1) Separation — steer away from nearby flockmates to avoid crowding; (2) Alignment — steer toward the average heading of nearby flockmates; (3) Cohesion — steer toward the average position of nearby flockmates.
No agent has global knowledge of the flock. Each boid only perceives its neighbors within a local radius and field of view, yet the collective behavior — swooping, splitting, and rejoining — emerges spontaneously. The order parameter shown here measures the alignment of velocities: it approaches 1 for perfectly aligned flight and 0 for random motion.
The 3D projection uses perspective division, with the viewing angle controllable by dragging. Depth is indicated by point size and brightness, giving a convincing sense of three-dimensional structure.