Home » Code, Headline, Multitouch and NUI, Software

Flocking around with AS3 and Multitouch

23 July 2009 1,908 views One Comment

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!

boids Flocking around with AS3 and Multitouch

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:

archive Flocking around with AS3 and Multitouch
Flocking Demo boids_src.zip Version: 1
124.0 KiB 235 Downloads Details...

Source code is included. The swf is inside the src folder.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

One Comment »

  • Naresh said:

    Yeah great to learn from you.

    I’ve a requirement of counting the number of impressions made on the screen.

    If say i packed a 100 rods of same diameter and made an impression on the screen is it possible for the software to count the number of rods which have touched the screen ???

    Thanks

Leave your response! Your thoughts are welcome.

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.