Page 1 of 1

Jumper heuristics

Posted: Sun Apr 18, 2021 7:50 am
by Gunroar:Cannon()
I'm using jumper's Astar and I want to find a way to change heuristics so its not just distance. Like for AI to prefer grass paths to dirt paths.
Which part in the code could I change to add this?
If this question's not clear, pls point it out.

Re: Jumper heuristics

Posted: Mon Apr 19, 2021 7:58 am
by togFox
What you're looking for is a way to traverse a weighted graph (network). I believe the math behind jumper excludes considering 'weights'.

I searched high and low and eventually found this but I haven't tried it yet. Please let me know how it goes and if it is easy to integrate:

https://github.com/Yonaba/dijkstra-map

I plan to move my pathfinding algorithm from Jumper to this so would love to hear how well it goes for you.

Re: Jumper heuristics

Posted: Mon Apr 19, 2021 1:18 pm
by Gunroar:Cannon()
Hmmm
..so using pathfinder:setHeuristic(custom heuristic) doesn't work...?

Re: Jumper heuristics

Posted: Mon Apr 19, 2021 1:48 pm
by togFox
I'm sure it does but I guess you need to invent your own math. My biggest concern is that jumper is inherently designed to work on even-weighted networks - or non-weighted networks. It is very successful at that because it conveniently ignores weights.

The one I linked, conversely, was designed from the very beginning to traverse weighted graphs.

Non-the-less - we both have the same problem to solve so I'll watch this thread with interest. :)

Re: Jumper heuristics

Posted: Mon Apr 19, 2021 3:12 pm
by Nikki
I havent used jumper but have implemented a jump point search algorithm before,
naively i'd say its not well suited for weights because the point of jps is its fast because it skips alot of nodes.

but off course people have been hard at work and there is something like WJPS now (weighted jump point search)
you might be able to learn something from that