Boids
Classic Steering Forces
Align Force
Separate Force
Cohere Force
Predator Interactions
Predators
Boid predator avoidance
Boids
The boids algorithm is an artificial life simulation discovered by Craig Reynolds that models the coordinated movements of animal groups like flocks of birds and schools of fish.
The movement of each individual "boid" is governed by a few simple rules. From these simple local rules emerges complex and organized behavior at the group level, making the boids algorithm a beautiful example of emergent complexity.
In this implementation you can play around with the range and magnitude of the steering forces and observe the impact on group behavior and boid survival.
The code is available here.
Steering Forces
There are 3 classic steering forces, to which I added a predator force as well. Here is a description of the classic forces from Craig Reynold's own site.