Skip to content

Commit

Permalink
Merge pull request #116 from Metaphoriker/trunk
Browse files Browse the repository at this point in the history
first step to pave pathetic the path to universality (4.0)
  • Loading branch information
Metaphoriker authored Dec 27, 2024
2 parents 0b46132 + 0ee34a6 commit 3b71b4a
Show file tree
Hide file tree
Showing 131 changed files with 2,354 additions and 2,388 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/attach_jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ jobs:

- name: Build Pathetic-Example
run: |
mvn -U -V -e -B -ntp clean install compile package -pl pathetic-example -amd -DskipTests
mvn -U -V -e -B -ntp clean install compile package -pl pathetic-bukkit/pathetic-example -amd -DskipTests
- name: Upload Pathetic-Example
uses: actions/upload-artifact@v3
with:
name: pathetic-example
path: D:\a\pathetic\pathetic\pathetic-example\target\pathetic-example.jar
path: D:\a\pathetic\pathetic\pathetic-bukkit\pathetic-example\target\pathetic-example.jar

- name: Attach pathetic-example jar to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: D:\a\pathetic\pathetic\pathetic-example\target\pathetic-example.jar
asset_path: D:\a\pathetic\pathetic\pathetic-bukkit\pathetic-example\target\pathetic-example.jar
asset_name: pathetic-example.jar
asset_content_type: application/java-archive
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: pathetic-${{ fromJSON(steps.determine.outputs.result).pr }}
path: pathetic-example/target/pathetic-example-*-SNAPSHOT.jar
path: pathetic-bukkit/pathetic-example/target/pathetic-example.jar
17 changes: 0 additions & 17 deletions .github/workflows/code_quality.yml

This file was deleted.

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/target/
target/
/.idea/
*.iml
/PathingLegacy/target/
/PathingMain/target/
dependency-reduced-pom.xml
/javadoc/
695 changes: 21 additions & 674 deletions LICENSE

Large diffs are not rendered by default.

63 changes: 3 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,10 @@
<img src="https://github.com/user-attachments/assets/2f5335e3-b095-4e2f-a9de-e3ac46fbaf45" alt="Transparent" width="100" height="100" align="right" />
<br><br>

<h1>Pathetic - A Pathfinding library for Minecraft</h1>
<h1>Pathetic - A Pathfinding library for 3D environments</h1>

<p>A high-performance, backwards-compatible, and asynchronous easy-to-use pathfinding library written in Java.
<br> Pathetic leverages the <b>A* algorithm</b> with customizable heuristics for real-time pathfinding in <b>Spigot/Paper </b>environments.</p>

<h2>Key Features</h2>

<ul>
<li><b>Advanced A* Algorithm:</b> Employs multiple distance metrics (Manhattan, Octile, Perpendicular) and height differences for pathfinding, optimized for 3D worlds like Minecraft.</li>
<li><b>Asynchronous Pathfinding:</b> Non-blocking operations using <code>CompletableFuture</code> to minimize server impact during pathfinding.</li>
<li><b>Fibonacci Heap for Efficient Queuing:</b> The open set (frontier) is managed using a <b>Fibonacci heap</b>, ensuring optimal node retrieval with faster <code>insert</code> and <code>extract min</code> operations.</li>
<li><b>Customizable Heuristics:</b> Fine-tune pathfinding behavior using <code>HeuristicWeights</code> for balanced navigation in any world configuration.</li>
<li><b>Regional Grid Optimization:</b> Uses <code>ExpiringHashMap</code> and <b>Bloom filters</b> to efficiently track explored regions, minimizing memory overhead.</li>
<li><b>Dynamic Path Filters:</b> Define custom filters to modify node validity or prioritize paths based on criteria such as passability, block type, or world boundaries.</li>
</ul>

<h2>Showcase</h2>

![ezgif-3-caa688a773](https://github.com/user-attachments/assets/ab243485-f122-4067-bab0-a5ed97b717c1)

<h2>Installation</h2>

To integrate pathetic into your project, follow the following steps:
<br>
*(We advise you to relocate pathetic)*

<h3>Maven</h3>

```xml

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependency>
<groupId>com.github.Metaphoriker.pathetic</groupId>
<artifactId>pathetic-mapping</artifactId>
<version>VERSION</version>
</dependency>
```

<h3>Gradle</h3>

```groovy
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.Metaphoriker.pathetic:pathetic-mapping:VERSION'
}
```

<h2>Example Usage</h2>

<p>See the <a href="https://github.com/Metaphoriker/pathetic/tree/trunk/pathetic-example">pathetic-example</a> module for a detailed example usage.</p>
<p>A high-performance, backwards-compatible, and asynchronous easy-to-use pathfinding library written in Java for 3D environments.
<br> Pathetic leverages the <b>A* algorithm</b> with customizable heuristics for real-time pathfinding.</p>

<h2>Documentation</h2>

Expand Down
4 changes: 4 additions & 0 deletions pathetic-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# API
The API of Pathetic.

For a better overview [check the javadocs](https://javadocs.pathetic.ollieee.xyz/).
15 changes: 2 additions & 13 deletions pathetic-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@
<parent>
<artifactId>pathetic-main</artifactId>
<groupId>de.metaphoriker</groupId>
<version>3.3.1</version>
<version>4.0</version>
</parent>

<artifactId>pathetic-api</artifactId>
<version>3.3.1</version>

<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<version>4.0</version>
</project>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package de.metaphoriker.pathetic.api.factory;

import de.metaphoriker.pathetic.api.pathing.Pathfinder;
import de.metaphoriker.pathetic.api.pathing.configuration.PathfinderConfiguration;

/**
* A factory interface for creating {@link Pathfinder} instances.
*/
public interface PathfinderFactory {

/**
* Creates a new {@link Pathfinder} instance with the given configuration.
*
* @param configuration The configuration for the pathfinder.
* @return A new {@link Pathfinder} instance.
*/
Pathfinder createPathfinder(PathfinderConfiguration configuration);

/**
* Creates a new {@link Pathfinder} instance with the given configuration and initializer. This method
* first creates a pathfinder using the {@link #createPathfinder(PathfinderConfiguration)} method and then
* initializes it using the provided {@link PathfinderInitializer}.
*
* @param configuration The configuration for the pathfinder.
* @param initializer The initializer to use for initializing the pathfinder.
* @return A new, initialized {@link Pathfinder} instance.
*/
default Pathfinder createPathfinder(PathfinderConfiguration configuration, PathfinderInitializer initializer) {
Pathfinder pathfinder = createPathfinder(configuration);
initializer.initialize(pathfinder, configuration);
return pathfinder;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.metaphoriker.pathetic.api.factory;

import de.metaphoriker.pathetic.api.pathing.Pathfinder;
import de.metaphoriker.pathetic.api.pathing.configuration.PathfinderConfiguration;

/**
* An interface for initializing {@link Pathfinder} instances.
*/
public interface PathfinderInitializer {

/**
* Initializes the given {@link Pathfinder} with the given {@link PathfinderConfiguration}.
*
* @param pathfinder The pathfinder to initialize.
* @param configuration The configuration for the pathfinder.
*/
void initialize(Pathfinder pathfinder, PathfinderConfiguration configuration);
}
Loading

0 comments on commit 3b71b4a

Please sign in to comment.