July 22, 2007
Global Synchronization Through Local Effects
After seeing Alexander Weber's microcontroller-simulated fireflies, and reading “Firefly Synchronization in Ad Hoc Networks”, I decided I was ready to learn Processing.
You can try the applet here. Let it run for at least several minutes.
The idea is that when one firefly sees another nearby firefly flash, it hurries up and flashes a little bit sooner than it would have otherwise. Pretty simple.
I didn't realize that lightning bugs even tried to synchronize their flashes, but this applet does remind me of some of the patterns I would see as a kid on midwestern summer nights.
Update: Uri Wilensky has a firefly synchronization applet, and it's practically in Lisp.
Update: Pretty much right after I posted this I realized the color was off, so there's a new version now with yellower flashes. And more realistic firefly movement.
Posted by jjwiseman at July 22, 2007 05:56 PM
Way cool, John.
I should be outside, looking at the real fireflies. Are there really none in LA? That seems a shame.
very well done.
It's a pity, that our fireflies in europe do not behave like that.
A few months ago I was living with a guy interested in synchronized oscillators, and made up this quick visualization:
Geeez, John, I tried this app it spitted "unsupported os/arch: freebsd/i386". What did you use? I mean c'mon it's java! it's meant to be portable! ;-)
When I view your applet (with Safari / Mac OS X 10.4.10) I am asked to grant it unrestricted access to my computer. After denying, it fails to load. Perhaps you could arrange so it does not make this unnecessary request? The error mentions "java.util.PropertyPermission user.home read". I've viewed other Processing-based applets without seeing this.
The non-portability comes from the fact that the applet uses OpenGL. I think that's also the reason that it requires you to accept the certificate from Sun--it needs to run some native code.
I love it! :) I wish I could get it to fill my whole screen so I could run it as a nightlight...