Algorithms of bird flocking follow 3 simple rules: 1. Separation - avoid crowding neighbours 2. Alignment - Travel in the same direction as neighbours 3. Cohesion - Steer towards average position of neighbours There is a wiki on this: https://en.wikipedia.org/wiki/Flocking_(behavior)