Jump to content

  • Log In with Google      Sign In   
  • Create Account


Best way to do collision detection for a 2D Platformer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 lukadev0   Members   -  Reputation: 122

Like
0Likes
Like

Posted 20 April 2013 - 11:00 AM

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!

Sponsor:

#2 LJ_1102   Members   -  Reputation: 908

Like
1Likes
Like

Posted 20 April 2013 - 03:23 PM

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.


Jan F. Scheurer - CEO @ Xe-Development

Sign Up for Xe-EngineBeta

 


#3 lukadev0   Members   -  Reputation: 122

Like
0Likes
Like

Posted 20 April 2013 - 10:07 PM

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?



#4 LJ_1102   Members   -  Reputation: 908

Like
0Likes
Like

Posted 21 April 2013 - 08:41 AM

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.


Jan F. Scheurer - CEO @ Xe-Development

Sign Up for Xe-EngineBeta

 


#5 lukadev0   Members   -  Reputation: 122

Like
0Likes
Like

Posted 21 April 2013 - 10:05 AM

OK
Thak you LJ_1102,That was enlightning in some way
thanks a lot!



#6 Satharis   Members   -  Reputation: 949

Like
0Likes
Like

Posted 21 April 2013 - 10:16 PM

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.



#7 Khatharr   Crossbones+   -  Reputation: 2964

Like
0Likes
Like

Posted 22 April 2013 - 08:05 PM

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.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS