Awhile ago I read the novel Prey. Even though it is definitely in the realm of fun science fiction, it piqued my interest in swarm/flock AI. I\'ve been seeing some examples of
there are a few techniques that you may want to read up on:
Also: The wiki page isn't a bad start.
What you're asking for is actually much more simple than you think. The canonical source is http://www.red3d.com/cwr/boids/.