hex-world
    Preparing search index...

    Function createDomainCost

    • Build a MoveCostFn that enforces a movement domain, delegating the per-cell prices to landCost / navalCost. The returned function is what findPath, getMovementRange, and computeFlowField all take, so one unit type's rules are written once and shared by every search.

      const shipCost = createDomainCost({ map, isLiquid: world.isWater, domain: 'naval' });
      const path = findPath(from, to, shipCost, map);

      Parameters

      Returns MoveCostFn