mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
10.82k stars 1.73k forks source link

Depth offset #2007

Open ampetty opened 5 years ago

ampetty commented 5 years ago

Hi there. So I'm trying to set up a psudo-3d level where each layer would have a set height in the game. Basically something like this: http://ogrebattlesaga.wikia.com/wiki/Scabellum?file=Scabellum_Map.gif. Right now I'm using layer offsets but it feels really clunky to have to math out the exact pixel offsets each time I add a new layer. I feel like there should definitely be a better way to do this.

I'm thinking each layer could have a depth property and then the map would have a depth offset to automatically determine offsets based on that depth. For example with a depth offset of x=0,y=8 a layer with depth 0 would be at x=0,y=0; depth 1: x=0,y=8; depth 2: x=0,y=16 etc..

With this I could set the default depth offset for the map and for each layer I would only have to assign a single depth value.

Seel commented 5 years ago

Another approach could be not using so many layers at all, but store a Z-height value per tile and offset each tile by that amount. Unity recently implemented a "Isometric Z as Y Tilemap" So implementing something like it in Tiled as well would be nice I think. The mmorpg Wakfu also uses this approach. They use tall tiles and then just "raise" them out of the ground with the offset.

One advantage of this is that you can make really organic looking worlds, because you can raise or lower individual tiles by any number of pixels to make some nice uneven looking terrain. But the disadvantage is that it would be hard to implement in a game engine, because you can be behind tiles or on top of them, so sorting is more difficult.

bjorn commented 1 year ago

Another approach could be not using so many layers at all, but store a Z-height value per tile and offset each tile by that amount.

This approach is covered by issue #1255.