Posts: 6,055
Threads: 111
Joined: May 2008
06-11-2011, 02:23 AM
(This post was last modified: 06-11-2011, 02:25 AM by Koopaul.)
I've seen the classic footage of Sonic Generations, how the side-scrolling works in a #D environment, and I noticed something that I noticed in DKCR and other 2.5D games.
Characters can jump through from under platforms, however they pass IN FRONT of the object rather than passing through them like in say... Smash Bros.
See in Returns you go in front of the object while in Brawl you pass through it like it was made of gas.
This is easy to do in 2D space, but with 3D environments I wonder how they are able to pull this off? Sonic Generation also does this, but even more interesting that they also have hills in the background that you can jump on like in Genesis games.
So does anyone know how this is done? Is the camera only making it look that way? Is the character model moving forward and back without us knowing it?
You can change the order in which things are drawn to the screen and how they interact to cover and not cover various other objects in the scene.
So, for SSBB, they just have everything work by default, with things clipping through each other as they should. Meanwhile, DKCR would have platforms always be drawn under the player without regard for clipping so they would never obscure him at any time.
Though it may entail just a little bit of extra work, it really isn't all that hard.
As for the case in Sonic Generations, I'd have to watch a video to see if the environment isn't flattened any. Also, since the camera is pretty much always at the same level as Sonic, I suppose the player might not notice if he suddenly shifted in towards the screen when on those background platforms.
Posts: 6,055
Threads: 111
Joined: May 2008
06-11-2011, 02:38 AM
(This post was last modified: 06-11-2011, 02:39 AM by Koopaul.)
Ah so you are saying the platform pops behind DK's model and then pops back into place?
The platform doesn't really move at all. It's just drawn behind the player.
Just like how you can simply draw one sprite right over another sprite or background, you can draw one 3d object right over another 3d object without any regard to their relative distances to the camera.
Posts: 6,055
Threads: 111
Joined: May 2008
06-11-2011, 02:50 AM
(This post was last modified: 06-11-2011, 02:55 AM by Koopaul.)
Okay I see, that's why Smash doesn't do it because you are able to rotate the camera around.
Its sort of like how they are able to trick your sense of depth here right?
Posts: 4,127
Threads: 31
Joined: Jun 2008
Displaying DK takes priority over displaying the platform?
Posts: 941
Threads: 29
Joined: May 2008
It's really piss-simple in OpenGL. Just enable GL_DEPTH_TEST, draw the entity, disable GL_DEPTH_TEST, make sure that everything that IS supposed to go in front of anything is drawn after the rest, and you're set. It's all about drawing priorities.
Posts: 2,824
Threads: 69
Joined: May 2008
(06-11-2011, 02:50 AM)Koopaul Wrote: Its sort of like how they are able to trick your sense of depth here right?
my sense of depth wasnt tricked to i get a prize or something for not being a complete retard
Posts: 4,453
Threads: 90
Joined: May 2008
(06-11-2011, 02:50 AM)Koopaul Wrote: Okay I see, that's why Smash doesn't do it because you are able to rotate the camera around.
Its sort of like how they are able to trick your sense of depth here right?
What does looking at some picture cross eyed have to do with this?
Posts: 1,275
Threads: 17
Joined: Mar 2009
I played this Sonic fangame (Sonic GDK) which pulled that off in a pretty simple way, dunno if it's the same way that DKCR and other "2.5D" games pulls it.
When Sonic jumped, and there was a platform on a plane behind his (much like the example you posted), he'd move to that plane when he got near landing it (sort of like being pulled to this plane, or like a tweening)
you can see it at 1:16 (although you should watch the whole video, it's pretty good)
Posts: 8,812
Threads: 131
Joined: May 2008
it's simple layering.
sonic/donkey kong is drawn on top of everything else.
Posts: 6,055
Threads: 111
Joined: May 2008
06-11-2011, 06:06 PM
(This post was last modified: 06-11-2011, 06:06 PM by Koopaul.)
Um just one more question.
Everyone: "sigh"
If I was to rotate to camera around Sonic and DK, would they be standing on nothing while the platform is in the distance?
Posts: 8,812
Threads: 131
Joined: May 2008
06-11-2011, 06:32 PM
(This post was last modified: 06-11-2011, 06:33 PM by Vipershark.)
no
they're all occupying the same plane
sonic appearing in front of things is simply the order that the game draws them in
if you were to rotate the camera, it would be like in smash bros where you stand on the platform
Actually, yeah, I can see this being a problem in the sonic example, because he's not talking about plain platforms like in Brawl, but rather, solid objects that are in the background. He wants to know if the character is actually standing on those, too (since they're actually on a different plane). This gets especially weird when the player is constantly moving between the two planes; how does the game know where to place the player on the Z axis (in and out of the screen)?
And really, I don't know. The simplest idea is like that vid Rokkan posted.
Posts: 8,812
Threads: 131
Joined: May 2008
06-11-2011, 06:50 PM
(This post was last modified: 06-11-2011, 06:50 PM by Vipershark.)
Oh, I see.
The sonic (genesis) example obviously used depth and lighting tricks to make it look as if you were jumping into the background.
I would assume that in a modern game, you'd still be using those same depth tricks and you aren't actually moving on the Z-axis at all; as far as the game is concerned, you're just higher up on the X axis.
edit- But as far as moving on the Z-axis, Rokkan's example makes the most sense.
|