How to use AStar (A*) for an entity that occupies more than 1 cell?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ObsidianWhisper

I’m having trouble wrapping my head around how to have a unit, let’s say a large unit that takes up 2x2 on the map, path properly using AStar.

I’ve had a hard time finding any tutorials explaining how to approach this situation. And I didn’t see anything for this in the documentation.

The objective is for AStar to path properly around obstructions (walls, pits, hostiles).

What’s the best way to handle entities that are larger than 1 cell?

:bust_in_silhouette: Reply From: Inces

One approach would be to create another Astar for every unit of different size and design its points distribution in different density, proportional to size of unit. It will require to check all tiles within range of each point and determine if its disabled/enabled, depending on presence of obstacles.