Java Clean Architecture Masterclass

Java Clean Architecture MasterclassNov 20-21

Join

Pathetic

A high-performance pathfinding library for 3D environments

Build Status License Javadocs Discord

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.

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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For major changes, please open an issue first to discuss what you would like to change.

Community

Acknowledgements

License

This project is licensed under the MIT License - see the LICENSE file for details.

Powered by

JetBrains logo.

Thanks for sponsoring this project!

Join libs.tech

...and unlock some superpowers

GitHub

We won't share your data with anyone else.