Thread history

Fragment of a discussion from User talk:Voidious
Viewing a history listing
Jump to navigation Jump to search
Time User Activity Comment
No results

Thanks for the ideas! I love the kd-tree/sorted list one. I might have to go back and optimize it in the main game engine.

Voidious (talk)16:36, 15 August 2013

I'd say for that purpose r-trees are more suited than kd-trees, but yeah. From what I've heard, it's very much standard practice to use r-trees or other structures for collision detection in game engines where you have a very large number of entities/surfaces/etc which you may want to perform collision detection with.

With regards to 'other structures', so long as things are in a bounded size region and the density variation of objects is not too extreme, rather than a tree you'd probably get better results taking a very simple approach: Divide the area into a 2d grid, scaled so that you have a no more than a few entities in each cell, and in each cell store a list of entities which are within that cell. The only reasons to use a tree instead of a coarse array, is when the density of collidable objects/surfaces varies significantly between areas (i.e. you don't want lots of cells that are near-empty with other cells that have thousands of objects)

Rednaxela (talk)17:09, 15 August 2013