TIGSource Forums

Developer => Technical => Topic started by: NandoSoft on December 07, 2010, 03:28:57 PM



Title: Beat em up collision detection
Post by: NandoSoft on December 07, 2010, 03:28:57 PM
currently Im designing the collision systems for my levels and I need suggestions

currently my levels are straight and boring I would like to know how to handle more things like irregular terrain something like this:

(http://i38.photobucket.com/albums/e121/evilnando/example.png)

In other words I would like to have my levels go up and down in many different ways

Also this is a pretty interesting way to make levels a little bit more "organic"
if only they height levels could be somehow appear in a more "smooth" way like a mountain slope or something like that

(http://www.gossipgamers.com/wp-content/uploads/2009/06/vcmm_golden_axe_3.gif)


My current idea is to make an editor where you can lay down line primitives and then in game each character would tests each of the main points of their collision box (top, bottom, left & right) agains each of the line segments that form part of current level

Any ideas?

Thanks


Title: Re: Beat em up collision detection
Post by: 0rel on December 09, 2010, 05:24:14 AM
Does your game also use such a tile-based, 2D/2.5D side-scrolling engine? If so, the handling of uneven terrain shouldn't be emuch different from a platformer or any other similar kind of 2D game, I think...

Although I never tried to implement something like this myself, I think there are many ways one can realize this. Either just as a tile/block versus sprite collision system, or as more accurate (pixel-based) collisions (which would allow you to have arbitrary slopes/shapes).

Personally, I would prefer to use a physics library of some kind in such a case, which would allow you to model the collision mesh freely (Bullet Physics, Newton, Box2D...). That would diverge quite a bit from the classic 2D feeling, but probably you could also just track the collisions, and do the response yourself.

But I guess it would help others, if you could describe your setting more specifically...




Title: Re: Beat em up collision detection
Post by: NandoSoft on December 09, 2010, 05:33:07 AM
Im just doing a classic 2d sidescroller but I want more variety to my levels by being able to add some verticality to them so I was wondering how to make the collision check for the levels.

Im not sure if I want to add the ramps like in golden axe but Im sure I want slopes (up-down) like in the first image

I was thinking of creating a texture mask to mark non-walkable terrain and doing a per-pixel collision test but Im not too sure about that because my levels are going to be somewhat large (at a 720p res)


Title: Re: Beat em up collision detection
Post by: 0rel on December 10, 2010, 01:23:34 AM
Not sure, but that tutorial (http://www.metanetsoftware.com/technique/tutorialA.html) might help with the collision handling of slopes and other non-rectangular shapes...


Title: Re: Beat em up collision detection
Post by: sega on December 11, 2010, 04:30:12 PM
(http://www.nintendospin.com/wp-content/uploads/2008/11/streets-of-rage-2-virtual-console-image1.jpg)

Streets of Rage 2 had what you show in your screenshot, and it wasn't a slope.  They didn't have to do anything fancy with attack collisions.  They treated it exactly the same as horizontal movement.  The bad guy had to stand in front of the player for you to punch him, or you had to position the player to face the bad guy.  They didn't bother having the player or enemies punch diagonally like they did to Turtles In Time: Reshelled, so the rules had no reason to change.

The Ninja Turtles arcade game did the same thing:

(http://www.planetxbox360.com/files/2007/march/tmnt%20review/1.jpg)

Though, it could be that you don't want what's in the screenshot you provided, but something like excitebike:

(http://www.ilovethe80s.com/excitebike.jpg)

In which case, I don't know. :)  But I do think doing it that way makes things more difficult with art and judgment required of the player.  The feet will have to follow the slope if you don't want to have a foot float off/in the ground.  It's worth thinking of the possible frustration felt by the player that he/she can't easily judge if someone's in front of him or not, which weren't really an issue in the Turtles and Streets of Rage examples I gave.

EDIT:
It just hit me that you were probably talking about collision with the background, and not attack collisions.  If that's the case, nevermind the part about attacking enemies, though I don't think those examples had diagonal background collision boxes either.  Also, I do think it stands that the art could be difficult, and judgment could be impaired.



Title: Re: Beat em up collision detection
Post by: Aquin on December 11, 2010, 04:59:57 PM
Heh, I'm making such an irregular beat-em-up *right* now.  And yeah, to follow on the OP's suspicions, I've been thinking of creating Z-plates.

Basically, treat the game as being in 3D-space.  My environment is made from a mesh that tells any actor standing on it just where it is and what the Z value is at that point. 

I dunno, maybe not the most efficient, but it's what I'm doing.  Of course, I have a tendency to change my mind midstream.  For all I know, I'll discover some better way of doing it and redo all of it.