8,630 views 1 comments

Flocking around with AS3 and Multitouch

For a while I’ve been interested in emergent behavior where simple rules can create complex behavior. One of the most known examples of such behavior is Craig Reynolds ‘boids’ where a few simple rules can recreate the flocking behavior of birds.

I recently came across a great and clean example of some boids code by soulwire (make sure to check out his whole site; it’s great). Since we’ve seen various examples of this behavior on multitouch tables (like on the iBar), I decided to add some basic touch support to soulwire’s example. So, now we have it…multitouchable boids!

Right now, the demo only supports multitouch (TUIO), but mouse interaction can be easily added back in. I’ve purposely left this demo application fairly open and non-spectacular so that others can looks at the code and easily make simple changes that’ll drastically affect the results and interaction. I only spent about an hour adding in multitouch support and playing with various values, so there’s plenty more to experiment and add.

Currently there’s 3 buttons to change the behavior.

  1. The boids chasce eachother and move towards objects (fingers) close to them
  2. The boids wonder around randomly and move towards objects (fingers) close to them
  3. The boids chase eachother and flee objects (fingers) close to them

Documentation is included and provided by soulwire. Make sure to check out the original website by soulwire so you know the possibilities and can see a few more examples.

Please let me know what you think, any questions you have, and ideas that could help expand this example.

Download: [download id=”3908″ format=”2″]
Source code is included. The swf is inside the src folder.

Did you enjoy this post?

Comment Below , Follow Me on Twitter , Follow Me on Facebook , or Network with Me on Linkedin