Monday, October 8, 2012

Stigmergy models

Some mounths ago i've been working on some models of stigmergy,just to get confidence with the tools(processing) and the systems i'd have been working with, for my thesis.
The first model is basically based on a common flocking algorithm,but every agent perform flocking towards tail points, and not towards other agents.Here the diffusion of pheromone (like what happen in nature,see ants and termites) is simulated by range of vision of every agents, and pheromone decay by tail length (longer the tail,higer the probability of an agent to follow the others).
I implemented toxi pointoctree (thanks Tommaso Casucci),for optimisation of tail point search (long tails means bigger array of points---->kill framerate) and because i was interested in working with huge population of agents.Here a short video of the model:

stigmergic fibrous systems from Paolo Alborghetti on Vimeo.

The second model was based on the idea of using a vector field.The outcome was really simple and computationally lightweight.It was not stigmergy,but a kind of model of percolation.Here Every agent reads its future location and writes his speed in the field.I have to say that it's funny when you're trying something and you end up with something completely different.Here a short video of the model:

percolation 2 from Paolo Alborghetti on Vimeo.

The third model i've been working with,and was the one i've been working on the most,is based on a semplified version of the model of jeff jones based on chemotaxis (for the simulation of slime molds behavior).You can find more information here:
This code is based on a  pheromone field (field of values).Every cicle each agent deposits pheromone (like little farts...we can call it  "farting agent" ) and reads pheromone value correspondent to his future location (smell other agents farts).For more information about the model i suggest to take a look at the link above(nothing about farting in Jones papers obviously!!).
I have to say that this model is amazing!It is really lightweight,you can work with huge population and tuning parameters you can obtain a wide range of patterns.
Here a short video of the model (10000 agents,two different populations fighting for space occupation,each one eating the other one pheromone):

stigmergic networks_2 populations from Paolo Alborghetti on Vimeo.


  1. Hello Paolo, I'm also working on a similar script for my school project, but I have a hard time with the speed of the sketch...I'm using jose sanchez example of 2d stigmergy ...when I start to add more agents and higher resolution it's getting extremely slow...i was wondering if you can share this script? is my email
    Great work, by the way!

  2. hello Paolo, yes this is the right email:
    thank you