Represent walls between tiles

Hi,

I want to represent walls between tiles. What would be the best way to do that ?

I have several ideas :
→ Create a layer dedicated to walls, with tiles representing all possible configurations
→ Maybe I could do something with objects

Thank you all for your attention !

→ You could use layer offsets to put centers of the wall tiles on corners of other tiles.

→ To get “all possible configurations” for square tiles, you just need just four variants: e.g. wall to the East, wall to the South, both of those, and no walls. The other walls can be provided by neighboring tiles:
image
(But you might need more if you need fancier connections.)

1 Like

If you want to automatically/quickly place the walls, then I think the layer offset idea is the better one, because you’ll be able to use edge-based terrains (available to try in the snapshot and releasing in version 1.5) to draw the wall “terrain” and have Tiled automatically place your corners and edges, and you could have single-tile-wide paths enclosed by the walls (or rather, it would be two wall tiles right next to each other, but with the ground below visible between them, since the walls would be mid-tile). This method would require 15 unique tiles.

If layer offsets aren’t an option (some importers/engines don’t support them), then you’d need special tiles for the different wall positioning on each edge. If you go with encukou’s suggestion, you will save a lot of tiles, but you will not be able to use Terrains to place them, it’ll have to be manual (or perhaps you could set up Automapping to help somehow). This approach would require the fewest tiles: south, east, south+east, corner to the south-east, a mere four tiles. A drawback of having so few tiles is you would have no opportunity for details like cast shadows from those walls, if you wanted to add those, the tile count would explode to well above either of the other options (though this could be avoided by making the shadows on a separate layer from the walls).

If you make tiles such that the walls are actually split across them, it should also be possible to set up a corner-based terrain to place these automatically as well, but you won’t be able to have 1-tile-wide gaps if you go this route. This method would require 15 unique tiles.

Those could also be added in your game engine, loader and/or a post-processing script, if you don’t mind doing the programming :‍)

Thank you all for your answers ! The aim Indeed is to implement some shadows, but dynamically computed. I think I will go for a layer dedicated to walls, like in your drawing. I will then proceed that in a custom data structure. I’m writing my own renderer and parser anyway because the ones of provided by libgdx ( I use kotlin ) are not flexible enough for what I intend to do. I’ll update this thread if I find anything useful !