Boids Flocking — 3 Rules

Reynolds (1987): three simple local rules — separation, alignment, cohesion — produce life-like collective motion. Adjust each rule's weight to see its effect.

Separation radius Boid Fast
Count: 80
Separation: 1.5
Alignment: 1.0
Cohesion: 1.0
Vision: 80px
Speed: 2.0

Three Rules of Flocking

Separation: steer away from neighbors that are too close — avoid crowding.
Alignment: steer toward the average heading of nearby flock-mates.
Cohesion: steer toward the average position of nearby flock-mates.

No global coordination — each boid sees only neighbors within its vision radius. The torus wrapping ensures no edge effects. Try zeroing out rules one at a time to see their individual contributions. High alignment + low cohesion → parallel streams. High cohesion + low separation → tight balls.