Ability to pass custom heuristic formula to pathfinder.search
-
As described. It would be nice to be able to pass a custom heuristic to pathfinder as a function.
http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html
-
Have you seen the
heuristicWeight
option?
-
Yes. Read the attached article.
heuristicWeight
equal to the 'scale' listed in the article. I am asking to overwrite the existing A* formulaF = G + weight * H
, with a different one. I wrote my own A* function, but it will always be slower than pathfinder due to server side caching.
-
@crazydubc As far as I know, calling js functions from a native module is heavy. The heuristic function is called for every point being added to the open set, which is a lot. The total overhead likely would be too high for a pathfinder with a custom heuristic formula to be useful in the game.
If someone wants to give it a try, please remember that it's a part of the driver component which is open-sourced.
-
@o4kapuk Well, damn. Then a custom A* is the answer. Thanks man!
-
@CrAzYDubC, I read through the article but it didn't seem like it was doing anything other than changing the weight. Unless it was changing dynamically during the search? Not sure what the implication of that is?
I'm really intrigued to know what you are using this for!
-
@systemparadox The implication may be quite practical. For example I once found the blog post about pathfinding in the Factorio devs blog, they split the world onto square chunks (which we have out of the box), do reverse pathfinding over chunks, like
Game.map.findRoute
but keeping the closed set, and then use standard A* (not even JPS!) with a custom heuristic function to use the saved closed set of chunks search as a guide.