How to associate tiles in different layers (isometric)?

I am making a game where I want when you walk in the house for the roof to disappear. I need to somehow associate the ground walls with the roof and upper walls so I can make them disappear when I walk inside.

How is best to handle this in Tiled?

Maybe a better way to phrase the question is…why can’t I give properties to each tile instance in the map? Or even at least get the tile unique id.

I really cannot see any other way to implement multiple stories or roofs otherwise. How could I even trigger for a door to be opened?

I would recommend is to place a rectangle object (on an object layer). It will also get isometric projection (unless you’re using staggered isometric), making it suitable for marking an area.

It shouldn’t be hard to check if your player is within the area marked by such a rectangle object, and you could set custom properties on it to tell your game what is supposed to happen when the player enters it (like open a door or switch floors).

There is currently no data structure for this. See the following issue for a discussion and eventually a link to a pull request seeking to add this feature (with further discussion):

I’m not familiar with the jargon but what is the outcome?
Will this feature be added in the future?

Maybe. There are many other things on the roadmap so I won’t get around to it in the near future, but anybody else is free to work on it. I would first see if my alternative suggestion works for you.

I spent a couple weeks thinking of workarounds and I thought of your idea but its too much of a hack and will certainly cause unwanted side effects when trying to make cutaway roofs. I’m quite surprised you don’t consider missing Tile specific information to be a critical flaw in Tiled. Please consider putting it on the road map at least.

Can you try to explain why you consider using an object for annotation a hack? In the end it’s the same thing, so I don’t understand what unwanted side effects you’d get.

Conversely whats the point of having tiles at all if you use objects?

With the suggested approach I would have to make all my buildings out of objects which in Tiled would be a PITA. Consider that I must somehow be able to render/not render individual tiles and groups of tiles at will.

Besides no Tiled reader that I am aware of treats objects like tiles so that would also cause problems.

I didn’t suggest to make your buildings from objects. For rendering as well as editing purposes it is likely beneficial to keep using tiles for that. The only thing you’d do with objects is to add regions for annotation, by placing a rectangle over the area where you want some special behaviour and setting custom properties on that rectangle so that your game can read out what to do when the player’s position intersects with the rectangle.

You could also just have a special tile layer named IndoorFloor or something, and each frame check to see if the tile on that layer under your character’s position has a tileId > 0. If so, then don’t render the ceiling. With that, you only place tiles on the layer when you want that ceiling disappearing behavior to happen.

Honestly these ideas are hacks and make things much more complicated than having tile attributes. I don’t think this will be practical at all for anything beyond very simple setups.

In my opinion, TwoLeggedMammal’s suggestion seems elegant and efficient, and capable of scaling to some complexity. Conversely, consider that your wish for Tile Instance attributes may solve your issue initially, but it may not be play nicely in the long run.

For the past 2 years I’ve been working on an isometric game as well, and one of the first gotchas during my development was that I couldn’t create attributes on Tile Instances, which I hoped to use to mark certain tiles, for example if a dynamic/run-time item was to appear on top of that Tile Instance, or if I wanted to mark some Tiles so that an adventure narrative dialog box appears when the player stands on top of it.

But I realised that if I didn’t have proper viewport feedback about all the attributes, then I would be running blind during level editing, and might end up with many Tile Instances attributes being set, when they shouldn’t be, resulting in lots more bugs. And even if I did have visual feedback, I would still find myself needing to manage those attributes: for mass-changes, and the ability to group these attributes because when you have lots of it, you need to organise it. When I thought of it this way, I thought that the first thing I should be doing in the first place was to organise my Tiles in layers. And when I did, Tile Instance attributes, while still desirable, didn’t seem so important, because I’m able to control the Tiles as a group using layer attributes.

If you want to associate Tiles to different layers, why are Tile Layers not suitable for what you want to do?

Yes its a nice idea for very simple levels and I had considered this a few months ago and even tried it. Its simply not feasible due the amount of layers. All my houses in my city have an indoors with multiple layers. Its not practical at all to have every house in a different layer. There needs to be some manageable way of making tile associations, something that works and doesn’t spiral out of control with lots of tiles.