A* pathfinding library for libgdx

Hi.

Is there a pathfinding library available somewhere? I know gdx-ai, but it’s not maintained and PRs are not accepted for a year now. It’s needed for a top-down tilebased game.

Of course, I might implement it by myself, but if anyone has a good library, I would use that for now instead :slight_smile:

Slick2D has a pathfinding covered, it is an entire engine though.
You could simply program your own pathfinding or just extract the code of slick.

Source (might be not the newest version of slick2d):

Cmon, this code is also 10(!) years old :slight_smile: I’m not saying that the A* implementation should be different, but I’m looking for a maintained lib, or if I have to implement it myself, I’ll use the latest code available (gdx-ai) as a resource :slight_smile:

Some libs are quite good at what they do, and don’t require that much maintenance. If I were you I’d grab anything that works, and modify the code for my purposes. Whether or not the repo is active, is of minor concern.

Yeah, it’s a good point what you’re saying. Probably I stick to gdx-ai then and I’ll make it transparent so if I find something newer, I’ll be able to replace it. thx!

Yes, Gdx.ai has a A* pathfinder.

It requires a node; position and other information relevant to the terrain.
The nodes are connected to other nodes, so you need to define the connections.
then, a graph of all the nodes and the relevant connections.
finally, a heuristic to calculate how close to the destination each node is

then it is as simple as :

pathfinder.search(node or connection)path(start point, end point, heuristic, graphpath the array of nodes that will be the shortest path or null);

it is annoying to setup because it requires 4 linked classes, but once it is working, the worst is adjusting the weighting of terrain to get paths to not be funky… depending, you may want to use a path shortening algorithm the checks the line of sight point to point. that is good, but instead of say 20 nodes, it might reduce to 3.

Yes, I already solved it and I use gdx-ai. It was not hard tough, I would say it was easy.

The question was only about that as it’s not maintained anymore, is there any other libraries. But as the answer is possibly no, I chose gdx-ai then.

you should try it. Used for many projects, even with libgdx, without any problems so…