Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a basic 2D particle system and I'm now looking to implement collisions, however I'm not sure on what the best way to do it is. My game is tile based and runs in XNA Game Studio 4.0. I've seen the platformer sample which has the player's collisions system working like this:

for(int x = leftTile; x <= rightTile; x++)
    for(int y = topTile; y <= bottomTile; y++)
        if(TileIsSolid(x, y))

But I don't know if this is feasible to run on 300 particles at one time, and it needs it support tiny fast moving objects such as bullets from a weapon. So how do I go about implementing 2D tile based particle collisions?

share|improve this question
Have you tried searching for this? There are a lot of resources both on this site and on search engines regarding how to implement 2D collisions including information on how to handle fast moving objects. – Richard Marskell - Drackir Aug 7 '12 at 18:29
You want to look up CCD Collision. – Vaughan Hilts Aug 7 '12 at 18:36
Yeah I've tried searching around but just couldn't find any particle or tiny object oriented collision detection sources. – MrPlosion1243 Aug 7 '12 at 19:13
up vote 0 down vote accepted

You still need to perform the checks.

There are several ways of doing this. You certainly don't want to go the dumb way, that is, checking each pair of objects in the scene. No, implement something called a quadtree. It's a space-partitioning algorithm that greatly increases the speed and efficiency of collision detection.

share|improve this answer
Wouldn't a simple grid work as well? Quadtrees work better if most objects aren't moving. – Sidar Aug 8 '12 at 2:20
It's tile-based! The tiles already are in a simple grid. You should be able to lookup just the tiles that a given object overlaps based on the world co-ordinates. Object-object collisions are a different matter and need their own broadphase, of course. – Tom Johnson Aug 8 '12 at 8:41
OK, then please be a bit more specific about what you want to achieve. Just particle-particle collisions? particle-object? – jcora Aug 8 '12 at 10:15
I want the particles to collide with the tiles. So particle-object. I will worry about particle-particle collisions later. – MrPlosion1243 Aug 8 '12 at 17:47

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.