Hacker News new | ask | show | jobs
by Jach 5064 days ago
I'm reasonably sure that this used to be the case but hasn't for a good while. I know at some point Box2D used a sort-and-prune algorithm but they may have moved on to quadtrees or space-filling curves by now. You could also try Chipmunk which provides several collision recipes too, and may be faster for lots of similarly-sized objects. And you can always ignore either of them for collisions and take it as a learning experience to implement different algorithms yourself.

But you really need to just make it and see. Even a naive n^2 algorithm will be fine, for small values of n. If you have a lot of objects though you might even be forced into using a 3D engine and making the GPU do some work. Once you're in the process of making your game you'll be more aware of what specific optimizations you can make (such as sprite groups).