Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (774)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  A* pathfinding library for libgdx  (Read 1197 times)
0 Members and 2 Guests are viewing this topic.
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Posted 2018-09-04 06:52:00 »

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 Smiley
Offline ral0r2
« Reply #1 - Posted 2018-09-04 09:33:24 »

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):

https://github.com/ariejan/slick2d/tree/master/src/org/newdawn/slick/util/pathfinding
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Reply #2 - Posted 2018-09-04 17:55:08 »

Cmon, this code is also 10(!) years old Smiley 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 Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
Administrator

« JGO Overlord »


Medals: 1356
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2018-09-04 18:09:01 »

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.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Reply #4 - Posted 2018-09-05 05:04:22 »

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!
Offline bmanmcfly
« Reply #5 - Posted 2018-09-12 06:17:54 »

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.
Offline mudlee

Junior Devvie


Medals: 6
Exp: 5 years



« Reply #6 - Posted 2018-09-12 06:30:29 »

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.
Offline Gornova
« Reply #7 - Posted 2018-09-13 19:32:09 »

Cmon, this code is also 10(!) years old Smiley 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 Smiley


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

Blog | Last game Drone Swarm
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1865 views)
2018-06-10 19:43:48

EgonOlsen (1888 views)
2018-06-10 19:43:44

EgonOlsen (1256 views)
2018-06-10 19:43:20

DesertCoockie (1688 views)
2018-05-13 18:23:11

nelsongames (1357 views)
2018-04-24 18:15:36

nelsongames (1976 views)
2018-04-24 18:14:32

ivj94 (2743 views)
2018-03-24 14:47:39

ivj94 (1945 views)
2018-03-24 14:46:31

ivj94 (3036 views)
2018-03-24 14:43:53

Solater (1088 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!