Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2D Platformer ground collision? (Height based)?

Author
Message
ionstream
22
Years of Service
User Offline
Joined: 4th Jul 2004
Location: Overweb
Posted: 25th Nov 2005 07:39
I've decided to go retro and make a 2D side scroller like Sonic, megaman, or Mario. Already i'm having problems with the collision of the ground. All of the examples (that I could find) show collision for 2D RPGs, so I am asking for alittle help.

I was thinking along the lines of a height based system, by finding the hieghest point on the ground below the player:



Unfortunately, this method would be bad for levels with terrain above terrain, like:



Box based collision would (probably) be slow for a 32x512 tilemap, if thats even a good method. Does anyone have any ways of doing this?

Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 25th Nov 2005 14:44
I've had 3 ways of working thi things out.
1 - Using color collision. Basically you have 2 maps, the one the player sees, and a collision map, which is a greyscalled map of the original and filled with bright colors, each representing a different type of collision. AS the player moves, it's coordinates are checked in the collision map as what color is beneath it, and so work out it's collision effect, and so on...

2- Tile based collision. The scenary is built from tiles, and each tile has a certain number on a data sheet. The numbers represent the type of collision, and so on...

3- A mix up of Tile and Color collision. It's like the tyle set, but instead of numbers on a data sheet, each tile has it's own collision tile, and so you build both, the main map (with the original tiles) and the collision map(with the collision tiles), and so work out just as the color collision.

Advantages (as far as i know):

1- Easy to understand, and you can practically see where collisions are and everything. Very much freedom in doing the collision set.
2- You save on collision maps, so you save both size of the game and resources it needs.
3- You save on collision maps, so you save both size of the game and resources it needs, not as much as 2 , but MUCH better than 1 . Another thing is that you can do tiles with, let's say, half collision on it (ex. spikes and so on, those that do not use all the size of the tile)

Disadvantages :

1- Quite buggy if not followed a strict format, and consumes lots of resources and game size.
2- Very hard to see the level and its collisions. Half used tiles won't work well, unless you specify a certain number for a half collision tile.
3- not sure


Not sure if all of this is quite accurate, but might give you an idea of what to do, or what path to follow...
Tapewormz
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 5th Dec 2005 20:38
You'll want to use tile based collision, with different behaviors for different types of collisions with certain tiles.

JoelJ
22
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 6th Dec 2005 06:25 Edited at: 6th Dec 2005 06:26
tiles are how NES and SNES games did it
8x8 pixel collision boxes, 16x16 tiles...

so here's an example:
light Blue: Walkable
Red: Unwalkable


and the 3rd section is what you would display OVER the sprites (black is trasparent), so in this case, the player would look like they walk UNDER the top of the house, hence the reason it's light blue for the collision

[center][center]
ionstream
22
Years of Service
User Offline
Joined: 4th Jul 2004
Location: Overweb
Posted: 11th Dec 2005 19:12
Thanks for all of your help, i guess I'll have to do AABB collision. Thumbs up!

Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 11th Mar 2006 15:30
Quote: "2D side scroller like Sonic"

great idea, trying to make a 2d side scroller like Sonic, but let me tell you this, you will NEVER be able to create a game better than Sonic The Hedgehog, he is unique and will not be succeeded at the top of my gaming charts EVER!!!

I am a Christian and I know that God loves me. That is what makes my life so great!
Tapewormz
23
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 22nd Apr 2006 00:57
God hates sonic the hedgehog, because sonic isn't christian.

Sonic 91 Software
21
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 22nd Apr 2006 12:28
God loves everyone, no matter who or what they are, so actually, God loves Sonic The Hedgehog.

By the way, isn't a tapeworm a parasite? Perfectly suited to you, then, after coming up with an unacceptable remark lke that.

I am a Christian and I know that God loves me. That is what makes my life so great!
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 23rd Apr 2006 04:57
now now boys be good

Login to post a reply

Server time is: 2026-07-04 13:25:31
Your offset time is: 2026-07-04 13:25:31