How should I choose quadtree depth?

Posted by Evpok on Game Development See other posts from Game Development or by Evpok
Published on 2014-06-10T22:24:15Z Indexed on 2014/06/11 15:44 UTC
Read the original article Hit count: 208

I'm using a quadtree to prune collision detection pairs in a 2d world. How should I choose to what depth said quadtree is calculated?

The world is made mostly of moving objects1, so the cost of dispatching the objects between the quadtree cells matters. What is the relationship between the gain from less collision checking and the loss from more dispatching? How can I strike a balance that performs optimally?


1 To be completely explicit, they are autonomous self-replicating cells competing for food sources. This is an attempt to show my pupils predator-prey dynamics and genetic evolution at work.

© Game Development or respective owner

Related posts about collision-detection

Related posts about optimization