You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I've been using this library for a private game project but noticed a slight issue (which may stem from my lack of familiarity with the library code).
I have multiple agents that need to use the same map to pathfind at various points in the game (not necessarily batched together, which prevents me from effectively utilizing multi-agent maps as provided by this library). I've noticed that reusing gridmap objects simply by changing the goalnode will not provide correct results, and realize that the gridmap should be created anew every time I need to pathfind.
Since agents need to pathfind very often, this is a rather inefficient way to do things and I was wondering if there could be a way to reset the gridmap node information without actually creating a new gridmap every time I need a new path found?
Here is the code I use to pathfind, if it's needed (pathfindingMap is a shared pointer to a JumpPointMap instance):
`
pathfindingMap->goal_ = fudge::Coord(endX, endY); // needed for jps to work
auto start = fudge::Coord(startX, startY);
const std::vector<fudge::Coord> path0 = fudge::astar_search(
*pathfindingMap, start, fudge::Coord(endX, endY),
fudge::GridMap<double>::diagonal_distance);
`
The text was updated successfully, but these errors were encountered:
The grid map object holds the array of nodes to be explored and open node list, which are not reusable for another search. You could reset them but why not just create a new map instance instead, which does the same thing. I think there should not be much difference of performance. The cost matrix(terrain) could be used. When you create a new map instance, you should pass the cost matrix as an argument.
Hi.
I've been using this library for a private game project but noticed a slight issue (which may stem from my lack of familiarity with the library code).
I have multiple agents that need to use the same map to pathfind at various points in the game (not necessarily batched together, which prevents me from effectively utilizing multi-agent maps as provided by this library). I've noticed that reusing gridmap objects simply by changing the goalnode will not provide correct results, and realize that the gridmap should be created anew every time I need to pathfind.
Since agents need to pathfind very often, this is a rather inefficient way to do things and I was wondering if there could be a way to reset the gridmap node information without actually creating a new gridmap every time I need a new path found?
Here is the code I use to pathfind, if it's needed (pathfindingMap is a shared pointer to a JumpPointMap instance):
`
`
The text was updated successfully, but these errors were encountered: