Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

The title might be a bit misleading but I don't know what to call it exactly.

I have several objects that need to do certain collision checks ( like bullets hitting enemies but not the player).

I was thinking of making a "matrix" where objects are checkt against bullets. And each cell returns a true or false. Like so:

        B1  B2  B3 
ObjectX[0] [1] [1]
ObjectY[1] [0] [1]
ObjectZ[1] [0] [1]

Then in my collision loop I'd would do something like:


But in this situation the id order is critical. So far I've put all my objects in buckets depending on their position/section( 2D game). But this doesn't mean all of them are compatible to collide with each other nor is there a separation of objects depending on their types.

I was wondering if anyone could give me input or other methods I could go with to check whether objects should collide. Setting the matrix up could also be a lot of work. I wonder if some one knows a neat trick to automate it at runtime.

share|improve this question
My answer to another question might lead you in the right direction: gamedev.stackexchange.com/questions/32074/… –  Marton Jul 26 '12 at 8:14
Thanks for the reply. My system relies on complete aggregation. I don't implement interfaces to an object. It's component based. I already have my collection of objects that can collide. But now I need to create a clever way of colliding the rightobjects while ignoring others. –  Sidar Jul 26 '12 at 16:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.