Flocking
Related terms: boids, separation, alignment, cohesion, crowds
The movement of a flock, a school of fish or a crowd, produced by three rules that each member follows using only its nearby neighbors. There is no leader and no plan.
Separation: do not crowd your neighbors. Alignment: head the same way they do. Cohesion: drift toward their center. The simulated members are called boids. A spatial grid keeps the neighbor search fast.