godotengine / godot

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

Removing tile from a tilemap doesn't unset the tile in the tilemap #51303

Open nightblade9 opened 3 years ago

nightblade9 commented 3 years ago

Godot version

3.3.2

System information

Windows 10, GLES3

Issue description

After removing a tile from a tilemap, all tiles that used to be that tile ID, are still that tile ID - even though the editor shows them as empty.

Steps to reproduce

Expected: you'll see tiles with ID 0 only (tile A) Actual: you see tiles with ID 0 and ID 1 (formerly tile B's ID)

Minimal reproduction project

No response

kleonc commented 3 years ago

Removing tile from a tilemap doesn't unset the tile in the tilemap

If you meant "Removing tile from a TileSet doesn't unset the tile in the TileMap" then I'd say that's expected/correct behavior. If you want to clear such tiles you can do it by calling fix_invalid_tiles() method on given TileMap. You can also trigger it from the editor: godot windows tools 64_FnJfKupEL1

nightblade9 commented 3 years ago

then I'd say that's expected/correct behavior.

I don't think this is expected nor correct. Here's what I did:

When I ran my game, it took me a while to figure out why monsters aren't moving onto those tiles - because they're not walkable (tile ID of -1). They have a tile ID of two, which isn't even a valid tile in my tileset.

The work-around was to flood-fill them and flood-fill-erase them (right-click).

nightblade9 commented 3 years ago

I didn't see until now you mentioned the editor option to fix invalid tiles. That's great. That also relies on you thinking/realizing that there are invisible tiles, which is made more difficult because the editor shows you empty space after deleting an invalid tile. There isn't even a warning/error printed to tip you off that there's something wrong.

akien-mga commented 3 years ago

AFAIK the new tiles editor in 4.0 will show you "removed" tiles visually as invalid: https://godotengine.org/article/tiles-editor-progress-report-2

So I think this can be considered fixed in 4.0.

If someone wants to work on a similar UX improvement for 3.x, that could likely be done (draw "removed" tiles with something that makes it clear that they're different from an empty tile (ID -1).

Otherwise yes, it's intended that when tiles get removed from a tileset, it doesn't automatically unset them from all tilemaps that use this tileset. This lets you replace a tile by a new one easily, or even swap tilesets, without losing information.

kleonc commented 3 years ago

That also relies on you thinking/realizing that there are invisible tiles, which is made more difficult because the editor shows you empty space after deleting an invalid tile. There isn't even a warning/error printed to tip you off that there's something wrong.

Yeah, no feedback to the user is the problem here, not clearing invalid tiles automatically isn't.


AFAIK the new tiles editor in 4.0 will show you "removed" tiles visually as invalid: https://godotengine.org/article/tiles-editor-progress-report-2

Also: a tweet about it.

If someone wants to work on a similar UX improvement for 3.x, that could likely be done (draw "removed" tiles with something that makes it clear that they're different from an empty tile (ID -1).

I'll try doing something similar.