mapeditor / tiled

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

Add support for height-maps / per cell y-offset #1255

Open bjorn opened 8 years ago

bjorn commented 8 years ago

Allowing a per-cell height offset would allow maps like this to be edited in Tiled:

http://lanebrownart.blogspot.de/2011/12/isometric-game-art.html

display_3 2

Though, it would also require a stack-based rendering order.

MarceColl commented 7 years ago

Hello!

I would like to attempt to do this. Got any directions on where do you think it's best to start? I will follow up from there

My idea of the process would be (correct me if I'm wrong or you think of a different approach):

Some questions that I have:

bjorn commented 7 years ago

The biggest issue here is in my last sentence, that the tiles would need to be rendered stack-based. This is necessary because even things like trees that are on top of the ground, may sometimes need to render below a ground tile. However, Tiled renders a map layer-by-layer. So first issue #1274 should be resolved before we can start on this.

I think tile stacks will be something to support within a single TileLayer, as would this height map. This keeps things straight-forward because they are interspersed with object and image layers as well. And in the future, different tile layers may have different tile sizes or orientations.

The ground height will default to 0, and there will be a tool to modify this. In addition, indeed each tile will need to define its height in pixels, so that the next tile can be rendered at the right place.

If the user wants to have some tile "hover" above the ground, it will need to be placed in a separate layer unless we add an additional per-stack-entry offset. But I think that would make things overly complicated in terms of editing.

Feel free to question any of my ideas!

bjorn commented 7 years ago

Here's a snippet of the custom map editor used for the example map I posted originally:

https://youtu.be/Eo3Uc97vCDA?t=76

Ceylo commented 6 years ago

Hello!

I'm willing to contribute to have this feature implemented. Considering the game project I have in mind this is the only feature currently missing in Tiled that I'm aware of. I'm rather new to making games so I may make stupid statements :)

A few references of what I've found on this topic for now:

I've more or less the same ideas as @MarceColl except that I don't think it's really useful to be able to have a flat view. At least it can come later once we have more feedback. And I can't see what's the problem with the ground (which I assume to be a layer where you put ground tiles).

This is necessary because even things like trees that are on top of the ground, may sometimes need to render below a ground tile.

Regarding what you mentioned @bjorn about the stack-based renderer, I don't get why it's needed. From what I understand, Tiled draws layer by layer. And for a layer, tiles are drawn starting from top left tile, going toward the right, then drawing next row below.

Can you show an example of what you'd want to achieve with "rendering a tree below a ground tile" ? To me if the tree is below (in Y axis) but still on a layer that is above, if should still display above the ground tile. If you want to have it displayed below the ground tile, you should put it on a layer that is under the ground layer. At least that's how it feels like with current layer concept.

As a side note, for now I cloned Tiled repo and successfully did a full build. Is there some doc/guides about Tiled architecture or do I have to read all sources that seem relevant?

eishiya commented 2 years ago

Can you show an example of what you'd want to achieve with "rendering a tree below a ground tile" ?

I realise this issue is several years old, but just in case someone is still interested in understanding it: A few examples of what bjorn meant are visible in the image in the first post, e.g. image Notice how the ground, which should ideally all be one layer, is drawn after the tree (in "front" of it) where the terrain sticks up south of it, but is drawn before the tree ("behind" it) in the cell that the tree is in and in the cells north of it. In layer-based rendering, the bottom of the tree would display on top of the ground in front of it and appear incorrect. Without stack-based rendering, which would render all the layers in a cell before moving on to the next cell, the heightmap feature would not be very useful, as it would still require a large number of layers to achieve any useful results. Users would be better off using Tile Objects, like they are now, if they want to create maps like this.