Swarms really fascinate me. You see pigeons forming patterns. Fish schools swim in cohesive patterns. There are some types of birds, in massive numbers, that appear like swirling smoke from a distance. Each one of these spectacles is an amazing sight.
The underpinning of the behavior is surprisingly simple.
One of the models is depicted in this boids. It uses three simple rules to create a more wholistic interesting behavior. The rules, in brief, are: Seperation, Cohesion, Alignment.
However this is not the only way swarms can be created. In my model, based on basic particle physics (nothing fancy), I have Attraction, Seperation, Rotation.
The area of effect for attraction is the greatest one, however its maximum amplitude is much less than that of the seperation effect. This creates an interesting interaction pattern that includes soft collision.
The area of effect for rotation has been tweaked (and I have been very lucky with the results) and is in practice half way between the seperation and attraction.
Each of these effects act in a pair wise manner. The end result is that the particles group into clusters and rotate approximately around each center of a cluster that are rotating counter-clockwise. On occasion, the clusters will exchange particles, creating a channel. In other cases, a big cluster will seperate into two clusters while a channel thins down.