Original Post
I''ve been toying around with a side scrolling blasting the carp out of everything game, and I''ve been thinking about different methods of collision detections and trying to come up with a method that would be efficient for thousands of objects. Not because I really need thousands of objects, but I''d like it to be as efficient as possible.
Currently I have a routine that goes and updates all objects - ie move, and do any thinking or testing for player input. While going through this loop it seems that collision detection would be a pretty OK thing to be doing.
My question is, how to manage what objects are relevent to test collisions against. My current plan, is to divide the world/playing area up into different sections, each section represented by a list of objects in it. During the update routine, it''s determined what sector(s) an object should belong to for testing. After all objects are updated the sectors test for collisions within themselves to see what''s up.
Another idea I had was some kind of sorting method that would let objects know what ones are close to them. That way they''d test against what''s near them, and be able to stop at some range away from them. Of course, in a 2D world, managing this would be a little weird.
So I was curious about what other people do to solve this problem.