Portponky / better-terrain

Terrain plugin for Godot 4
The Unlicense
509 stars 24 forks source link

Decoration for same tile (upper layer) ? #94

Open DinoMC opened 3 months ago

DinoMC commented 3 months ago

I love the Decoration system in better-terrain, but I feel like it doesn't work well for top-down games (or I might not understand how to use it), or even side-view games in some use cases.

Rather than having decorations be added to the surrounding empty tiles, I'm looking for a way to add them to the same tile, but on an upper layer.

As an example use case, right now I'm trying to use a tileset with a lot of "Ground" tiles and a lot of "Border" tiles that go over the ground. If I create every combination in my spritesheet, I'd have hundreds, maybe thousands of different tiles. So rather than doing that, I'm trying to draw the ground, and then draw the borders on top. Like this ; better-terrain-top4

(If there's a way to do that already, OR a way to combine two tiles in Godot that I'm not aware off, you can stop reading here and please tell me about it :P)

Initially, I tried to add the border to an adjacent tile using Decorations, and then offset its rendering so that it draws over the ground. But I run into an issue with inner corners, where 3 different tiles would need to draw to the same adjacent tile. Couldn't figure out a way around that :

decoration offset (shown here without the offset so the issue is more visible)

Using the decoration system, I guess a way to do it would be :

Portponky commented 2 months ago

Hello, thanks for using the plugin.

The borders in your example can be painted as a terrain, which would speed up the level design. You might need to add a transparent tile for the central cells.

Anything to do with placing tiles across layers is beyond scope of this plugin. I'm sure such a tool would be neat, but I want to keep Better Terrain simple and straightforward for the majority of users. Furthermore, the tilemap layer system is being removed in 4.3, so any layer-based system would be restricted to 4.2 or earlier.

However the plugin is also completely public domain, so you can tailor it to your specific needs as much as you want. Perhaps you could add a button or key combo to mark a background terrain type, and then write that into the background layer every time it paints a tile? That would suit your specific needs and probably wouldn't be too tricky to hack together.

DinoMC commented 2 months ago

I didn't think about just making a second terrain type with transparent tiles for the inside, nice, that solve 90% of my issue :)

I might look into modifying better-terrain it to solve the remaining 10% if it's not too hard!

PS. I'm actually using 4.3 in my example above. I said "upper layer" but I really meant upper TilemapLayer, I think the end result would be the same (?)

Portponky commented 2 months ago

Glad to hear that helped.

Yes, anything you can do with layers in a TileMap, you can also do with TileMapLayers. However, TileMapLayer nodes are much more flexible, as you can arrange them throughout the scene tree.