Jumper : 2D Pathfinder with Jump Point Search (v.1.8.1)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.2)

Post by Roland_Yonaba »

Hi everyone.

Just want to give heads up about the current progresses on this.
I've been working the past hours on another possible way to represent grid tiles regards to these conditions:
  • Tiles can either be fully walkable/fully unwalkable.
  • Tiles can be partially walkable, meaning that they can be crossed in specific directions.
  • The overall should remain simpler.
At this point, I needed a way to represent all tiles and their "passability" (i.e how each node can be traversed). Thanks to some help with the geniuses @StackOverflow, I could hopefully overcome this issue.

As Lua (5.1) do not have a native bitwise operations library (and I didn't want to rely on an external C lib), I used David Manura's bit.numerlua module, from wich I ripped some functions i needed (bit.band, bit.bor, see file attached - note that I don't know much of bitwise operations, i'll be happy to have some feedback about that, thanks).

I made lots of changes internally. Well the algorithm remains the same (A* + Jump Point Search), but on the top of that, some rules to discard expanding search process on nodes that cannot be crossed in specific directions.

The results are clearly awesome. See the relevant screenshots below.

On this first series of screenshots, you can see the pathfinder in action, with diagonal moves allowed. Note that on the second screenshot, one tile was found passable following the north-south direction, then the pathfinder chooses it.
Image Image

Here is the same situation, with only straight moves allowed.
Image Image

Side note, I haven't released this modified version yet, as i'm actually trying to design a simple public interface that will let the user alter easily tiles passability rules, without having to mess with bitwise ops... Once I get this done, i'll be pushing it on a separated branch on Github repository.

Thanks reading.
Attachments
bitops.lua
Minified bitwise operations library for Lua 5.1 (AND, OR)
(3.45 KiB) Downloaded 129 times
Last edited by Roland_Yonaba on Tue Oct 16, 2012 8:53 pm, edited 1 time in total.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.2)

Post by Karai17 »

This is quite brilliant! I look forward to your next release. :)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.3)

Post by Roland_Yonaba »

Hi all,

I've just pushed the experimental branch. The OP was updated with new links, too.
So you can now try to play with one-way tiles (to simulate walls, doors) for instance.
Happy bug hunting!

Side note, this experimental version is...ahem...experimental. Things may not work (I already know about 2-3 issues). Anyway, if you run into a problem, i'll be happy to have your feedback. Also, please pay attention to the Readme, because some things works differently now ( and because I spent lot of time writing it ... :huh: ).

Feedback about the interface would be appreciated, also. How do you find it ? Way much complicated than before ? Simple enough to deal with ? I'll be happy to know about that.

Find also a *.love demo for this experimental version. I hope you'll find it easy-to-use. Basically, you click on a button, then you click on a grid cell to perform the relevant task.
Open Ways and Close Ways buttons works in a *bit* different manner: you click on any of them, then you click on a grid location to select a cell, then you type a key (on your keyboard) to open/close a way of entrance for this cell.

Image

Thanks reading!
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.3)

Post by Kadoba »

I get this error when I run your experimental .love
Attachments
error.png
error.png (26.11 KiB) Viewed 2824 times
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.3)

Post by Nixola »

Strange, it works here
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.3)

Post by Karai17 »

Works for me too
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.1.3)

Post by Roland_Yonaba »

Hi Kadoba,
First, thanks trying.
You should not encounter such an issue.
Would you please download and give it a try again ?
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.2)

Post by Roland_Yonaba »

Hi folks,

Little update. Indeed, that was a bugfix.
The problem occuring was a sort of "tunneling" issue, so that when the goal node was neighbouring the start node,
the pathfinder would always return the straight line, even if this would have implied going through walls, as shown in the following picture:

Image

With the latest bugfix, I had to add an extra function that acts as a validator routine between the online jump node search process and the regular a-star evaluation. When a jump point is found, and happened to be the goal node, this routine evaluate if the pathfinder can actually enter the goal node heading straight, through this function. If not, it will choose for another possible way. All this extra-process is called internally only for diagonal mode, and on the first jump point expanded. As a result, you might no longer encounter such an issue:

Image

Feel free to try it (Github repo).
Note that i have only updated the default branch, not the experimental version (as this might require a bit more thinking).

Thanks reading.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.2.1)

Post by qaisjp »

What does OPEN/CLOSE ways do?
Lua is not an acronym.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Jumper : 2D Pathfinder with Jump Point Search (v1.5.2.1)

Post by Roland_Yonaba »

qaisjp wrote:What does OPEN/CLOSE ways do?
Say you want to model a door on your 2D grip map (a one-way tile).
You want the corresponding tile to be entered only from left/right, for instance, and not from any other direction.
Select the "CLOSE WAYS" button, then select the tile you want to modify, then "close" the directions you do not want the pathfinder to enter on this tile typing the matching keys.

Hope this is explicit enough ?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests