leethomason / MicroPather

MicroPather is a path finder and A* solver (astar or a-star) written in platform independent C++ that can be easily integrated into existing code. MicroPather focuses on being a path finding engine for video games but is a generic A* solver.
326 stars 71 forks source link

Optimized pathfinder #12

Open Frankgrandson opened 8 years ago

Frankgrandson commented 8 years ago

Hi, I'm Franco, from Tucumán-Argentina. I'm working in a multiplayer game and I use "MicroPather" to do that. My question is: why when I call MyPath->solver(..), The grid need to be fill again every time? Can I fill it just once and then use it for ever? My grid is 1000x1000, so the time is very important here.

Thank you! Best regards.

Dehaku commented 8 years ago

While I haven't checked it since my game map is constantly changing, I believe the pathfinder caches old nodes it's already checked, getting faster as time goes on. Have you tried running it over the course of time, or simply once or twice then restarting the program?

leethomason commented 8 years ago

It does cache; that's why you must call Reset() if the graph changes.

Although - 1000x1000 is very big. That's a lot of memory it has to chew through to solve a graph.