July 22, 2007
Global Synchronization Through Local Effects

firefly synchronization screenshot

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.

Posted by: will Fitzgerald on July 22, 2007 07:10 PM

Hi John,

very well done.
It's a pity, that our fireflies in europe do not behave like that.


Posted by: Alex on July 23, 2007 12:09 AM

A few months ago I was living with a guy interested in synchronized oscillators, and made up this quick visualization:


It doesn't take displacement into account, but it's still kind of neat... and it's entirely in JavaScript.

Posted by: Mike Purvis on July 23, 2007 06:32 AM

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! ;-)

Posted by: yen on July 23, 2007 03:56 PM

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.

Posted by: Kevin Reid on July 23, 2007 07:41 PM

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.

Posted by: John Wiseman on July 24, 2007 09:42 AM

I love it! :) I wish I could get it to fill my whole screen so I could run it as a nightlight...

Posted by: Julie on December 17, 2007 12:20 AM
Post a comment

Email Address:


Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)


Remember info?