Rendering order in 2.5D TileBased game.

Hello everyone.
Can anyone tell me what is the method used in 2.5D games (not isometric) to render sprites with a “depth” effect?

I am using libGDX. My tiles are stored in a byte unidimensional array (their type id’s), and are rendered using the tile type “model” (i am not using a Object for every tile in game, but only one Object for every type and then render it’s texture where it should be).

The way i think this is to render tiles whose Y is greater than sprite Y, then render sprite, then the tiles after it. The problem is that i don’t know how to handle this with multiple sprites. :persecutioncomplex:

If anyone can, please answer this. Thanks!

Iulian ;D

Why don’t you have a for loop running thru your list of sprites, and then drawing each sprite?
The list would have to be sorted according to Y, using Arrays.sort() or whatever you prefer.

The best way to render a map like this is to order all the objects by the Y coordinate value. (Not just the sprites, but the game objects and land objects as well).

  • You want to order each object from the lowest Y value to the highest.
  • Then just go through a loop and draw each object in order.
  • If a land and an object share the same Y value, draw the land object first before drawing the sprite.

That should take care of the depth in a 2.5 isometric game nicely. To make it fast, make sure you are only drawing items within the screen.

I don’t have an object for every tile in game!
As i said, i have only one object for every TYPE of tile and render only it’s texture where it should be (using a for loop trough the byte[] storing tile id at ‘i’ position).