Hi, I’m in the process of implementing a swarm algorithm and I am having difficulty getting my feedback loop to work…
The way my patch works is that :
random initial positions are passed to a 2d vector node
the position vectors are then fed to several different rules which are summed back in.
The output of this summing node is fed simultaneously to the renderer and back to the original vector node through a frame delay node…
The problem I am having is that the effect of the rules now just send the boids flying immediately off the screen! I am guessing this is a result of the feedback loop counting up towards infinity… How does one deal with this?
I tried multiplying the feedback by a factor < 1, but of course the boids all just ended up in the centre of the page!
I can upload my patch if you need to see it but its a bit of a mess :)
Any help would be much appreciated, I am tearing my hair out here!
Ok here you go! Its a bit hard to follow maybe… Its my first patch so more than likely some rookie error.
I have all the rules turned off at the moment, you can see the tabs to switch em on… I used attractors for maintain min distance apart and to keep boids together based on average position too…
edit : I have a feeling it could be to do with the attractors… Kind of functions with those rules turned off but looks jumpy…
hi si, you can have a look at this patch, epecially the ‘dt’ factor could help you.
here a few hints:
you should make subpatches (ctrl+shift+n), for the rules, with a defined interface for the in and outputs.
using the absolute value for the average velocity looks wrong, as all forces are directed, this will always result in an average force in the upper righ direction.
dont know why, but in vvvv polar and cartesian are not exectly the inverse of each other. in 2d you should use points2vector and vector2points.
Those vector2points & points2vector nodes have 4 inputs? Even if I put 0,0 in for x2,y2, there are still non-zero values outputted? That was why I was using the polar and cartesian nodes…