Real Life Swarms
I just saw this on Youtube, it’s a video of 500,000 bats flying out of a cave filmed in infrared. It really reminds me of the Boids swarming app I wrote, especially how the bats will zig-zag as they fly.
I just saw this on Youtube, it’s a video of 500,000 bats flying out of a cave filmed in infrared. It really reminds me of the Boids swarming app I wrote, especially how the bats will zig-zag as they fly.
I was recently invited to participate in FXpression 09. A flash contest on kirupa.com. The contest rules state that all entries must be composed entirely of circles.
I entered a modified version of my swarm code. See it in all it’s glory after the break.
I’m still working on the flocking code I blogged about earlier.
I wanted to get more flock objects on screen. But my nearest neighbour detection code was VERY SLOW. In the old version each flock object would do a closest neighbor check by for looping through EVERY OTHER ENTITY on screen. The number of calculations would increase exponentially as the number of flock entities increased. This set a limit of about 200 entities before things started to slow down.
So I decided to add a broad level distance detection level. My first attempt got me up to about 700, before things started to slow down. Which was not bad but I was sure I could do better. At this point my friend William stepped in and essentially re-wrote my code 3 times over (William is a math major, and a super smart guy). One of his broad hit level schemes let me get up to 2000 entites on screen at once (on my home computer). The version I posted here shows 1200.
See the mega swarm in action after the break.
Hey guys, I made a prettier version of the Swarm app I posted yesterday.
Check it out after the break.
Recently I watched a video on Ted.com. In the video Steven Strogatz talks about sync, in one segment he speaks about flocking behavior and lists the three simple rules that govern flocking. Later I found that this type of artificial flocking behaviour can be referred to as ‘Boids‘.
So yeah… I decided to code it up in Flash ActionScript 3.0.
The image on the left doesn’t really do the app justice.
Click more to see the app in action.