A highly configurable A* pathfinding library for Java, designed for extensibility through custom node validation and cost processing. Ideal for 3D environments and game development.
Pathetic is a highly configurable A* pathfinding library for Java, designed for extensibility through custom node validation and cost processing. It’s ideal for 3D environments and game development.
Note: pathetic-bukkit was originally part of the repository but has been moved to its own repository for better modularity and to serve a wider range of applications.
Pathetic consists of two main modules:
The API module defines the interfaces and classes that form the public API of the library. It provides a clean interface for configuring and executing pathfinding operations.
The Engine module implements the interfaces defined in the API and provides the actual pathfinding algorithms and logic.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- API only -->
<dependency>
<groupId>com.github.bsommerfeld.pathetic</groupId>
<artifactId>api</artifactId>
<version>5.0.0</version>
</dependency>
<!-- Engine implementation -->
<dependency>
<groupId>com.github.bsommerfeld.pathetic</groupId>
<artifactId>engine</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
// API only
implementation 'com.github.bsommerfeld.pathetic:api:5.0.0'
// Engine implementation
implementation 'com.github.bsommerfeld.pathetic:engine:5.0.0'
}
// Create a navigation point provider
NavigationPointProvider provider = new MyNavigationPointProvider();
// Create a configuration
PathfinderConfiguration config = PathfinderConfiguration.builder()
.maxIterations(1000)
.maxLength(100)
.async(true)
.provider(provider)
.heuristicWeights(HeuristicWeights.NATURAL_PATH_WEIGHTS)
.build();
// Create a pathfinder
PathfinderFactory factory = new AStarPathfinderFactory();
Pathfinder pathfinder = factory.createPathfinder(config);
// Define start and target positions
PathPosition start = new PathPosition(environment, 0, 0, 0);
PathPosition target = new PathPosition(environment, 10, 5, 10);
// Find a path
CompletionStage<PathfinderResult> resultFuture = pathfinder.findPath(start, target);
// Handle the result
resultFuture.thenAccept(result -> {
if (result.successful()) {
Path path = result.getPath();
// Use the path...
} else {
// Handle failure...
}
});
Coming Soon: A comprehensive wiki will be built in the repository’s GitHub Wiki section to provide more detailed documentation, tutorials, and examples.
For a practical implementation of Pathetic, check out pathetic-bukkit.
We welcome contributions! Here’s how you can help:
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Thanks for sponsoring this project!