Closed UnwarySage closed 6 years ago
Note: almost all of these methods are grid algorithms. They can be implemented in GDScript, but also for any kind of grid, be it for Tilemap edition, level generation or ahead-of-time AI simulation (the same goes for pathfinding). Having them on Tilemap could be handy for performance, but having them only here would be a bit of a waste, isn't it? I worked on grids too in a totally different area not involving tilemap, but I needed the same functions as described above, and the way I implemented them could work on anything having get(x,y), set(x,y) and optionally a 2D size. Anyways it's fine if we get these functions in Tilemap, just felt this should be mentionned.
Hmm, I had no idea Godot had grid datastructures. I agree they would be handy in there as well.
Godot has no "grid" data structure, only specified classes having grid access in various ways (Image, Tilemap, Gridmap, maybe more...), but in the end algorithms applicable on them are the same. Grids I worked on were pure GDScript.
First of all thank you for your report and sorry for the delay.
We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.
We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us. Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about it here?
For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.
Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.
Thanks in advance.
Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.
As there was no answer to the above request, we're closing this issue as inactive. If you can still reproduce it, please open a new issue against a currently supported release of Godot.
I would like to request a few simple-ish functions for the tilemap class, based on my dabbling with procedural levels.
get_extents(): Returns a rect2 or similar structure that contains the space occupied by non-empty cells. This should be fairly easy to do at at base level, and spares having to write something to loop through all of get_used_cells.
flood_cellsv( vector2 position, tile ID to flood fill, optional array of tile ids which block the flood fill): flood fills an area from code with the tile id, starting at the vector2 position, the optional array when not present would default to anything other than -1
find_connected( Vector2 position, array of blocking tile IDs): Breadth-first-Searches the tilemap, starting at the vector position provided, and constrained by the array of tile IDs. Returns an array of reachable positions.
overlay_tilemap(Vector2 position, node) Takes the node, which should be a tilemap with the same tileset and copies it into the calling tilemap, not adding or deleting anything under empty cells in the copied map.
A chunk of these are maybe a little too specific, but I want to open up some thought about what a few underlying tools could be used for.