Pathetic
A high-performance pathfinding library for 3D environments
Overview
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.
- ⚡ High Performance: Optimized for real-time pathfinding in 3D environments
- 🔄 Asynchronous: Non-blocking pathfinding operations
- 🧩 Extensible: Customizable through hooks, validators, and cost processors
- 🛠️ Configurable: Fine-tune the algorithm with custom heuristic weights
- 🔍 Robust: Handles edge cases with fallback mechanisms
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.
Modules
Pathetic consists of two main modules:
🔌 API
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.
⚙️ Engine
The Engine module implements the interfaces defined in the API and provides the actual pathfinding algorithms and logic.
Installation
Maven
<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>
Gradle
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'
}
Quick Start
// 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...
}
});
Documentation
Coming Soon: A comprehensive wiki will be built in the repository's GitHub Wiki section to provide more detailed documentation, tutorials, and examples.
Example Implementation
For a practical implementation of Pathetic, check out pathetic-bukkit.
Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For major changes, please open an issue first to discuss what you would like to change.
Community
- Join our Discord server to get in touch with the developers and community
- Report bugs or request features through GitHub Issues
Acknowledgements
- Special thanks to @Ollie, the co-founder of Pathetic, who helped build the library in its early stages
License
This project is licensed under the MIT License - see the LICENSE file for details.
Powered by
Thanks for sponsoring this project!