Currently I’m using Tiled (tiledquickplugin) for the “ground” in my game. I’m using my own editor for everything else (entities like characters, walls, buildings, etc). The problem is that the things that I place in my editor are above the ground layer created by Tiled (i.e. MapItem), and hence they are always rendered above it. This results in a loss of a sense of depth in some tiles. For example, here’s a mulch tile; you can see on the top left edge that it extends outside the isometric tile shape to make it appear “lumpy”:
Here’s a screenshot of the game running with a wall in place:
You can see that it looks clean and flat because the depth is gone.
So what I’m wondering is if there is a way to integrate the two. MapItem is a QQuickItem that has MapLayerItems as children. Each MapLayerItem renders its tiles in one go using draw order as the Z value, whereas in my game, each entity has its own QQuickItem with a Z value assigned to it based on which tile they’re on.
One way I thought of was to do the first level of buildings, walls, etc. as a layer in tiled below the ground layer so that the lumpy ground can be rendered on top of it. This should work, as building and wall tiles are impassable, and since it would only be the bottom section of them, it shouldn’t ever need to render above the player. The downside to this approach is that I need to do half in Tiled and half in my editor (the upper walls)… which I’m kind of already doing anyway.
However, this problem got me thinking about fully integrating a game with tiledquickplugin and replacing my editor with Tiled (Quick). Beyond somehow integrating the features of my editor with (or into a fork of) Tiled (Quick) I would also need to replace my own top-level Scene item (of which all entities in the game are child items) with MapItem so that I can get the Z ordering working. That might be a lot of work, but it should be doable.
However, If I want to use TileLayerItem to add different layers (e.g. buildings or whatever), currently I think that I would need to put each individual tile on its own layer, because Z ordering in Qt Quick is relative, and TileLayerItem has a single item for all of its tiles. I like the put-all-tiles-in-one-item approach because it’s likely very efficient, but it makes this sort of integration very difficult.
Another thing is that I have my own data saved as JSON and don’t really want to use XML. There might already be a solution for this though…
Bjorn (and anyone else in case they have knowledge of Qt Quick): what are your thoughts on this?
Specifically, I’m wondering what you think about the issue where entities have a calculated Z value based on their tiled position, and if it is even possible to integrate this kind of setup into a MapItem-based scene.