I’ve been using Tiled for a few days now and I’m really impressed with it! I’ve set up the Terrain tool so it correctly paints all my cliff corners, and that part works great. The issue I’m running into is with colliders.
Example: When I paint cliffs next to water, the side that touches the water correctly collides with the player (as expected). But if I then paint grass above the cliffs, the upper part of the cliffs still has an active collider, even though it’s now covered by grass.
So the problem is that the collider remains in places where I don’t want them. I tried looking into automapping, but I don’t see how it would know which collider “face” to remove. Depending on where I paint, it might be the upper part of the coast or the lower part. I could split things into separate layers, but it quickly become hard to manage.
Of course, I could manually delete unwanted colliders, but on large maps I’d almost certainly miss some tiles, which could lead to gameplay issues later. An automated workflow would be much more reliable.
Has anyone found a good approach or workflow for handling this?
If you use Tiled’s collision editor, the tiles in the map determine the collision, so when you change the tiles, the colliders also change. When loading the map in your game, you’d pull in the collision shapes from the tileset, and combine them into a few larger collider objects as needed.
Automapping can do basic object placement based on tiles, but if you’re looking to create combined collider shapes, the rules to set that up would be a nightmare - you’d need to set up rules for every possible collision shape. And if you don’t need them combined, then there’s no benefit to using Automapping for this over the built-in collision system.
A third option is to use Tiled scripting to create combined collision shapes. This would basically be the same as doing it at load-time and require the same sort of code, but done in Tiled while authoring rather than in your game.
I see how I would use that. You have me some ideas!
But the original problem remains a mystery to me, I’ll try to explain differently (I don’t have access to my computer now so I can’t post a screenshot, sorry).
I have setup up a quick way to paint cliffs in a layer (I have water in a layer below). I have cliffs facing south and cliffs facing north. I have also setup all the colliders for each tile in my tileset.
The problem I can’t see how to solve is: imagine I have a grass field and a lake to the south. The cliff on that lake that faces south works correctly, but the cliffs that faces north (it was auto painted by the terrain tool) is the problem. How do I deal with them? How do I get rid of it or ignore it?
Should I have different tileset where the cliffs facing south has colliders and the tiles facing north doesn’t? And have one the other way around?
Should I configure automapping? (Tried and I need a nightmare in this case)
If you use collisions determined by the tiles (e.g. using the collision editor), it shouldn’t make a difference whether the tiles were added by Terrains or manually - the tiles that are there determine the collision. So, perhaps you have a design issue with your collisions, or maybe I just don’t understand the problem? Showing screenshots of your map and how you’ve set up the collisions might help.
It sounds like you might be running into the RPG view issue where south-facing cliffs have lots of tiles that can be marked as colliding while the north edge of a cliff has cliff-top on one part and nothing elsewhere, so there’s no way to have a whole-tile collision that prevents the player from just wandering off the cliff edge without also blocking them from approaching the cliff edge. In these cases, you would either A. redesign the tile art to allow the entire tile to be collision, B. create collision objects that are smaller than the tile, e.g. just along the actual cliff-edge, or C. supply two or more different colliders for some areas/tiles and switch between which are active depending on where the player is.
Thanks for the responses and for the dedication on these forums, that’s awesome!
My issue is highlighted in the image. I’ve set up the terrain so I can quickly paint my coast tiles, and that part works well. It correctly paints all the sides, and I’ve also set up colliders, which are working fine in Unity (I’m using ST2U).
The problem comes when I paint my grass layer over the cliffs. The “north” cliff tiles are still colliding with the player, which makes sense, since the colliders are still active. I set the grass layer to be semi-transparent in the screenshot so you can see the cliff tiles underneath.
My question is: what’s the best approach to solve this?
I could delete those tiles manually, but I’d likely miss some and cause issues later.
I could use automapping, but it would require a huge number of rules, since I’d need to handle shores to the north, south, etc.
I could create two identical tilemaps, each with different colliders, but then I’d struggle with side/corner/curved cliff colliders.
Or I could try solving it in Unity by only enabling colliders when there are no tiles above, but I’m worried this approach might become limiting later if I need to stack collidable and non-collidable tiles.
This is still a new world for me, so apologies if I’m not expressing things clearly. I’d really appreciate some direction!
Your map’s structure confuses me, but if I understand correctly, the problem is that you have overlapping tiles with different collisions, and you’re using collisions from only one layer, or using all the collisions in combination, which means that when the player tries to walk over the grass, they still run into the cliff collisions underneath? The “best” solution depends on your goals and how you want to structure your maps. For example, do you need to implement bridges, or can you assume that a single coordinate will always have the exact same collision, how are your collisions treated, etc?
You could delete the tiles using Automapping (e.g. delete cliff tiles any time there’s grass or other walkable terrain on a layer above them), but I would assume that you have your weird cliff terrain for a reason and might need to preserve that. If not, then I think reconsidering your approach to drawing maps and being more mindful that your map’s geology makes sense would be a better solution, as it would create more visually appealing maps ;D But if you do want to both keep the cliff tiles and keep them nonsensical like this, then I think a good approach would be to determine when loading the map which collisions to use. You could, for example, use the topmost visible tile’s collision, so the cliff tiles are ignored when they’re underneath grass tiles. This way, what you actually see is what you collide with, and obscured tiles don’t affect collision. Whether this approach will work depends on how your maps and tiles are set up. You may need to mark some layers with custom properties to tell them to not affect collision to prevent them from overwriting all your useful collision in this case.
tl;dr: The “best” approach depends on how your maps are set up, so it’s really up to you to think through what you want. But, don’t try to solve this problem for arbitrary collision/tile placement scenarios, it’s reasonable to assume that your maps should make some form of sense, and the best solution may even lie in adjusting how you approach designing your maps to begin with.
I’m just starting with level design, your response made some points clearer to me, thanks!
About the cliff being weird, It’s just that I wanted to draw my terrain quickly, that upper part of the cliff is just auto generated by my terrain so I could quickly draw a lake for example. I just want to quickly discard the cliff face that will be my walkable terrain.
But in the end, this is the answer for my current problem:
“I think reconsidering your approach to drawing maps and being more mindful that your map’s geology makes sense would be a better solution, as it would create more visually appealing maps”.