Jumper heuristics

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Jumper heuristics

Post 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.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
togFox
Party member
Posts: 764
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Jumper heuristics

Post 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.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
Gunroar:Cannon()
Party member
Posts: 1085
Joined: Thu Dec 10, 2020 1:57 am

Re: Jumper heuristics

Post by Gunroar:Cannon() »

Hmmm
..so using pathfinder:setHeuristic(custom heuristic) doesn't work...?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
togFox
Party member
Posts: 764
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Jumper heuristics

Post 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. :)
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

Re: Jumper heuristics

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests