Skip to content

PathfinderConfiguration

Benjamin Sommerfeld edited this page Jan 30, 2026 · 6 revisions

This is the control panel.

Pathetic comes with sensible defaults optimized for standard Minecraft-like environments. However, if you want to squeeze out every microsecond or support weird movement types, use the PathfinderConfiguration builder.

PathfinderConfiguration config = PathfinderConfiguration.builder()
        // Threading & Safety
        .async(true)
        .fallback(true)
        .maxIterations(50_000)
        .maxLength(200)
        
        // Physics & Math
        .neighborStrategy(NeighborStrategies.DIAGONAL_3D)
        .heuristicStrategy(HeuristicStrategies.SQUARED)
        .heuristicWeights(HeuristicWeights.create(0.5, 1, 0.7, 0.3))
        
        // Logic
        .provider(new NavigationPointProviderImpl())
        .pathfindingHooks(List.of(new DebugPathfindingHook))
        .costProcessors(List.of(new BasicCostProcessor()))
        .validationProcessors(List.of(Validators.not(new BasicValidator())))
        .build();

Safety & Sanity

Control how hard the engine works before it gives up.

  • maxIterations(int) The hard kill-switch. Stops the search to prevent infinite loops or server freezes.

    • Default: 5000
  • maxLength(int) The maximum path length. Use this to prevent NPCs from trying to calculate a path to the other side of the world map.

    • Default: 0 (No limit)
  • async(boolean) If true, calculation happens off the main thread. Enable this. Blocking the main thread is 2010 behavior.

    • Default: false (Safety first, but please change it)
  • fallback(boolean) If the target is unreachable, return the closest reachable point instead of failing. Better to walk halfway than to stand still looking stupid.

    • Default: true

Algorithm Behavior

How the math works.

  • neighborStrategy(INeighborStrategy) Defines valid moves. Do you want boring NES-style movement (Cardinal) or full 3D freedom?

    • Default: VERTICAL_AND_HORIZONTAL (Manhattan)
  • heuristicStrategy(IHeuristicStrategy) The formula used to guess the distance. LINEAR is accurate. SQUARED is faster but slightly dumber.

    • Default: LINEAR
  • heuristicWeights(HeuristicWeights) The bias. Use this to make the pathfinder hate jumping or love going straight.

    • Default: DEFAULT_WEIGHTS

Environment & Logic

Where the rubber meets the road.

  • provider(NavigationPointProvider) The Bridge. This connects Pathetic to your actual game data. If you don't set this, the pathfinder thinks the world is empty.

    • Default: A dummy provider (Everything is walkable).
  • pathfindingHooks The Spy. Attaches a listener that triggers on every single step of the algorithm.

    • Use case: Drawing debug particles in-game to visualize the search.
    • Warning: This slows things down. Don't leave it on in production unless you hate performance.
  • validationProcessors The Bouncers. Custom rules to ban nodes (e.g., "Don't walk into lava", "Don't enter private regions").

    • Default: None.
  • costProcessors The Taxman. Makes nodes expensive without blocking them (e.g., "Walking through mud costs double").

    • Default: None.

The Dark Arts (Memory Management)

These settings control the Bloom Filters and Grid Regions.

Warning: Touch these only if you understand probability theory or enjoy OutOfMemoryError.

  • gridCellSize(int) The world is sliced into chunks (regions). This defines how big those chunks are.

    • Default: 12
  • bloomFilterSize(int) The size of the bit-array for each region. Larger = fewer collisions, more RAM.

    • Default: 1000
  • bloomFilterFpp(double) The acceptable "False Positive Probability". Lower = better accuracy, massive memory usage.

    • Default: 0.01 (1%)

The camera (Monitoring)

In order to monitor the current pathfinding operation (for debugging purposes for example) you can register hooks to the PathfinderConfiguration.

  • pathfindingHooks(List<PathfindingHook>)

Clone this wiki locally