Page 1 of 2

How to path around blocked tiles with jumper?

Posted: Sun Dec 31, 2023 4:06 am
by Brah
I'm using jumper for pathfinding and was wondering how to get the algorithm to take into account tiles blocked by enemies and other objects when finding a path.

Re: How to path around blocked tiles with jumper?

Posted: Mon Jan 01, 2024 3:52 am
by Brah
I figured out this problem by myself but I have another another question. How do I write a walkable tile function for jumper?

Re: How to path around blocked tiles with jumper?

Posted: Mon Jan 01, 2024 11:53 am
by dusoft
Are you referring to Yonaba's Jumper? https://github.com/Yonaba/Jumper
Stating which library you are using would be helpful.

You need to create and provide a callback function that will return simple 0 (wall)/1 (path) based on walkability, e.g.:

Code: Select all

function isWalkable(sector)
  if sector=='path' then
        return true
    else
        return false
    end
end
then follow example as shown on Github:

Code: Select all

grid_object = Grid(your_grid, true)
finder = Pathfinder(grid_object, 'JPS', isWalkable)
path = finder:setMode('ORTHOGONAL'):getPath(start_y, start_x, end_y, end_x)

Re: How to path around blocked tiles with jumper?

Posted: Tue Jan 02, 2024 1:39 am
by Brah
thanks!

Re: How to path around blocked tiles with jumper?

Posted: Tue Jan 02, 2024 2:55 pm
by dusoft
Brah wrote: Tue Jan 02, 2024 1:39 amthanks!
Hey, Brah, check this out: https://ambience.sk/simple-pathfinding- ... -lua-love/

Re: How to path around blocked tiles with jumper?

Posted: Wed Jan 03, 2024 8:02 am
by Brah
I think I have an older version of jumper because I don't have THETASTAR and my getPath coordinates are X,Y...
Do you have any stuff on weighted grids and movement costs?

Re: How to path around blocked tiles with jumper?

Posted: Wed Jan 03, 2024 8:18 am
by darkfrei
Brah wrote: Wed Jan 03, 2024 8:02 am I think I have an older version of jumper because I don't have THETASTAR and my getPath coordinates are X,Y...
Do you have any stuff on weighted grids and movement costs?
Dijkstra?

Re: How to path around blocked tiles with jumper?

Posted: Wed Jan 03, 2024 9:54 am
by dusoft
Check this:
https://github.com/Yonaba/Jumper/tree/m ... per/search

and maybe update your code to this version.

Re: How to path around blocked tiles with jumper?

Posted: Wed Jan 03, 2024 10:24 am
by Brah
dusoft wrote: Wed Jan 03, 2024 9:54 am Check this:
https://github.com/Yonaba/Jumper/tree/m ... per/search

and maybe update your code to this version.
I tried using that version of Jumper and it causes my games to crash.
darkfrei wrote: Wed Jan 03, 2024 8:18 am
Brah wrote: Wed Jan 03, 2024 8:02 am I think I have an older version of jumper because I don't have THETASTAR and my getPath coordinates are X,Y...
Do you have any stuff on weighted grids and movement costs?
Dijkstra?
Whatever works I just need some psuedo code or an example

Re: How to path around blocked tiles with jumper?

Posted: Wed Jan 03, 2024 11:23 am
by darkfrei
Brah wrote: Wed Jan 03, 2024 10:24 am
dusoft wrote: Wed Jan 03, 2024 9:54 am Check this:
https://github.com/Yonaba/Jumper/tree/m ... per/search

and maybe update your code to this version.
I tried using that version of Jumper and it causes my games to crash.
darkfrei wrote: Wed Jan 03, 2024 8:18 am
Brah wrote: Wed Jan 03, 2024 8:02 am I think I have an older version of jumper because I don't have THETASTAR and my getPath coordinates are X,Y...
Do you have any stuff on weighted grids and movement costs?
Dijkstra?
Whatever works I just need some psuedo code or an example
Not sure if it was really Dijkstra, maybe something like that.
viewtopic.php?t=91167