Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bjorn opened this issue Apr 17, 2016 · 5 comments
Open

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

bjorn opened this issue Apr 17, 2016 · 5 comments
Labels
feature It's a feature, not a bug.

Comments

@bjorn
Copy link
Member

bjorn commented Apr 17, 2016

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.

@bjorn bjorn added the feature It's a feature, not a bug. label Apr 17, 2016
@MarceColl
Copy link
Contributor

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

  • Add a heightmap to the map (formats to discuss)
  • Possibility to toggle between height-affected (to preview) and flat view (to edit)
  • Everything on every layer in a specific tile gets the offset.
  • Add offset value to the export file.

Some questions that I have:

  • How do we deal with the ground under every tile?
  • Should the tile height be editable from Tiled?

@bjorn
Copy link
Member Author

bjorn commented Feb 28, 2017

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
Copy link
Member Author

bjorn commented Feb 28, 2017

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

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

@Ceylo
Copy link

Ceylo commented Apr 2, 2018

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
Copy link
Contributor

eishiya commented Oct 16, 2022

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.

@bjorn bjorn mentioned this issue Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

4 participants