Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DanielBrunoDavis opened this issue Aug 17, 2024 · 5 comments · Fixed by godotengine/godot#98587
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement

Comments

@DanielBrunoDavis
Copy link

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
Copy link
Contributor

tetrapod00 commented Aug 18, 2024

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
Copy link
Author

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

@skyace65 skyace65 added the area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository label Aug 18, 2024
@IrontMesdents
Copy link

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
Copy link
Contributor

@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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants