Jump to content
  • Advertisement
Sign in to follow this  

Best collision detection system for specific game type

This topic is 2956 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Respected Game Gurus,

I have another thread going which is talking about collision detection and response for a 2D game. I was just wondering if I am using the best suited algorith for the type of game I want to make.

I am going to be working on a 2d tile-based adventure/platformer, there will be sloped platforms which I will need to handle along with ladders, moving enemies, water,...

I am starting to think that AABB's would be a better choice than SAT, also I think that I would rather implement continuous rather than discrete collision detection (as I am having problems with discrete SAT at the moment).

Thanks guys,

Share this post

Link to post
Share on other sites
A very simple 2D algorithm is:

location1 // Each location has 4 values, x, y, width and height
if(location1.getX >= location2.getX) {
if(location1.getY >= location2.getY {
if(location1.getX + location1.Width < location2.getX + location2.getWidth) {
if(location1.getY + location1.Height < location2.getY + location2. height) {
// Collision!
return collision;

// If we get this far we didn't detect collision
// Run another check for ramps

This is great because its very simple overlapping collision. Which will work for most of your game. However you'll need to use another algorithm to check for slopes. This can be done if the first check fails to save on processing time.

Alternatively just make your slope into smaller "blocks" which use the method above.

See link below for an example of the box / overlap collision.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!