« first day (3734 days earlier)      last day (1276 days later) » 

6:55 PM
For an RTS that takes place on a grid, what's the best bet for pathfinding? I could run the Floyd–Warshall algorithm to find shortests paths between every pair of tiles. I could use A* on each individual unit. Maybe the A* computations of previous units can be reused for the A* computations of the next unit to speed things up?
 
It sounds like you've answered your own question there. Floyd-Warshall is more work than you need, because only a small subset of those paths will actually be used. By re-using work between multiple pathfinding calls, you minimize redundant computation.
Keep in mind that the pathfinding space can often change at runtime in an RTS - players constructing or destroying buildings, or moving large units, can close or open potential paths.
 
7:21 PM
Yeah, I meant from other units within the same timestep.
@DMGregory Do you by any chance know of a reference where I can read about how to reuse prior A* computations?
I want to make sure I don't accidentally break an assumption of the algorithm.
 
If you're pathfinding to the same set of goal tiles, you can pathfind out from the goal to the agent. Nodes in the closed sets can be re-used between attempts to navigate to the same set of goals, because you already know their true distance from the closest goal.
Nodes still in the open set need to be re-scored with a new heuristic that takes into account their predicted distance from the agent - since now you're pathfinding toward a different agent.
If the agent's position is already in the closed set, you're already done, without doing any rescoring. You already discovered their shortest path to a goal in your previous queries.
 
7:51 PM
@DMGregory Thanks!
 

« first day (3734 days earlier)      last day (1276 days later) »