@aceslowman wrote:
I'm working right now on adapting Shiffman's flocking example (https://www.processing.org/examples/flocking.html) for openFrameworks. So far, the flocking itself works great, but I know there are ways to make the flocking much more efficient, but I'm not sure if I'm going about this correctly.
My idea right now is to create a flock grid system, in which a boid in the flock is only concerned about the location of nearby boids. Because a boid might inhabit a spot right next to the grid boundary, it will continue to look at all adjacent grid areas, but exclude distant ones. This will at least reduce the number of boids that each boid will need to check the location of.
My confusion, and possibly where I might be mislead, is how I'm doing this within vectors. Essentially, I'm creating a vector< vector >, with the first dimension being the grid id (for which I have a working formula for assigning an id), and the second for the individual boid. Will all of my efforts to reduce the number of checks actually increase the number of calculations? Every boid will now have to constantly tell the flock structure if it has or hasn't left it's grid location.
Does anyone have some advice on how I might approach this?
Posts: 1
Participants: 1