you might want to take a look at this https://github.com/colinbdclark/Flocking