A “dancing quadtree” based scene-graph
In thinking about how I want to manage my games, I’ve spent a bit of time mulling over the options for scene management. Specifically I want to handle collision detection efficiently, as most of my recent ideas start out with “what if we had a swarm of X”. I’d also like to have something useful to efficiently simulate an object interacting with neighboring objects.
One immediate idea is to base my scene graph on Quadtrees. These are relatively simple to implement (since they are two-dimensional binary trees) and would make scene subdivision easy. A quadtree could easily divide the scene up into whatever depth I want, and objects in the tree can discover their neighbors through simple tree traversal mechanisms.
The first problem I have with it is overloading. If I have fifty of item in one quadrant and relatively few in the rest I’m still not doing very well. Taking a page from Hans Reiser’s “Dancing Trees” algorithm I could provide a threshold mechanism so that quadrants rebuild themselves in various sizes after they become imbalanced. I’ll have to kick the idea around some more, and probably should just start with a relatively simple management system first and build up more complicated ones as I find I need them.
No commentsNo comments yet. Be the first.
Leave a reply