Godot Version
4.5.1
Question
I’m making a tile-based game and I’ll need pathfinding. My first instinct would be to use the built-in AStarGrid2D class. Except I’m going to allow multi-tile actors of varying widths and heights, which AStarGrid2D doesn’t support.
Right now what I’m doing is keeping multiple AStarGrid2Ds around. One base AStarGrid2D for 1x1 actors, and several other AStarGrid2Ds for larger actors that get updated based on the base AStarGrid2D.
Now, I’m updating the base AStarGrid2D frequently in response to actors moving and other terrain alterations like doors opening and closing. So the other AStarGrid2Ds need to be updated to stay in sync with the base AStarGrid2D, which is complex. And that’s just to set tiles as solid or not solid. I soon also want to have tiles with different weights and be able to dynamically alter tile weights too (my actual use case for dynamically altering tile weights is for setting the tiles an actor is standing on as having high weights instead of actually solid like I am currently, since that actor may move soon).
I may also eventually have actors with different types of locomotion, like birds that can cross pits or fish that can only go on water tiles.
So I’ve begun to wonder if I should just ignore AStarGrid2D and write my own AStar pathfinder where I can do whatever I want. I’m worried about the performance though if I use GDScript. Though this is a turn-based game so maybe the impact won’t be that noticeable.