Implementing a 2D Side Scrolling Perspective like in Golden Axe/Streets of Rage?,
Members - Reputation: 842
Posted 11 January 2012 - 06:47 PM
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...
Crossbones+ - Reputation: 4229
Posted 12 January 2012 - 10:11 AM
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.
---(Old Blog, still has good info): 2dGameMaking
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)
Members - Reputation: 842
Posted 13 January 2012 - 04:44 PM
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).