A swarm agent looks at all the other agents he can see and selects the closest ones to follow. He then averages the velocities of his selected neighbors and accelerates in that direction, with a little bit of randomness added.
neighborsToFollow = selectNeighbors(visibleAgents) adjustedAverageVelocity = averageVelocities(neighborsToFollow) * (1 - randomizationFactor) randomization = random direction * randomizationFactor acceleration = adjustedAverageVelocity + randomization
This really is the simplest algorithm that will produce "life-like" behavior. The agents move around in swarms, at least until a wall stops them. The sliders vary the behavior in many different ways.
Unchecking "Choose Neighbors by Proximity" will change the algorithm to select random neighbors to follow.