Predator-prey flocking
Craig Reynolds’ three flocking rules — separation, alignment, cohesion — produce beautiful collective behavior. But add a predator and something new emerges: the flock splits, scatters, and reforms. The predator creates a fourth force — flee — and the interplay between attraction and avoidance produces the dramatic dynamics seen in real prey schools and starling murmurations under hawk attack.
Reynolds rules
In 1987, Craig Reynolds introduced three steering behaviors that produce realistic flocking from purely local interactions. Separation steers away from nearby neighbors to avoid crowding. Alignment steers toward the average heading of neighbors. Cohesion steers toward the average position of neighbors. No individual knows about the flock as a whole.
The predator changes everything
Adding a predator introduces a fourth force: flee. When the predator approaches, nearby boids steer away from it, overriding normal flocking behavior. This creates the dramatic flock splits seen in nature — the “wave of agitation” that propagates faster than the predator itself. The flock divides, the predator passes through, and cohesion pulls the groups back together.
Emergent splitting
The splitting and reforming of the flock is not programmed — it emerges from the interaction between flee (pushing boids apart) and cohesion (pulling them together). The balance between predator speed and flock response determines whether the predator can isolate individuals from the group — exactly the strategy real predators employ.