+1 vote

When working with grid based path finding in Godot how do you normally handle different agent types? In the game I am working on I have a regular agent, and one that occupies 2 cells on the grid, and one that can fly. The idea I have now is to use a separate AStar object to store the grid for each type. The height is max 4 units so I can use AStar for flying as well.

This keeps it possible to add new actor types as well but is it waste of memory? Also how to deal with avoiding nodes occupied by other agents? The game is turn based so I don’t want to do any object avoiding type thing. Is there a simple way to mark a node in the AStar as temporarily unwalkable?

asked Dec 4, 2019 in Engine by Pranav Koundinya (21 points)

1 Answer

+1 vote

Create a dictionary to record infos for each tile. When tile is occpied, update this in the dictionary.
When using AStar, add tiles that has occupied == false.
Or if you want to keep the original added tiles in AStar, disconnect the tiles and their neighboring tiles when their methods OCCUPY() is called and reconnect them when "occupied" is turnd to false.

answered Feb 9 by Sween123 (758 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.