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: 264
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.
Check out Treaty
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
togFox
Party member
Posts: 162
Joined: Sat Jan 30, 2021 9:46 am

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.
User avatar
Gunroar:Cannon()
Party member
Posts: 264
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...?
Check out Treaty
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
togFox
Party member
Posts: 162
Joined: Sat Jan 30, 2021 9:46 am

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. :)
User avatar
Nikki
Prole
Posts: 38
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 41 guests