• Advertisement
Sign in to follow this  

Best way to do collision detection for a 2D Platformer

This topic is 1733 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

Hi everybody..
I have a question:What's the best method to perform collision detection & response in a 2D platformer?
There's AABB,Polygon intersection,ray casting (used in sonic),the collision points(that surround the player),..
when I say best I mean the approach that gives you the most possibilities..I know this is very game dependant,let's say that I want to make a braid-like style of game, where platform physics just feel natural (sonic too) and where the platforming isn't the core gameplay!

Share this post


Link to post
Share on other sites
Advertisement

I recently stumbled across this gem that explains collision techniques and physics like simulation.

There are a lot of cool interactive flash examples to help understanding the concepts.

Maybe this helps you.

Share this post


Link to post
Share on other sites

Ok,Thank you..This helps!

But what I'm asking here is a comparison between the different techniques..

For example the ray casting technique gives you more awarness of what's happening around the player than the AABB technique.

What's the best method to implement 2d platformer games collision detection & response?

Share this post


Link to post
Share on other sites

There isnt the one and only technique to do "most aware" collision.

It highly depends on what is needed. If you need your character to know that hes falling into oblivion you'll have a ray beneath him.

Also you will propably need a bounding box for the actual/current collision with the level etc.

 

So the best method is to have a set of bounding primitives that you can use in the appropriate cases.

Share this post


Link to post
Share on other sites

Generally the rule is "simpler is better" more complex methods of collision detection than simple AABB type ones tend to either cost development time or CPU time(or both!) Which method you use really goes down to the specifics of your game. If you look at a game like original pong(square boxes bouncing against other square boxes at a relatively sane speed) collision detection can be very simple. If you're doing a complex platformer game with spike balls bouncing off trampolines and flying into breakable walls then you might need to adjust to something more heavy duty.

Share this post


Link to post
Share on other sites

The Metanet article really is one of the best primers on collision detection you're likely to come across. Even if you don't understand some of the more advanced techniques they discuss it will give you an overview that helps to shape your thinking about collision.

Share this post


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

  • Advertisement