2.5D effect in 2D game

I wanted to share this information on how im working on a 2.5D effect in my game but keeping it as a 2D game…because well i thought it was cool :p.

When i started work on this i could not be bothered with working on a full fleged 2.5D engine so i looked for a solution and then i thought of this. Most 2d games runs on a Array that contains all the games tiles/chunks and its loaded onto the screen…ok we all know that but then i thought about multi layering to get the 2.5D effect so i did this. i created 4 Layers to my game all with a specific pourpous.

Layer one (Background, Aka tarrain)
This is the randomly generated land for the whole game and is the background of every level.

Layer two (Collision layer and Player render)
Every block on this layer the player can bump into and it is good for things such as invisible mazes or in this example a tree

Layer 3(Foreground, Everything that will be rendered on top of the player)
This layer in the example will be the rest of the tree

Layer 4 (Map, Minimap and Mouse listiner)
This one is optional but what i do is when a block has been set i run a stitch map method that gets the block thats on top and renders that as the block on the forth layer like this

public void stitchMap(int x, int y){
		if(getTile(x,y,3)!=null&&getTile(x,y,3)!=Tile.VOID){
			setTile(x,y,getTile(x,y,3).getID(),4);
		}else if(getTile(x,y,2)!=null&&getTile(x,y,2)!=Tile.VOID){
			setTile(x,y,getTile(x,y,2).getID(),4);
		}else if(getTile(x,y,1)!=null&&getTile(x,y,1)!=Tile.VOID){
			setTile(x,y,getTile(x,y,1).getID(),4);
		}
	}

Now as a collective what dose this do? It allows the player to walk behind the tree but still bump into the base as if they walked into a tree on a 2.5 plane like so

Nice Job!

Here is a much more effective technique IMO.

http://www.java-gaming.org/topics/2d-depth-in-sidescroller-with-y-element/34994/view.html

Glad you got it working though! That normally is a make or break kinda thing in my top down games!

I know, i seen that quite allot of people struggled with this so i posted my solution to it :slight_smile:

This really isn’t 2.5D, this is 2D with multiple map layers, allowing you to walk behind objects. :slight_smile:

This is 2.5D:

X6llTfYmI90

Thats why it says 2.5D effect :stuck_out_tongue:

But that’s the problem. It isn’t 2.5D.

2.5D is artificial scaling of objects as they get closer to the ‘camera’.

Representing a 3D world in 2D is still just plain old 2D.

Isn’t isometric 2.5d?

Well, keep in mind in almost all cases 2.5D is actually 3D rendered to look 2D but under the hood it’s actually more like a 3D game.

What you’re doing is 2D, you’re just getting into multi-layer maps. If your definition of 2.5D was correct, that would mean any game dating all the way back to the first video games you could walk behind objects would be 2.5D.

Now, your original post is still valid, it does show a concept for how to have multiple layers on a 2D map so you can walk behind them. It’s spot-on with the concept/idea, but the concept just isn’t 2.5D. :slight_smile:

The classic isometric style is still 2D. It’s just 2D drawn to give the optical illusion of 3D.

(EDIT: Well, not so much of 3D, but of depth in general.)