## How do I use a pathfinding system?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Leonardo2450
Prole
Posts: 13
Joined: Wed Jul 17, 2019 12:45 am
Location: Esta xd

### How do I use a pathfinding system?

I'm developing a project and I need my enemies to know how to recognize the best path to the player (pathfinding). I come to you to ask: How do they work internally? Is there one available for a game made without a gang?
-Leonardo2450-
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.

Varkas
Prole
Posts: 32
Joined: Mon Mar 09, 2020 2:26 pm

### Re: How do I use a pathfinding system?

Most systems work on graph structures (nodes and links). The graph is built from the map (walkable ways) and then searched for the shortest path between two nodes.

There surely are some readymade systems, but it will depend on your map representation which of them fits.
In soviet russia, code debugs you.

tobiasvl
Prole
Posts: 12
Joined: Mon Oct 01, 2018 4:58 pm
Location: Norway
Contact:

### Re: How do I use a pathfinding system?

Leonardo2450 wrote:
Thu Mar 12, 2020 10:29 pm
I'm developing a project and I need my enemies to know how to recognize the best path to the player (pathfinding). I come to you to ask: How do they work internally? Is there one available for a game made without a gang?
What do you mean by "gang" in this context?

If you want to know how these kind of path finding algorithms work, read up on graph theory and graph traversal algorithms. A common one in games is A*: https://en.wikipedia.org/wiki/A*_search_algorithm

Here's a simple library for A*, which is a path finding algorithm. All it needs you to do is implement a callback function where you decide if a specific map cell is walkable or not, and then it does the rest. https://github.com/wesleywerner/lua-star

There's also this one, which is a bit more involved; you have to make a collision map, a two-dimensional table, that acts as a mask for defining walkable cells. https://github.com/Yonaba/Jumper

dusoft
Party member
Posts: 104
Joined: Fri Nov 08, 2013 12:07 am

### Re: How do I use a pathfinding system?

Jumper is really cool, I can recommend it.

### Who is online

Users browsing this forum: No registered users and 25 guests