I'm an amateur game developer and somewhat amateur Java developer as well. I'm trying to find a way to have path finding for my game(s). I've first Googled for some existing Java libraries that have various path-finding implementations, but I've failed to find any. It seems to me that the only way to get pathfinding code is to use it via a game engine (like Unity). But I'd just like to have a library that I can use and make the game loop and other stuff on my own.

Failing to find such a library I've tried implementing some algorithms myself. I've managed to make a running A* in Java, but for fancier stuff like D* I find it hard to do it by hand.

So then, my question is, are there any Java libraries that contain at least some basic pathfinding algorithms implementations?

share|improve this question

D* is obsolete, use D*-Lite (which does the same thing, only faster and easier to implement) – BlueRaja - Danny Pflughoeft Aug 30 at 18:57
feedback

1 Answer

up vote 7 down vote accepted

Path finding libraries are not too common for general use. This is because the algorithm interacts directly with your world. The algorithm can't know in advance how you'll lay out your data structures for holding your world data. The amount of user required implementation for these algorithms would likely override the usefulness of providing the algorithm in library form. The more complex the algorithm, the more work it would be to make a generalized version for a library form. So you're less likely to really get what you want, the harder-to-implement algorithms won't be in library form. There are some libraries available, though I haven't used them, so I can't say how much work they are to use. Personally I would rather implement them myself so I can learn how they work and ensure they're properly integrated.

It may be useful to look at the libraries to get some implementation tips, but I don't think these will be implemented in the same way you would implement them. Since they need to overcome the issues I mentioned earlier, they might have some strange implementations.

For 2D, Slick2D has some built-in path finding for tile based games. StackFrame implements some simple pathfinding algorithms with PathFinder.

share|improve this answer
Thanks, Slick looks promising, and not just for the path-finding stuff. – Shivan Dragon Aug 30 at 15:17
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.