godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.78k stars 3.07k forks source link

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

Open DanielBrunoDavis opened 4 weeks ago

DanielBrunoDavis commented 4 weeks ago

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

tetrapod00 commented 4 weeks ago

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

DanielBrunoDavis commented 4 weeks ago

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."

IrontMesdents commented 3 weeks ago

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.

tetrapod00 commented 3 weeks ago

@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.

DanielBrunoDavis commented 3 weeks ago

@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.