Startpoint to endpoint pathfinding in Segreta 2 with Jumper

I have come to rely on Jumper for a lot of essential functions within “Segreta”, the roguelite I’ve been working on off and on for the last year or so. I don’t really mind leaning on the Jumper lib, mostly because it provides useful shortcuts to simple problems with regards to pathfinding, which are always bountiful when dealing with the roguelike genre.

P2mFasR.gif

For instance, Jumper is terrific for creating a path from spawnpoint to endpoint. The general concept is that, during level generation, every room has a door to every connected room. Before obstacle population, random rooms are chosen from within a function leveraging Jumper, checking to confirm that the rooms are accessible from the spawnpoint of the player:

        function scene.buildStairStackDown()             scene.directionComplete = 1             local function setDownStairInt()             scene.randomStairDown = scene.randCall(2,#scene.pathMarkerY-1)                 if scene.randomStairDown == scene.randomStair then                     scene.buildStairStackDown()                     return true                 end             end             setDownStairInt()             scene.callNewPath(scene.pathMarkerX[scene.randomStairDown],scene.pathMarkerY[scene.randomStairDown],scene.pathMarkerX[scene.randomStair],scene.pathMarkerY[scene.randomStair],scene.directionComplete)             if scene.directionComplete == 2 then                 scene.buildStairStackDown()                 return true             end             scene.createDownStair()         end

If the random room is not accessible, then the function gets called again until a valid room is found to place the endpoint.

HDR8oTY.gif

I was finding that the most simple approach to this solution was allowing the spawnpoints and endpoints to potentiall be far too close to each other. To allow for more challange and complexity to gameplay, I made sure to include a threshold for the length of the path. That way, I will be able to keep the rooms far enough apart that it feels like an actual search to find them.

After the exit path is routed and set, the path “tiles” are locked and no impenetrable obstacles are placed on them, while destructible environments are fair game.

PS. I think I’m going to make development posts a regular thing.

Awesome! I’m a big fan of Segreta btw.

So if I am understanding this right, You are creatting pathways upon creation of the level. Then storing them into a list to use later? Or is this just to see if the rooms are connected properly? Do you access those pathways via a stored table later for stuff?

I have Jumper installed and I have used it in very limited ways. I would like to use it more. This post is really cool.

PS. I think I’m going to make development posts a regular thing.

Yes please! And more Jumper stuff too would be awesome!  

For instance I am not really sure how they(example in the README.md) determine length of path with a decimal (8.83) when it is a grid based path? Seems like length would equal the number of steps?

(for those that don’t use Jumper you can get it here)

You are creating pathways upon creation of the level then storing them into a list to use later?

All connected rooms have doors into each other, and I use a similar but less complex pathfinding call to confirm their connections and place doors.

Or is this just to see if the rooms are connected properly?

It is conceivable that there are rooms that aren’t accessible, which IMO adds to the magic that is the roguelike :wink:

Do you access those pathways via a stored table later for stuff?

I don’t normally use the path table I create for anything important. It’s more for record-keeping than anything else.

I’m a huge Jumper fan specifically, and a big Roland fan in general. Here is my fork of Jumper for Corona (old version don’t @ me) and here is my blogpost which explains it in a bit more detail.

I agree on the decimal, but I assume that might relate to one of the other pathfinding algorhythms it leverages (ASTAR, DYKSTRA, THETA etc).

Will keep up the posts and thanks for the kind words!  ^̮^

Awesome! I’m a big fan of Segreta btw.

So if I am understanding this right, You are creatting pathways upon creation of the level. Then storing them into a list to use later? Or is this just to see if the rooms are connected properly? Do you access those pathways via a stored table later for stuff?

I have Jumper installed and I have used it in very limited ways. I would like to use it more. This post is really cool.

PS. I think I’m going to make development posts a regular thing.

Yes please! And more Jumper stuff too would be awesome!  

For instance I am not really sure how they(example in the README.md) determine length of path with a decimal (8.83) when it is a grid based path? Seems like length would equal the number of steps?

(for those that don’t use Jumper you can get it here)

You are creating pathways upon creation of the level then storing them into a list to use later?

All connected rooms have doors into each other, and I use a similar but less complex pathfinding call to confirm their connections and place doors.

Or is this just to see if the rooms are connected properly?

It is conceivable that there are rooms that aren’t accessible, which IMO adds to the magic that is the roguelike :wink:

Do you access those pathways via a stored table later for stuff?

I don’t normally use the path table I create for anything important. It’s more for record-keeping than anything else.

I’m a huge Jumper fan specifically, and a big Roland fan in general. Here is my fork of Jumper for Corona (old version don’t @ me) and here is my blogpost which explains it in a bit more detail.

I agree on the decimal, but I assume that might relate to one of the other pathfinding algorhythms it leverages (ASTAR, DYKSTRA, THETA etc).

Will keep up the posts and thanks for the kind words!  ^̮^