godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

get_surrounding_cells in TileMapLayer should specify that it means surrounding in 4 directions not 8.

Open DanielBrunoDavis opened this issue 1 year ago • 5 comments

Your Godot version: 4.3

Issue description: "get_surrounding_cells" in TileMapLayer doesn't specify if "surrounding" means 4 directions or 8. It should specify that it means surrounding in 4 directions.

URL to the documentation page (if already existing): https://docs.godotengine.org/en/stable/classes/class_tilemaplayer.html#class-tilemaplayer-method-get-surrounding-cells

DanielBrunoDavis avatar Aug 17 '24 23:08 DanielBrunoDavis

Might want to use the term "orthogonal neighbors" in addition to plain language, as it's the technical term for it.

Edit: I don't use the 2d tilemap system, but from reading the source it looks like these functions don't always return 4 neighbors. The TileMapLayer function calls into this TileSet function. When the tile shape is TILE_SHAPE_ISOMETRIC, 6 neighbors are returned. https://github.com/godotengine/godot/blob/master/scene/resources/2d/tile_set.cpp#L2167

tetrapod00 avatar Aug 18 '24 00:08 tetrapod00

Might want to use the term "orthogonal neighbors" in addition to plain language, as it's the technical term for it.

Edit: I don't use the 2d tilemap system, but from reading the source it looks like these functions don't always return 4 neighbors. The TileMapLayer function calls into this TileSet function. When the tile shape is TILE_SHAPE_ISOMETRIC, 6 neighbors are returned. https://github.com/godotengine/godot/blob/master/scene/resources/2d/tile_set.cpp#L2167

I think 6 tiles is for when you use hexes instead of squares for tilemaps. I like "orthogonal neighbors."

DanielBrunoDavis avatar Aug 18 '24 02:08 DanielBrunoDavis

I agree with DanielBrunoDavis. It took me hours to realize this and now I'll have to rework a lot of code around this because I need to know if corners are present. Having known this, I could've worked around it from the get go and spent less time debugging.

I don't know if it's the correct place to suggest this, but having the possibility to tell the engine you want to include corners by adding a bool to the function (true for including corners, false for excluding them, whichever it should be by default) would be a nice addition that would maintain the way it works currently while adding a new functionnality for those of us who would like to use it.

IrontMesdents avatar Aug 20 '24 18:08 IrontMesdents

@IrontMesdents The right place for a suggestion to add a feature is in https://github.com/godotengine/godot-proposals/issues/new/choose. For your case, you'd choose "Feature implementation proposal" and go into as much concrete detail as you can. I agree that it sounds like a useful feature to add.

If you had only a vague idea about a missing funtionality, you might want to start with "Share and discuss ideas" instead.

tetrapod00 avatar Aug 20 '24 18:08 tetrapod00

@IrontMesdents A change has been proposed https://github.com/godotengine/godot-proposals/issues/3973 but it was a while ago so I just thought I'd suggest updating the documentation.

DanielBrunoDavis avatar Aug 20 '24 20:08 DanielBrunoDavis