Question

(This does not specifically relate to any language)

So I'm making a 2D game, and I was considering making a quadtree for my GUI manager (which is separate from checking collisions of the other parts of my game). Basically, the HUD needs to check for collisions from the mouse. However, when I finished my quadtree, I wasn't sure if I even needed it. I mean, I'm only going to have around 10 GUI elements on screen at once checking for mouse collisions; is it really more efficient to have a quadtree at that point? Or worse yet, is it worse to have the quadtree, as iterating through each leaf uses more computing power?

For my situation, what would be best? Brute force, or should I keep the tree to theoretically be able to handle near-infinite elements?

Was it helpful?

Solution

For me this would be no problem. As long as the quad-tree solution works well and with enough performance (on your 10 elements, and then on any number of objects), this would best to stick with it wherever it can be used.

Long story short, do not bother when what you already have can solve your exact problem without much hassle.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top