Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

Implementing a 2D Side Scrolling Perspective like in Golden Axe/Streets of Rage?

4: Adsense

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
2 replies to this topic

#1 Sean_Seanston   Members   


Posted 11 January 2012 - 06:47 PM

Just been thinking about this today... how does implementing a perspective for a side scroller like in Golden Axe or Streets of Rage or Final Fight etc. differ from normal 2D side scrolling?

The difference being that there's a sense of depth by allowing the player to walk up the screen and therefore backwards into the scene up to a certain point rather than being viewed entirely side-on.

At first it seems a mostly relatively trivial difference... just allow movement along the y axis to a point etc. etc. but there are some aspects that might be troublesome and I wanted to see what people think on this kind of game...

My main questions are:
1. How should the ground/terrain be defined?
In a normal side-scroller you'd probably have a grid of regular square tiles that are sufficient for whatever you'd likely want to do. A top-down game would be the same, but here it's not immediately as obvious, unless I'm overcomplicating.
The view is almost similar to isometric games and, rightly or wrongly, that immediately makes me think of thinner rectangles rather than squares, as though top-down squares were seen from a sidewards angle and appeared squashed vertically. Given the usually lower amount of screen space to work with as opposed to a top-down view, and the fact that the skewing of the view means that a smaller amount of screen space and fewer pixels are effectively representing more terrain than the same amounts in a a top-down view, I'm inclined to think my assumption about rectangles is probably correct.

Also, given the perspective, should the edges of the tiles form a grid aligned with the screen (as in top down games) or be skewed into a diamond shape with diagonal left and right sides? The cliff edge in the following diagram can be followed quite closely by the player, suggesting either diagonal edges or some kind of trickery with rectangular tiles to give that impression.

2. What about jumping onto higher terrain in this system?
Maybe it's easier than I first might assume, but I'm having trouble fully grasping it.
I've made a diagram to make this easier:

The rectangles represent where I think tiles might possibly lie. If the player wants to jump from the lower level onto tiles A or B, then he must begin jumping from a tile at the screen height of tile 1. The tiles marked X are impassable, whereas a player jumping from 2 and 3 should never be able to land on A or B, even if their character can jump as high as tiles A and B.

I'm assuming a few variables are probably at work here. Such as:
- The player's current screen position.
- Possibly whether or not a character is jumping.
- The position the player was at before jumping.

Now, while that might seem to solve it... on closer inspection it's still not clear.
A and B are "aligned" with 1 horizontally. If this was in 3D and you were standing on 1 facing the cliff, you'd be standing just underneath A. But A could have just as easily been higher on the screen but still aligned with 1 in that way. Or it could have been lower.
How then 2 and 3 be tiles that A and B can't be reached from, but 1 can reach?
Is there some formula at work that manages to work out that 1 in the game world is meant to be in line with A and B or is it much simpler than that?
Maybe there's some kind of height variable on tiles too?

I really can't quite figure those cliffs out...

#2 BeerNutts   Members   


Posted 12 January 2012 - 10:11 AM

I haven't done anything like this before, but I would suggest adding a z component to your players and your tiles.
So, your player has an x (horizontal) y (vertical on the 2d plane), and z (height). You use x and y for just moving a player around with the joystick.

When a player is just walking on the lowest level (ie, not on the cliff), they are at z of 0. When they jump, you increase the Z value, which, for screen coordinates drawing purposes matches the screen's Y value.

Your tiles would also have a z component, where the "lowest" would have 0, and the cliffs might have a z of 60 (I just picked some number). Again, in screen coordinates, it'd match Y of 60. When a player tries to walk over that cliff, you could check he's feet's y coordinates against the tile, and if the tiles have a higher z, then thet cannot walk on it; however, if the player jumps towards the cliff, and you increase the z, you would check if z >= cliffs z (60), and if so, you stop him ther, and draw him on the cliff, with his feet's z of 60.

Just a thought on how I'd probably do it.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#3 Sean_Seanston   Members   


Posted 13 January 2012 - 04:44 PM

Yeah, I suppose you'd need to keep track of z positions in some way for best results.

For the character, what about x and y for the ground tile position, then while on the ground, z is 0 but on jumping z gets gradually raised to the height of the jump and falls down again to 0 in line with the character's vertical movement? Whereas then each terrain tile would also want to have a z value (not sure how exactly that should be defined or assigned), and the character's z would always be [z of current tile] + [extra z from jumping up/falling off].

I think I might actually try and make at least some kind of prototype of this sort of engine, but probably at first without bothering with allowing jumps or multiple terrain levels. That could work fine for some kind of adventure maybe in the style of point and click.

Anyone else have any ideas or did this before? I wonder if anybody really makes games like that anymore. I probably haven't been paying attention but I can't remember seeing any recent Flash or indie games with this kind of terrain. Don't Look Back by Terry Cavanagh has the same kind of perspective, but you'd restricted to moving along a straight line.
I just think it might be an interesting way to make a sidescroller but allowing a bit more exploration and more characters etc. on the screen at once without having to put it a lot of jumping (which might not be appropriate to the feel of some themes).

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.