godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.34k stars 21.06k forks source link

New TileMap editor: Can't draw a pattern using 2x2-sized tiles #50097

Open KoBeWi opened 3 years ago

KoBeWi commented 3 years ago

Godot version

a8fb450

System information

W10

Issue description

I have a tileset with some 2x2 tiles image Seems like they still use 1x1 grid and I can't draw a pattern properly. Instead of this image I get this image

Steps to reproduce

  1. Have a TileSet with some bigger tiles
  2. Select the big tiles and enable "Place Random Tile" option
  3. Try drawing a rectangle/line

Minimal reproduction project

ReproductionProject.zip

groud commented 3 years ago

Well, yeah, that's the expected behavior. Creating bigger tiles is meant for them to take the place of one tile, not more, in the grid. So what seems to happen here is that you end up with overlapping tiles. See this old example with trees: 601c03eb052bf564871180

You should simply not create big tiles there, and instead select the 4 tiles at once when painting.

KoBeWi commented 3 years ago

But if I select 4 tiles at once, I can't draw random patterns. I want the big tiles to be selected randomly.

groud commented 3 years ago

Ah yeah. This requires another feature then, randomly drawing TileMap patterns is not supported.

We discussed with reduz the possibility to create a pattern palette, where you could store patterns to paint. Having probabilistic painting there could work. But that might be a difficult problem to solve, as patterns may have different size and shapes.

For now, you can either try to use big tiles and erase one column/row out of two (you may want to change the texture_origin property to align them to grid though), or you do without randomization.

I guess you could make an editor plugin too, there's already a TileMapPattern class to help with patterns that should be exposed. It might simplify the work.

KoBeWi commented 3 years ago

I worked it around with a script that goes through used cells and randomizes the patterns. That's enough for me, so if the issue is not going to be resolved then it's fine to close it.

groud commented 3 years ago

I'll work on TileMap patterns soon, I'll see if such a feature is easy to implement or not. If so, I see no problem in adding it.