Re: Flocking in Non-Toroidal Space I’ve created a model of foraging over a gradient landscape that is bounded/flat, not a torus, and I found a workable solution.

Define your 2D space so that it has a “buffer zone” around the outside.  When ever one of your agents detects that it is in the “buffer zone”, it should activate a special set of navigation rules — maybe called “reversal” -- where it pivots around and returns on the same path (with a loop, or other curvature, or what ever seems natural).  You could also have a “reverse-through-reflection” algorithm where the agent returns to the main area on the same angle that it entered the buffer zone.  This would minimize edge effects, but not eliminate them completely.  Finally, you could have a “reverse erratically” where some random combinations of reversing maneuvers are tried until the agent is no longer in the “buffer zone”.

In these special algorithms, you’d have collision avoidance, but no other elements of your flocking algorithm.  

The advantage of this approach is that you use the normal flocking algorithms as long as agents are inside the main zone, and outside of the main zone you no longer attempt to do any flocking but instead focus on turning around.  This approach is consistent with “situated cognition”, by the way.

What you should see is normal flocking behavior within the main zone, and then some algorithm-specific behavior in the “buffer zone” as agents turn around and then re-flock.

Hope this helps.


On 8/24/13 7:07 PM, "Robert McCune" <[log in to unmask]">[log in to unmask]> wrote:


I am looking at flocking properties in MASON's Flockers implementation

I am interested in Flocking in a bounded, or Non-Toroidal, space.  I coded a wall avoidance vector that, once within an agents' neighborhood, repulses with the square inverse of the distance to the wall.  This negatively impacts flocking - there tend to be more, smaller flocks, and more agents not apart of a flock, because flocks break up when they hit the wall

Are there other ways to implement a bounded area, or wall avoidance?  Ways that reduce fragmentation or don't effect flocking?

Are Flockers and related BOIDS typically implemented in toroidal space for this very reason?

Thanks, Ryan