Pathfinding with Jumper

Use a fast algorithm to move objects from point A to point B!

Pathfinding, in games as in real-life, is the art of discovering the best route from point A to point B. Some tower defense games use pathfinding (although many of them only use a pre-planned route), you’ll also see it in a lot of strategy games where you move units around the screen.

If you’ve poked around at pathfinding you’ve probably come across the most common pathfinding algorithm called A* (pronounced A-star). There are A* implementations in just about every language, including Lua (with Corona SDK implementations).

In this short tutorial series we’re going to look at a Lua library called Jumper. It was written by Roland Yonaba and is available on GitHub (free and open source under the MIT License):

If you’re a git pro, clone that — for the rest of us, just use the ZIP button on that page to download the latest copy.

Jumper is more than just an A* implementation, it’s a pathfinding library designed for grid-based games. And while you can use A* with Jumper, it allows you to use an algorithm called Jump Point Search that’s about 10 times faster than A*.

Algorithms? Huh?

In this course I will not be digging in to how pathfinding search algorithms work. Smarter people than me have already figured them out and Roland has plopped those algorithms into the Jumper library — making use of that library is what we’re going to focus on.

If you have a grid-based game and need objects to move around the screen, Jumper can help you. And if you don’t think you have a grid-based game, I’ll show you how you can (often) stick a grid underneath where it’s “out of sight” but can still be used by Jumper.

In the Introduction post I gave you a link to Jumper on GitHub, but for this tutorial I’m going to use the version I just downloaded — that’s so that if something changes, the demo program will still work. But if you’re going to publish a game using Jumper, it’s probably a good idea to […]

There’s a lot of code included with the Jumper library and if you’re into that kind of thing, diving in and exploring is kind of fun. But you don’t have to understand exactly how it works to use it in your games any more than you need to understand an internal combustion engine in order […]

Sometimes you can create a walkable map ahead of time, and sometimes you need to build the map at game time. That’s what we’ll do in this video. The demo code has some cool features you may want to incorporate into your own games, including a drawer that slides from the top of the screen […]

What happens if you calculate a path for Monster A to the hero and then the hero moves? The monster should react accordingly and find the best path from where it is now to the new location of the hero (target). That’s what this demo will do. But instead of just using one monster, we […]

Pathfinding isn’t needed for every game, but if you have a character moving from one place to another on the screen it may come in handy. For example, take a look at this scene from The Secret of Monkey Island: If you want Guybrush Threepwood to walk to the fireplace you’re going to want at […]

In the sample code and videos I stuck to the “basics” of Jumper to make sure you could fully grok how to use it in your games. But it can do so much more. Watch this video to find out about tunneling and clearance, two things that could be vital for your game to have. […]

In your grid/map you may want to have multiple values to mean walkable. This can often happen when using different tiles to show dirt, stone, wood, etc. This quick video shows how to create a “walkable” function to be used instead of a variable holding a single value. << Back to Jumper Dashboard http://masteringcoronasdk.com/wp-admin/admin-ajax.php

In case I get hit by a bus or something, I also put this course up on Udemy. Since you bought this course here, you can also have free access to the course over there, using this link: Pathfinding Course on Udemy If you liked this course enough to also grab it on Udemy, I’d […]

I finally got tired of manually making walkable maps from Tiled files and created a quick little function that does it for me. Create your walkable are in Tiled and make sure it’s the first layer (the one at the bottom of the Layer list in Tiled). Export your level as Lua and then use […]

Pathfinding with Jumper Lib - $19.00

There are tons of games where objects need to get from Point A to Point B, all the while avoiding dead ends, cliffs, and who knows what all. That's where pathfinding comes in.
The Jumper library is available free on Github and this mini-tutorial includes 4 videos with sample code for each that will get you up and running fast! You can pound it out yourself, or get a headstart for less than the price of a movie and snacks!

Four videos and sample code, complete access for just $19.00 USD.

Note! This is an INTERMEDIATE level tutorial. There is less hand-holding than in my beginner-level courses. ;)

[sc:QuickLinks ]

Mastering Corona SDK is an independent site not officially affiliated with Corona Labs, Inc. The Corona SDK name and Corona SDK logo are used with permission.

Are you an instructor? If you’re interested in a site like this where you can teach your own courses, use the Contact form on this site. I can quickly build a turnkey site for you.