Here's a project that I dusted off: flocking algorithms, programmed in povray's SDL.
Here are the key components:
- A maximum value for the acceleration.
- A drag force where a component of acceleration is -0.3*log(speed)
- A mission or target position, with an acceleration component pointed in the direction of the target.
- A crowd or collision avoidance component of acceleration, where each particle experiences a repulsive force equal to the sum of: the vector from each other particle, divided by the distance of each pairing squared.