Over a million developers have joined DZone.

Advection Swarm Chemistry with ActionScript Workers and the Feathers UI

DZone 's Guide to

Advection Swarm Chemistry with ActionScript Workers and the Feathers UI

· Web Dev Zone ·
Free Resource

Here's an extension to my recent implementation of Hiroki Sayama's Swarm Chemistry. I've plugged in a fluid dynamics solver (a worker used in my Reaction Diffusion Advection experiment) so that particles (swarm members) radiate heat and add to the CFD density field which then feeds back velocities to the swarm chemistry model.

The swarm genomes now have two new properties:

  • Temperature defines how much heat individual swarm members radiate (in this CFD implementation, temperature and density are synonymous).
  • Advectability defines how much individual swarm members are affected by the CFD velocity field. At zero, the swarm members aren't affected at all and at negative values, members accelerate in the opposite direction to the CFD velocity.

There's (obviously) a lot more movement with the advection buffeting the particles around, as you can see in this video:

Again, I've used ActionScript Workers to run several tasks simultaneously: there's one to solve the swarm chemistry model, one to solve the fluid dynamics and another to render the image. At any one time all three are running while the UI remains completely responsive.

The new application lives here and the source code is available here.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}