Flocking Brilliant (fill in own joke here)

In my exploration of what unity3d does and how easy it can be to get things going I was about to set upon implementing the Craig Reynolds flocking code in the environment. I have done a fair few things related to using this flocking algorithm. Not all were published publicly, though I did about 4 years back create an organizational structure viewer where on selecting a person their related people would flock around them so that you could navigate through a organization based on relationships and drag flocks around.
The principle of the flocking code is very simple. Each individual in a flock has a motivation to aim for a destination, but to back from a collision with any other member of the flock. The code used is pretty much the same everywhere based on Craig originals. Flocking can provide some dynamic insight into relationships between objects, in particular when more than one flock, or the focus of the flock can be changed.
Before I set about my coding example I had a look around, and not surprisingly I found that the Unify community wiki had already done the work needed in both C# and JS.

Once set in motion the boids (as they are referred to everywhere) a cast out into the world. They then try and reach a point at the centre of the flock, never bumping into one another, as they get close they back off and then try again. An element of random direction provides an interesting display. Bear in mind these are simply acting under a simple rule, the path and shape of the flock is just emergent from those simple rules.

I have simply published a version of that on this page (it will do the plugin download for you) as you need to see the beauty in both the complexity and simplicity of movement.
As you can see a still just does not do it justice.
Flocking
So now I have this I can see what I can apply it to. (Flickr Flock of Photo maybe? )

2 thoughts on “Flocking Brilliant (fill in own joke here)

  1. Pingback: Life at the Feeding Edge » TronjiWorld - BBC virtual world for kids

  2. Pingback: Flocking algorithm in VastPark : The Park is Vast

Leave a Reply

Your email address will not be published. Required fields are marked *

P41Rf aT

Please type the text above:

This site uses Akismet to reduce spam. Learn how your comment data is processed.