Flocking behavior simulation, plugin

Hi people,

i´ve noticed that it doesn´t exist any Flocking simulation plugin.

I found this code if anyone wants to implement it, for the moment it´s out of my limits.




Other interesting links



Old thread.

i have something on my harddisk. 2d and 3d, have to clean it up.


thanks a lot

try this. simple, 2d and still very unclean code

will try to fix this next days


Thanks a lot Milo, it looks nice.

i´ll check it asap.


code is cleaned. pls check out again & have fun.

Grazie mille

things to think about:

  • implement food sources
  • implement obstacles
  • implement predators

should be not that hard. maybe some day.

thanks lasal for bringing this up an milo for making it! just a bit confusing how/what to get on github. is it gonna be upped as contribution? 3d and those implementations? wicked!

Really like this one by Kyle Mcdonald !

@ sapo. you´re right. contributed. i just don´t like the “subversioning” via zip folders.
@ Joani. did i miss something or does this piece of code has anything todo with boids? maybe the wrong link?

@Milo: great piece of code,
thanks again.

@Sapo: yes it wasn´t easy to find ;)

1- would it be possible to have more control in the position or initial position of the agents or something like that?

2- Would it be possible configure the borders as a mirror?


hello milo! :)
i like your flock behaviour, finally a plugin for that!
looking into my old hard disk i found this old patch about flocking and thought it would be interesting to post for some considerations about this nice Boids plugin.
these are few things that come in mind:

  • when the amount of birds increase, it’s necessary to optimize the neighbour search, to avoid n^n iteration count.
    if you look into my patch you’ll find a module called ProximityDynamic. this module subdivides the occupied space (just the occupied minimum square space, that’s why “dynamic”) into a grid; then it checks, for every boid, wich are the neighbour boids that are in the same cell and in the surrounding ones. in this way the distance calculation it’s massively optimized.
    in general, i found this optimization useful for every particle symulation that requires interaction between particles. it would be nice to write a plugin that does the same, maybe further optimized (i’m shure it would be faster in code then in patch…)

  • I already spoke with other guys about the perfect way to integrate plugins into vvvv environment and i think it’s time for a dedicated…
    anyway i’ll right here my ideas related to this plugin.
    I think it would be nice to move the position cycle out from the plugin, so you can really integrate this behaviour in any particle system you build, allowing it to interact with other behaviours.
    the thing is simple:
    instead of having a boids plugin that outputs the xy space coordinates, there would be “xy Position” input and “xy Velocity” output.
    so you do in patch what you do now in code, taking last frame position (with a framedelay, as in every vvvv particle system), applying the Boids behaviour and adding the output to the cycle with a simple “+” node.
    this is related also at what lasal asked:
    you could reset position in the framedelay cycle and could also map the space in patch (with a map clamp in the cycle).
    in the end i think this is the best way to prepare things for vvvv behaviour systems, so they are not just autonome working cores, but you really can use them as modules and integrate them into much complex “particles” systems.

let me know what you think :)



…sorry for the long post ;)

Flocking.zip (14.1 kB)

Hi Dottore,

very useful patch and thanks for sharing it, it´s just what i was looking for.
waiting for new behaviours…

thanks again to both of you


my intent is not to replace milo’s plugin, it’s just to give ideas for improve it. i think the way is a well done plugin library.
what do you think milo about the suggestion of position input & velocity output for your plugin? does it make sense?

if your patch works very optimized… i can´t imaging those technics implemented in the milo´s plugin.

Hi vvvvs,
I’m allready working on a plugin for 3d Flocking behavior, based on Craig Rainolds contribution.

-> http://vimeo.com/25348020

This beta version allready works with Flocking (3 Rules of Flocking and a Target Madus) and Predators. I also want to implement multible Flocks, Landing and some 3d spartial Grid sorting (…because of peromance like dottore said). I think i will contribute it soon.

When the 3d version is working, it should be easy to downgrade to 2d.


Thanks PVC, great news!