5,000 Flocking Boids at 25fps+
in
Programming Questions
•
2 years ago
Hi,
I've been playing with Daniel Shiffman's code example "flocking" and wish to make the code more efficient so I can have 5,000 boids on a canvas of 1024*768 pixels running at 25fps.
Is this possible?
Code here: http://www.shiffman.net/itp/classes/nature/week06_s09/flocking/
I believe it's just the flocking that hits the framerate, having every boid checking every other boid to see if it's in close proximity to it. Currently, anything over 800 boids reduces the framerate to 20fps or less.
Would I need something like a quadtree to reduce the number of proximity checks a single boid has to do?
Many thanks in advance
I've been playing with Daniel Shiffman's code example "flocking" and wish to make the code more efficient so I can have 5,000 boids on a canvas of 1024*768 pixels running at 25fps.
Is this possible?
Code here: http://www.shiffman.net/itp/classes/nature/week06_s09/flocking/
I believe it's just the flocking that hits the framerate, having every boid checking every other boid to see if it's in close proximity to it. Currently, anything over 800 boids reduces the framerate to 20fps or less.
Would I need something like a quadtree to reduce the number of proximity checks a single boid has to do?
Many thanks in advance
1