How to path around blocked tiles with jumper?

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.
User avatar
Brah
Prole
Posts: 13
Joined: Tue Feb 01, 2022 7:43 am
Location: The Internet

How to path around blocked tiles with jumper?

Post 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.
User avatar
Brah
Prole
Posts: 13
Joined: Tue Feb 01, 2022 7:43 am
Location: The Internet

Re: How to path around blocked tiles with jumper?

Post 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?
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: How to path around blocked tiles with jumper?

Post 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)
User avatar
Brah
Prole
Posts: 13
Joined: Tue Feb 01, 2022 7:43 am
Location: The Internet

Re: How to path around blocked tiles with jumper?

Post by Brah »

thanks!
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: How to path around blocked tiles with jumper?

Post by dusoft »

Brah wrote: Tue Jan 02, 2024 1:39 amthanks!
Hey, Brah, check this out: https://ambience.sk/simple-pathfinding- ... -lua-love/
User avatar
Brah
Prole
Posts: 13
Joined: Tue Feb 01, 2022 7:43 am
Location: The Internet

Re: How to path around blocked tiles with jumper?

Post 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?
User avatar
darkfrei
Party member
Posts: 1181
Joined: Sat Feb 08, 2020 11:09 pm

Re: How to path around blocked tiles with jumper?

Post 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?
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
dusoft
Party member
Posts: 510
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: How to path around blocked tiles with jumper?

Post by dusoft »

Check this:
https://github.com/Yonaba/Jumper/tree/m ... per/search

and maybe update your code to this version.
User avatar
Brah
Prole
Posts: 13
Joined: Tue Feb 01, 2022 7:43 am
Location: The Internet

Re: How to path around blocked tiles with jumper?

Post 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
User avatar
darkfrei
Party member
Posts: 1181
Joined: Sat Feb 08, 2020 11:09 pm

Re: How to path around blocked tiles with jumper?

Post 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
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 69 guests