How do I use a pathfinding system?
- Leonardo2450
- Prole
- Posts: 15
- 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.
[DATA EXPUNGED] Argentinian looking for something to do in his spare time.
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.
There surely are some readymade systems, but it will depend on your map representation which of them fits.
In soviet russia, code debugs you.
Re: How do I use a pathfinding system?
What do you mean by "gang" in this context?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?
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
Re: How do I use a pathfinding system?
Jumper is really cool, I can recommend it.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Who is online
Users browsing this forum: Google [Bot] and 7 guests