Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (854)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  2.5D effect in 2D game  (Read 30494 times)
0 Members and 1 Guest are viewing this topic.
Offline Ed_RockStarGuy
« Posted 2014-12-16 10:59:36 »

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
1  
2  
3  
4  
5  
6  
7  
8  
9  
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

Click to Play
Offline Jacob Pickens
« Reply #1 - Posted 2014-12-16 21:43:27 »

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!

Offline Ed_RockStarGuy
« Reply #2 - Posted 2014-12-16 21:55:14 »

I know, i seen that quite allot of people struggled with this so i posted my solution to it Smiley
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Rayvolution

« JGO Spiffy Duke »


Medals: 379
Projects: 2
Exp: 2 years


Resident Crazyman


« Reply #3 - Posted 2014-12-17 21:14:40 »

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

This is 2.5D:
<a href="http://www.youtube.com/v/X6llTfYmI90?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/X6llTfYmI90?version=3&amp;hl=en_US&amp;start=</a>

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Now on Steam!
LIVE-STREAMING DEVELOPMENT: http://www.hitbox.tv/rayvolution
Offline Ed_RockStarGuy
« Reply #4 - Posted 2014-12-17 21:50:45 »

Thats why it says 2.5D effect :p
Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #5 - Posted 2014-12-17 21:52:14 »

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.

Offline Jacob Pickens
« Reply #6 - Posted 2014-12-17 23:59:16 »

Isn't isometric 2.5d?

Offline Rayvolution

« JGO Spiffy Duke »


Medals: 379
Projects: 2
Exp: 2 years


Resident Crazyman


« Reply #7 - Posted 2014-12-18 00:01:10 »

Thats why it says 2.5D effect :p

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. Smiley

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Now on Steam!
LIVE-STREAMING DEVELOPMENT: http://www.hitbox.tv/rayvolution
Offline Rayvolution

« JGO Spiffy Duke »


Medals: 379
Projects: 2
Exp: 2 years


Resident Crazyman


« Reply #8 - Posted 2014-12-18 00:01:44 »

Isn't isometric 2.5d?

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.)

- Raymond "Rayvolution" Doerr.
Retro-Pixel Castles - Now on Steam!
LIVE-STREAMING DEVELOPMENT: http://www.hitbox.tv/rayvolution
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1303 views)
2018-06-10 19:43:48

EgonOlsen (1161 views)
2018-06-10 19:43:44

EgonOlsen (900 views)
2018-06-10 19:43:20

DesertCoockie (1301 views)
2018-05-13 18:23:11

nelsongames (1106 views)
2018-04-24 18:15:36

nelsongames (1338 views)
2018-04-24 18:14:32

ivj94 (2080 views)
2018-03-24 14:47:39

ivj94 (1231 views)
2018-03-24 14:46:31

ivj94 (2214 views)
2018-03-24 14:43:53

Solater (798 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!