pkulev / xoinvader

Python space game in terminal
http://mmap.me
MIT License
12 stars 1 forks source link

Improve collision detection #61

Open alex-eg opened 7 years ago

alex-eg commented 7 years ago

Current implementation is naïve -- it just checks all possible collisions between all possible objects, traversing the list of registered collision combinations and then objects of corresponding types.

This is complex in a cyclomatic way. Thus it needs to be improved. The idea is to make use of some logarithmic data structure, like BSP-tree or quadtree to divide objects and to decrease number of unnecessary checks, and to get rid of that horrible deep loop nesting.