I have been looking into A* pathfinding theory and I understand it essentially is inputing a grid of walkable nodes into a function that assigns scores to neighbouring nodes until it finds the most optimal path from point A to point B.
However how does this work in a case where a given character needs more than 1 cell of space to move?
For example if a character was 1.5x1.5 cells wide, how would the algorithm need to be changed to account for this extra needed space to move? Since I have characters that can be as large as 5 cells wide, I was wondering if anyone could point me to the solution.
Generating new grid for pathfinding from grid of obstacles at a given size would be easy.
now: tile [x, y] is accessible if [x, y] is not blocked
for colliders >1 and <=2: tile [x, y] is accessible if following are not blocked: [x, y] and all its neighbors
for colliders >n and <=n+1: tile [x, y] is accessible if following are not blocked: [x, y] and all tiles in range (how range is defined depends on how exactly unit moves)
(untested, but basic idea “generate new graph” is certainly correct)
But obstacles take full tiles, right? Is there any case where 1.1 would fit and 1.9 would not?
I see, so I just mark nodes that would normally be open for a 1x1 character as unwalkable if they don’t create at least a 2x2 area with the other open nodes adjancent to them?
And for each different character size I would feed a different array of nodes based on their size.