AI flocking using Boids
By placing many more enemies in a game we begin to require some group-based AI. A popular algorithm used in both video games and films is the Boids algorithm. It simulates flocking behavior.
In this recipe, we will create a large number of enemies who flock together and chase the player.