@esengine/pathfinding 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
- // 广度优先搜索算法模块 v1.0.1
2
- export { Vector2Utils } from './Types/IVector2';
3
- export { PriorityQueue } from './Utils/PriorityQueue';
4
- export { AStarPathfinder } from './AI/Pathfinding/AStar/AStarPathfinder';
5
- export { AstarGridGraph } from './AI/Pathfinding/AStar/AstarGridGraph';
6
- export { BreadthFirstPathfinder } from './AI/Pathfinding/BreadthFirst/BreadthFirstPathfinder';
7
- export { UnweightedGraph } from './AI/Pathfinding/BreadthFirst/UnweightedGraph';
8
- export { UnweightedGridGraph } from './AI/Pathfinding/BreadthFirst/UnweightedGridGraph';
9
-
1
+ /**
2
+ * @esengine/pathfinding v1.0.2
3
+ * 高性能寻路算法库 - 支持A*、广度优先等算法,适用于Cocos Creator、Laya等游戏引擎
4
+ *
5
+ * @author yhh
6
+ * @license MIT
7
+ */
10
8
  var Vector2Utils = (function () {
11
9
  function Vector2Utils() {
12
10
  }
@@ -50,7 +48,6 @@ var Vector2Utils = (function () {
50
48
  Vector2Utils.MAX_COORD = 32767;
51
49
  return Vector2Utils;
52
50
  }());
53
- export { Vector2Utils };
54
51
 
55
52
  var PriorityQueue = (function () {
56
53
  function PriorityQueue() {
@@ -132,9 +129,8 @@ var PriorityQueue = (function () {
132
129
  };
133
130
  return PriorityQueue;
134
131
  }());
135
- export { PriorityQueue };
136
132
 
137
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
133
+ var __spreadArray = (globalThis && globalThis.__spreadArray) || function (to, from, pack) {
138
134
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
139
135
  if (ar || !(i in from)) {
140
136
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@@ -143,8 +139,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
143
139
  }
144
140
  return to.concat(ar || Array.prototype.slice.call(from));
145
141
  };
146
- import { Vector2Utils } from '../../../Types/IVector2';
147
- import { PriorityQueue } from '../../../Utils/PriorityQueue';
148
142
  var AStarNode = (function () {
149
143
  function AStarNode(node, gCost, hCost, parent) {
150
144
  if (gCost === void 0) { gCost = 0; }
@@ -310,10 +304,7 @@ var AStarPathfinder = (function () {
310
304
  AStarPathfinder._tempPath = [];
311
305
  return AStarPathfinder;
312
306
  }());
313
- export { AStarPathfinder };
314
307
 
315
- import { Vector2Utils } from '../../../Types/IVector2';
316
- import { AStarPathfinder } from './AStarPathfinder';
317
308
  var AstarGridGraph = (function () {
318
309
  function AstarGridGraph(width, height) {
319
310
  this.dirs = [
@@ -423,11 +414,7 @@ var AstarGridGraph = (function () {
423
414
  };
424
415
  return AstarGridGraph;
425
416
  }());
426
- export { AstarGridGraph };
427
-
428
- export {};
429
417
 
430
- import { Vector2Utils } from '../../../Types/IVector2';
431
418
  var BreadthFirstPathfinder = (function () {
432
419
  function BreadthFirstPathfinder() {
433
420
  }
@@ -485,9 +472,6 @@ var BreadthFirstPathfinder = (function () {
485
472
  };
486
473
  return BreadthFirstPathfinder;
487
474
  }());
488
- export { BreadthFirstPathfinder };
489
-
490
- export {};
491
475
 
492
476
  var UnweightedGraph = (function () {
493
477
  function UnweightedGraph() {
@@ -502,10 +486,7 @@ var UnweightedGraph = (function () {
502
486
  };
503
487
  return UnweightedGraph;
504
488
  }());
505
- export { UnweightedGraph };
506
489
 
507
- import { Vector2Utils } from '../../../Types/IVector2';
508
- import { BreadthFirstPathfinder } from './BreadthFirstPathfinder';
509
490
  var UnweightedGridGraph = (function () {
510
491
  function UnweightedGridGraph(width, height, allowDiagonalSearch) {
511
492
  if (allowDiagonalSearch === void 0) { allowDiagonalSearch = false; }
@@ -556,4 +537,6 @@ var UnweightedGridGraph = (function () {
556
537
  ];
557
538
  return UnweightedGridGraph;
558
539
  }());
559
- export { UnweightedGridGraph };
540
+
541
+ export { AStarPathfinder, AstarGridGraph, BreadthFirstPathfinder, PriorityQueue, UnweightedGraph, UnweightedGridGraph, Vector2Utils };
542
+ //# sourceMappingURL=pathfinding.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathfinding.mjs","sources":["../bin/Types/IVector2.js","../bin/Utils/PriorityQueue.js","../bin/AI/Pathfinding/AStar/AStarPathfinder.js","../bin/AI/Pathfinding/AStar/AstarGridGraph.js","../bin/AI/Pathfinding/BreadthFirst/BreadthFirstPathfinder.js","../bin/AI/Pathfinding/BreadthFirst/UnweightedGraph.js","../bin/AI/Pathfinding/BreadthFirst/UnweightedGridGraph.js"],"sourcesContent":["var Vector2Utils = (function () {\n function Vector2Utils() {\n }\n Vector2Utils.equals = function (a, b) {\n if (a.equals) {\n return a.equals(b);\n }\n return a.x === b.x && a.y === b.y;\n };\n Vector2Utils.create = function (x, y) {\n return { x: x, y: y };\n };\n Vector2Utils.clone = function (vector) {\n return { x: vector.x, y: vector.y };\n };\n Vector2Utils.add = function (a, b) {\n return { x: a.x + b.x, y: a.y + b.y };\n };\n Vector2Utils.manhattanDistance = function (a, b) {\n return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);\n };\n Vector2Utils.distance = function (a, b) {\n var dx = a.x - b.x;\n var dy = a.y - b.y;\n return Math.sqrt(dx * dx + dy * dy);\n };\n Vector2Utils.toHash = function (vector) {\n var x = (vector.x + this.MAX_COORD) | 0;\n var y = (vector.y + this.MAX_COORD) | 0;\n return (x << 16) | y;\n };\n Vector2Utils.toKey = function (vector) {\n return \"\".concat(vector.x, \",\").concat(vector.y);\n };\n Vector2Utils.fromHash = function (hash) {\n var x = (hash >> 16) - this.MAX_COORD;\n var y = (hash & 0xFFFF) - this.MAX_COORD;\n return { x: x, y: y };\n };\n Vector2Utils.HASH_MULTIPLIER = 73856093;\n Vector2Utils.MAX_COORD = 32767;\n return Vector2Utils;\n}());\nexport { Vector2Utils };\n","var PriorityQueue = (function () {\n function PriorityQueue() {\n this._heap = [];\n this._size = 0;\n }\n Object.defineProperty(PriorityQueue.prototype, \"size\", {\n get: function () {\n return this._size;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PriorityQueue.prototype, \"isEmpty\", {\n get: function () {\n return this._size === 0;\n },\n enumerable: false,\n configurable: true\n });\n PriorityQueue.prototype.clear = function () {\n this._heap.length = 0;\n this._size = 0;\n };\n PriorityQueue.prototype.enqueue = function (item) {\n this._heap[this._size] = item;\n this._bubbleUp(this._size);\n this._size++;\n };\n PriorityQueue.prototype.dequeue = function () {\n if (this._size === 0) {\n return undefined;\n }\n var result = this._heap[0];\n this._size--;\n if (this._size > 0) {\n this._heap[0] = this._heap[this._size];\n this._bubbleDown(0);\n }\n return result;\n };\n PriorityQueue.prototype.peek = function () {\n return this._size > 0 ? this._heap[0] : undefined;\n };\n PriorityQueue.prototype._bubbleUp = function (index) {\n while (index > 0) {\n var parentIndex = Math.floor((index - 1) / 2);\n if (this._heap[index].priority >= this._heap[parentIndex].priority) {\n break;\n }\n this._swap(index, parentIndex);\n index = parentIndex;\n }\n };\n PriorityQueue.prototype._bubbleDown = function (index) {\n while (true) {\n var minIndex = index;\n var leftChild = 2 * index + 1;\n var rightChild = 2 * index + 2;\n if (leftChild < this._size &&\n this._heap[leftChild].priority < this._heap[minIndex].priority) {\n minIndex = leftChild;\n }\n if (rightChild < this._size &&\n this._heap[rightChild].priority < this._heap[minIndex].priority) {\n minIndex = rightChild;\n }\n if (minIndex === index) {\n break;\n }\n this._swap(index, minIndex);\n index = minIndex;\n }\n };\n PriorityQueue.prototype._swap = function (i, j) {\n var temp = this._heap[i];\n this._heap[i] = this._heap[j];\n this._heap[j] = temp;\n };\n return PriorityQueue;\n}());\nexport { PriorityQueue };\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { Vector2Utils } from '../../../Types/IVector2';\nimport { PriorityQueue } from '../../../Utils/PriorityQueue';\nvar AStarNode = (function () {\n function AStarNode(node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n this.priority = 0;\n this.gCost = 0;\n this.hCost = 0;\n this.parent = null;\n this.hash = 0;\n this.node = node;\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n this.hash = Vector2Utils.toHash(node);\n }\n AStarNode.prototype.updateCosts = function (gCost, hCost, parent) {\n if (parent === void 0) { parent = null; }\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n };\n AStarNode.prototype.updateNode = function (node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n this.node = node;\n this.gCost = gCost;\n this.hCost = hCost;\n this.priority = gCost + hCost;\n this.parent = parent;\n this.hash = Vector2Utils.toHash(node);\n };\n AStarNode.prototype.reset = function () {\n this.node = null;\n this.priority = 0;\n this.gCost = 0;\n this.hCost = 0;\n this.parent = null;\n this.hash = 0;\n };\n return AStarNode;\n}());\nvar AStarPathfinder = (function () {\n function AStarPathfinder() {\n }\n AStarPathfinder._getNode = function (node, gCost, hCost, parent) {\n if (gCost === void 0) { gCost = 0; }\n if (hCost === void 0) { hCost = 0; }\n if (parent === void 0) { parent = null; }\n var astarNode = this._nodePool.pop();\n if (!astarNode) {\n astarNode = new AStarNode(node, gCost, hCost, parent);\n }\n else {\n astarNode.updateNode(node, gCost, hCost, parent);\n }\n return astarNode;\n };\n AStarPathfinder._recycleNode = function (node) {\n if (this._nodePool.length < 1000) {\n node.reset();\n this._nodePool.push(node);\n }\n };\n AStarPathfinder.search = function (graph, start, goal) {\n var openSet = new PriorityQueue();\n var closedSet = new Set();\n var openSetMap = new Map();\n var startHash = Vector2Utils.toHash(start);\n var goalHash = Vector2Utils.toHash(goal);\n if (startHash === goalHash) {\n return { found: true, goalNode: this._getNode(start, 0, 0) };\n }\n var startNode = this._getNode(start, 0, graph.heuristic(start, goal));\n openSet.enqueue(startNode);\n openSetMap.set(startHash, startNode);\n var goalNode;\n while (!openSet.isEmpty) {\n var current = openSet.dequeue();\n var currentHash = current.hash;\n openSetMap.delete(currentHash);\n if (currentHash === goalHash) {\n goalNode = current;\n break;\n }\n closedSet.add(currentHash);\n for (var _i = 0, _a = graph.getNeighbors(current.node); _i < _a.length; _i++) {\n var neighbor = _a[_i];\n var neighborHash = Vector2Utils.toHash(neighbor);\n if (closedSet.has(neighborHash)) {\n continue;\n }\n var tentativeGScore = current.gCost + graph.cost(current.node, neighbor);\n var existingNode = openSetMap.get(neighborHash);\n if (existingNode) {\n if (tentativeGScore < existingNode.gCost) {\n var hCost = existingNode.hCost;\n existingNode.updateCosts(tentativeGScore, hCost, current);\n }\n }\n else {\n var hCost = graph.heuristic(neighbor, goal);\n var neighborNode = this._getNode(neighbor, tentativeGScore, hCost, current);\n openSet.enqueue(neighborNode);\n openSetMap.set(neighborHash, neighborNode);\n }\n }\n if (current !== goalNode) {\n this._recycleNode(current);\n }\n }\n while (!openSet.isEmpty) {\n var node = openSet.dequeue();\n if (node !== goalNode) {\n this._recycleNode(node);\n }\n }\n return { found: !!goalNode, goalNode: goalNode };\n };\n AStarPathfinder.searchPath = function (graph, start, goal) {\n var result = this.search(graph, start, goal);\n if (!result.found || !result.goalNode) {\n return [];\n }\n return this.reconstructPathFromNode(result.goalNode, start);\n };\n AStarPathfinder.reconstructPathFromNode = function (goalNode, start) {\n this._tempPath.length = 0;\n var current = goalNode;\n var startHash = Vector2Utils.toHash(start);\n while (current) {\n this._tempPath.unshift(current.node);\n var currentHash = current.hash;\n var parent_1 = current.parent;\n if (currentHash !== startHash) {\n this._recycleNode(current);\n }\n current = parent_1;\n }\n return __spreadArray([], this._tempPath, true);\n };\n AStarPathfinder.hasPath = function (graph, start, goal) {\n var result = this.search(graph, start, goal);\n if (result.goalNode) {\n this._recycleNode(result.goalNode);\n }\n return result.found;\n };\n AStarPathfinder.clearPool = function () {\n this._nodePool.length = 0;\n this._tempPath.length = 0;\n };\n AStarPathfinder.getPoolStats = function () {\n return {\n poolSize: this._nodePool.length,\n maxPoolSize: 1000\n };\n };\n AStarPathfinder._nodePool = [];\n AStarPathfinder._tempPath = [];\n return AStarPathfinder;\n}());\nexport { AStarPathfinder };\n","import { Vector2Utils } from '../../../Types/IVector2';\nimport { AStarPathfinder } from './AStarPathfinder';\nvar AstarGridGraph = (function () {\n function AstarGridGraph(width, height) {\n this.dirs = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(0, 1)\n ];\n this.walls = [];\n this.weightedNodes = [];\n this.defaultWeight = 1;\n this.weightedNodeWeight = 5;\n this._neighbors = new Array(4);\n this._wallsSet = new Set();\n this._weightedNodesSet = new Set();\n this._wallsDirty = true;\n this._weightedNodesDirty = true;\n this._width = width;\n this._height = height;\n }\n AstarGridGraph.prototype.addWall = function (wall) {\n this.walls.push(wall);\n this._wallsDirty = true;\n };\n AstarGridGraph.prototype.addWalls = function (walls) {\n var _a;\n (_a = this.walls).push.apply(_a, walls);\n this._wallsDirty = true;\n };\n AstarGridGraph.prototype.clearWalls = function () {\n this.walls.length = 0;\n this._wallsSet.clear();\n this._wallsDirty = false;\n };\n AstarGridGraph.prototype.addWeightedNode = function (node) {\n this.weightedNodes.push(node);\n this._weightedNodesDirty = true;\n };\n AstarGridGraph.prototype.addWeightedNodes = function (nodes) {\n var _a;\n (_a = this.weightedNodes).push.apply(_a, nodes);\n this._weightedNodesDirty = true;\n };\n AstarGridGraph.prototype.clearWeightedNodes = function () {\n this.weightedNodes.length = 0;\n this._weightedNodesSet.clear();\n this._weightedNodesDirty = false;\n };\n AstarGridGraph.prototype._updateHashSets = function () {\n if (this._wallsDirty) {\n this._wallsSet.clear();\n for (var _i = 0, _a = this.walls; _i < _a.length; _i++) {\n var wall = _a[_i];\n this._wallsSet.add(Vector2Utils.toHash(wall));\n }\n this._wallsDirty = false;\n }\n if (this._weightedNodesDirty) {\n this._weightedNodesSet.clear();\n for (var _b = 0, _c = this.weightedNodes; _b < _c.length; _b++) {\n var node = _c[_b];\n this._weightedNodesSet.add(Vector2Utils.toHash(node));\n }\n this._weightedNodesDirty = false;\n }\n };\n AstarGridGraph.prototype.isNodeInBounds = function (node) {\n return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;\n };\n AstarGridGraph.prototype.isNodePassable = function (node) {\n this._updateHashSets();\n return !this._wallsSet.has(Vector2Utils.toHash(node));\n };\n AstarGridGraph.prototype.search = function (start, goal) {\n return AStarPathfinder.hasPath(this, start, goal);\n };\n AstarGridGraph.prototype.searchPath = function (start, goal) {\n return AStarPathfinder.searchPath(this, start, goal);\n };\n AstarGridGraph.prototype.getNeighbors = function (node) {\n this._neighbors.length = 0;\n for (var _i = 0, _a = this.dirs; _i < _a.length; _i++) {\n var dir = _a[_i];\n var next = Vector2Utils.add(node, dir);\n if (this.isNodeInBounds(next) && this.isNodePassable(next)) {\n this._neighbors.push(next);\n }\n }\n return this._neighbors;\n };\n AstarGridGraph.prototype.cost = function (from, to) {\n this._updateHashSets();\n return this._weightedNodesSet.has(Vector2Utils.toHash(to)) ? this.weightedNodeWeight : this.defaultWeight;\n };\n AstarGridGraph.prototype.heuristic = function (node, goal) {\n return Vector2Utils.manhattanDistance(node, goal);\n };\n AstarGridGraph.prototype.getStats = function () {\n this._updateHashSets();\n return {\n walls: this.walls.length,\n weightedNodes: this.weightedNodes.length,\n gridSize: \"\".concat(this._width, \"x\").concat(this._height),\n wallsSetSize: this._wallsSet.size,\n weightedNodesSetSize: this._weightedNodesSet.size\n };\n };\n return AstarGridGraph;\n}());\nexport { AstarGridGraph };\n","import { Vector2Utils } from '../../../Types/IVector2';\nvar BreadthFirstPathfinder = (function () {\n function BreadthFirstPathfinder() {\n }\n BreadthFirstPathfinder.search = function (graph, start, goal, cameFrom) {\n var frontier = [];\n var visited = new Set();\n var pathMap = cameFrom || new Map();\n var startHash = Vector2Utils.toHash(start);\n var goalHash = Vector2Utils.toHash(goal);\n if (startHash === goalHash) {\n return true;\n }\n frontier.push(start);\n visited.add(startHash);\n while (frontier.length > 0) {\n var current = frontier.shift();\n var currentHash = Vector2Utils.toHash(current);\n if (currentHash === goalHash) {\n return true;\n }\n for (var _i = 0, _a = graph.getNeighbors(current); _i < _a.length; _i++) {\n var neighbor = _a[_i];\n var neighborHash = Vector2Utils.toHash(neighbor);\n if (visited.has(neighborHash)) {\n continue;\n }\n visited.add(neighborHash);\n pathMap.set(neighborHash, current);\n frontier.push(neighbor);\n }\n }\n return false;\n };\n BreadthFirstPathfinder.searchPath = function (graph, start, goal) {\n var cameFrom = new Map();\n if (this.search(graph, start, goal, cameFrom)) {\n return this.reconstructPath(cameFrom, start, goal);\n }\n return [];\n };\n BreadthFirstPathfinder.reconstructPath = function (cameFrom, start, goal) {\n var path = [];\n var current = goal;\n var startHash = Vector2Utils.toHash(start);\n while (Vector2Utils.toHash(current) !== startHash) {\n path.unshift(current);\n var currentHash = Vector2Utils.toHash(current);\n var parent_1 = cameFrom.get(currentHash);\n if (!parent_1)\n break;\n current = parent_1;\n }\n path.unshift(start);\n return path;\n };\n return BreadthFirstPathfinder;\n}());\nexport { BreadthFirstPathfinder };\n","var UnweightedGraph = (function () {\n function UnweightedGraph() {\n this.edges = new Map();\n }\n UnweightedGraph.prototype.addEdgesForNode = function (node, neighbors) {\n this.edges.set(node, neighbors);\n return this;\n };\n UnweightedGraph.prototype.getNeighbors = function (node) {\n return this.edges.get(node) || [];\n };\n return UnweightedGraph;\n}());\nexport { UnweightedGraph };\n","import { Vector2Utils } from '../../../Types/IVector2';\nimport { BreadthFirstPathfinder } from './BreadthFirstPathfinder';\nvar UnweightedGridGraph = (function () {\n function UnweightedGridGraph(width, height, allowDiagonalSearch) {\n if (allowDiagonalSearch === void 0) { allowDiagonalSearch = false; }\n this.walls = [];\n this._neighbors = [];\n this._width = width;\n this._height = height;\n this._dirs = allowDiagonalSearch ? UnweightedGridGraph.COMPASS_DIRS : UnweightedGridGraph.CARDINAL_DIRS;\n }\n UnweightedGridGraph.prototype.isNodeInBounds = function (node) {\n return 0 <= node.x && node.x < this._width && 0 <= node.y && node.y < this._height;\n };\n UnweightedGridGraph.prototype.isNodePassable = function (node) {\n return !this.walls.find(function (wall) { return Vector2Utils.equals(wall, node); });\n };\n UnweightedGridGraph.prototype.getNeighbors = function (node) {\n this._neighbors.length = 0;\n for (var _i = 0, _a = this._dirs; _i < _a.length; _i++) {\n var dir = _a[_i];\n var next = Vector2Utils.add(node, dir);\n if (this.isNodeInBounds(next) && this.isNodePassable(next)) {\n this._neighbors.push(next);\n }\n }\n return this._neighbors;\n };\n UnweightedGridGraph.prototype.searchPath = function (start, goal) {\n return BreadthFirstPathfinder.searchPath(this, start, goal);\n };\n UnweightedGridGraph.prototype.hasPath = function (start, goal) {\n return BreadthFirstPathfinder.search(this, start, goal);\n };\n UnweightedGridGraph.CARDINAL_DIRS = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(0, 1)\n ];\n UnweightedGridGraph.COMPASS_DIRS = [\n Vector2Utils.create(1, 0),\n Vector2Utils.create(1, -1),\n Vector2Utils.create(0, -1),\n Vector2Utils.create(-1, -1),\n Vector2Utils.create(-1, 0),\n Vector2Utils.create(-1, 1),\n Vector2Utils.create(0, 1),\n Vector2Utils.create(1, 1),\n ];\n return UnweightedGridGraph;\n}());\nexport { UnweightedGridGraph };\n"],"names":["this"],"mappings":";;;;;;;AAAG,IAAC,YAAY,IAAI,YAAY;AAChC,IAAI,SAAS,YAAY,GAAG;AAC5B;AACA,IAAI,YAAY,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,EAAE;AAC1C,QAAQ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G;AACxC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AAChC,KAAK;AACL,IAAI,mBAAmB,CAAC,YAAY,GAAG;AACvC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC;AACnC,QAAQ,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,QAAQ,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,KAAK;AACL,IAAI,OAAO,mBAAmB;AAC9B,CAAC,EAAE;;;;"}
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@esengine/pathfinding",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "寻路算法库,支持A*、广度优先等算法,适用于Cocos Creator、Laya等游戏引擎",
5
- "main": "bin/index.js",
6
- "types": "bin/index.d.ts",
5
+ "main": "dist/pathfinding.cjs",
6
+ "module": "dist/pathfinding.mjs",
7
+ "types": "dist/pathfinding.d.ts",
8
+ "files": [
9
+ "dist/**/*",
10
+ "README.md",
11
+ "LICENSE"
12
+ ],
7
13
  "keywords": [
8
14
  "pathfinding",
9
15
  "astar",
@@ -22,30 +28,26 @@
22
28
  "scripts": {
23
29
  "test": "mocha --recursive --reporter tap --growl",
24
30
  "eslint": "eslint src --ext .ts",
25
- "build": "gulp build",
26
- "dev": "gulp buildJs"
31
+ "clean": "rimraf bin dist",
32
+ "build:ts": "tsc",
33
+ "prebuild": "npm run clean",
34
+ "build": "npm run build:ts && rollup -c",
35
+ "build:watch": "tsc --watch",
36
+ "rebuild": "npm run clean && npm run build",
37
+ "dev": "npm run build:ts && rollup -c --watch",
38
+ "publish:patch": "npm version patch && npm run build && npm publish"
27
39
  },
28
40
  "author": "yhh",
29
41
  "license": "MIT",
30
42
  "devDependencies": {
31
- "@babel/core": "^7.23.0",
32
- "@babel/preset-env": "^7.23.0",
33
- "browserify": "^17.0.0",
34
- "del": "^8.0.0",
35
- "gulp": "^5.0.0",
36
- "gulp-babel": "^8.0.0",
37
- "gulp-concat": "^2.6.1",
38
- "gulp-inject-string": "^1.1.2",
39
- "gulp-string-replace": "^1.1.2",
40
- "gulp-terser": "^2.1.0",
41
- "gulp-typescript": "^6.0.0-alpha.1",
42
- "tsify": "^5.0.4",
43
+ "@rollup/plugin-commonjs": "^28.0.3",
44
+ "@rollup/plugin-node-resolve": "^16.0.1",
45
+ "rimraf": "^5.0.0",
46
+ "rollup": "^4.42.0",
47
+ "rollup-plugin-dts": "^6.2.1",
43
48
  "typedoc": "^0.25.0",
44
- "typescript": "^4.9.5",
45
- "vinyl-source-stream": "^2.0.0",
46
- "watchify": "^4.0.0"
49
+ "typescript": "^5.8.3"
47
50
  },
48
-
49
51
  "dependencies": {
50
52
  "@esengine/ecs-framework": "^2.0.5"
51
53
  }
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/source.iml" filepath="$PROJECT_DIR$/.idea/source.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/source.iml DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
- </component>
6
- </project>
@@ -1,13 +0,0 @@
1
- {
2
- // See https://go.microsoft.com/fwlink/?LinkId=733558
3
- // for the documentation about the tasks.json format
4
- "version": "2.0.0",
5
- "tasks": [
6
- {
7
- "type": "gulp",
8
- "task": "build",
9
- "group": "build",
10
- "problemMatcher": []
11
- }
12
- ]
13
- }
@@ -1,3 +0,0 @@
1
- {
2
- "typescript.tsdk": "./node_modules/typescript/lib"
3
- }
package/bin/README.md DELETED
@@ -1,245 +0,0 @@
1
- # 寻路算法库
2
-
3
- 适用于Cocos Creator和Laya引擎的寻路算法库,支持A*和广度优先搜索算法。
4
-
5
- ## 特性
6
-
7
- - **多算法支持**:A*、广度优先搜索
8
- - **引擎兼容**:支持Cocos Creator和Laya引擎
9
- - **TypeScript**:完整的类型定义
10
- - **模块化**:支持按需加载
11
-
12
- ## 安装
13
-
14
- ```bash
15
- npm install @esengine/pathfinding
16
- ```
17
-
18
- ## 算法选择
19
-
20
- ### A*算法
21
- - **适用场景**:大部分游戏寻路需求
22
- - **特点**:支持权重地形,路径质量好
23
- - **推荐用于**:RPG、策略游戏、塔防游戏
24
-
25
- ### 广度优先搜索
26
- - **适用场景**:简单网格寻路
27
- - **特点**:保证最短路径(步数最少)
28
- - **推荐用于**:迷宫游戏、推箱子游戏
29
-
30
- ## 快速开始
31
-
32
- ### 基本使用
33
-
34
- ```typescript
35
- import { AstarGridGraph, Vector2Utils } from '@esengine/pathfinding';
36
-
37
- // 创建20x20的网格
38
- const graph = new AstarGridGraph(20, 20);
39
-
40
- // 添加障碍物
41
- graph.addWall(Vector2Utils.create(10, 10));
42
- graph.addWall(Vector2Utils.create(10, 11));
43
-
44
- // 添加难走地形(权重节点)
45
- graph.addWeightedNode(Vector2Utils.create(5, 5));
46
-
47
- // 搜索路径
48
- const start = Vector2Utils.create(0, 0);
49
- const goal = Vector2Utils.create(19, 19);
50
- const path = graph.searchPath(start, goal);
51
-
52
- console.log('路径:', path);
53
- ```
54
-
55
- ### 广度优先搜索
56
-
57
- ```typescript
58
- import { UnweightedGridGraph } from '@esengine/pathfinding';
59
-
60
- // 创建网格,支持对角线移动
61
- const graph = new UnweightedGridGraph(10, 10, true);
62
-
63
- // 添加障碍物
64
- graph.walls.push({ x: 5, y: 5 });
65
-
66
- // 搜索路径
67
- const path = graph.searchPath({ x: 0, y: 0 }, { x: 9, y: 9 });
68
- ```
69
-
70
- ### 按需加载
71
-
72
- ```typescript
73
- // 只使用A*算法
74
- import { AstarGridGraph } from '@esengine/pathfinding/modules/astar';
75
-
76
- // 只使用广度优先算法
77
- import { UnweightedGridGraph } from '@esengine/pathfinding/modules/breadth-first';
78
- ```
79
-
80
- ## 在游戏引擎中使用
81
-
82
- ### Cocos Creator
83
-
84
- ```typescript
85
- import { AstarGridGraph } from '@esengine/pathfinding';
86
-
87
- export default class PathfindingComponent extends cc.Component {
88
- private graph: AstarGridGraph;
89
-
90
- onLoad() {
91
- this.graph = new AstarGridGraph(50, 50);
92
- this.setupObstacles();
93
- }
94
-
95
- findPath(start: cc.Vec2, goal: cc.Vec2): cc.Vec2[] {
96
- return this.graph.searchPath(start, goal) as cc.Vec2[];
97
- }
98
-
99
- private setupObstacles() {
100
- // 添加地图障碍物
101
- for (let x = 10; x < 15; x++) {
102
- this.graph.addWall(cc.v2(x, 10));
103
- }
104
- }
105
- }
106
- ```
107
-
108
- ### Laya引擎
109
-
110
- ```typescript
111
- import { AstarGridGraph } from '@esengine/pathfinding';
112
-
113
- export class PathfindingManager {
114
- private graph: AstarGridGraph;
115
-
116
- constructor(mapWidth: number, mapHeight: number) {
117
- this.graph = new AstarGridGraph(mapWidth, mapHeight);
118
- }
119
-
120
- findPath(start: Laya.Vector2, goal: Laya.Vector2): Laya.Vector2[] {
121
- return this.graph.searchPath(start, goal) as Laya.Vector2[];
122
- }
123
-
124
- addObstacle(pos: Laya.Vector2) {
125
- this.graph.addWall(pos);
126
- }
127
- }
128
- ```
129
-
130
- ## API文档
131
-
132
- ### AstarGridGraph
133
-
134
- A*算法网格图实现。
135
-
136
- ```typescript
137
- const graph = new AstarGridGraph(width: number, height: number);
138
-
139
- // 属性
140
- graph.walls: IVector2[] // 障碍物数组
141
- graph.weightedNodes: IVector2[] // 加权节点数组
142
- graph.defaultWeight: number // 默认移动成本(默认1)
143
- graph.weightedNodeWeight: number // 加权节点成本(默认5)
144
-
145
- // 方法
146
- graph.searchPath(start, goal): IVector2[] // 搜索完整路径
147
- graph.search(start, goal): boolean // 检查是否存在路径
148
- graph.addWall(wall): void // 添加单个障碍物
149
- graph.addWalls(walls): void // 批量添加障碍物
150
- graph.clearWalls(): void // 清空障碍物
151
- graph.addWeightedNode(node): void // 添加加权节点
152
- graph.clearWeightedNodes(): void // 清空加权节点
153
- ```
154
-
155
- ### UnweightedGridGraph
156
-
157
- 广度优先搜索网格图实现。
158
-
159
- ```typescript
160
- const graph = new UnweightedGridGraph(
161
- width: number,
162
- height: number,
163
- allowDiagonal?: boolean // 是否允许对角线移动
164
- );
165
-
166
- // 属性
167
- graph.walls: IVector2[] // 障碍物数组
168
-
169
- // 方法
170
- graph.searchPath(start, goal): IVector2[] // 搜索完整路径
171
- graph.hasPath(start, goal): boolean // 检查是否存在路径
172
- ```
173
-
174
- ### Vector2Utils
175
-
176
- 向量操作工具类。
177
-
178
- ```typescript
179
- Vector2Utils.create(x, y) // 创建向量
180
- Vector2Utils.equals(a, b) // 判断相等
181
- Vector2Utils.add(a, b) // 向量加法
182
- Vector2Utils.manhattanDistance(a, b) // 曼哈顿距离
183
- Vector2Utils.distance(a, b) // 欧几里得距离
184
- ```
185
-
186
- ## 游戏场景示例
187
-
188
- ### 塔防游戏
189
-
190
- ```typescript
191
- // 敌人寻路到基地
192
- const graph = new AstarGridGraph(mapWidth, mapHeight);
193
- towers.forEach(tower => graph.addWall(tower.position));
194
- const path = graph.searchPath(spawnPoint, basePosition);
195
- ```
196
-
197
- ### RPG游戏
198
-
199
- ```typescript
200
- // 角色移动寻路,设置不同地形权重
201
- const graph = new AstarGridGraph(mapWidth, mapHeight);
202
- swampTiles.forEach(tile => graph.addWeightedNode(tile));
203
- graph.weightedNodeWeight = 3; // 沼泽地移动慢
204
- const path = graph.searchPath(playerPos, targetPos);
205
- ```
206
-
207
- ### 迷宫游戏
208
-
209
- ```typescript
210
- // 简单迷宫寻路
211
- const graph = new UnweightedGridGraph(mazeWidth, mazeHeight);
212
- walls.forEach(wall => graph.walls.push(wall));
213
- const path = graph.searchPath(startPos, exitPos);
214
- ```
215
-
216
- ## 文件结构
217
-
218
- ```
219
- bin/
220
- ├── pathfinding.js # 完整版本
221
- ├── pathfinding.min.js # 完整版本(压缩)
222
- ├── pathfinding.d.ts # TypeScript类型定义
223
- └── modules/ # 分模块版本
224
- ├── astar.js # A*算法模块
225
- ├── astar.min.js # A*算法模块(压缩)
226
- ├── breadth-first.js # 广度优先模块
227
- └── breadth-first.min.js # 广度优先模块(压缩)
228
- ```
229
-
230
- ## 开发
231
-
232
- ```bash
233
- # 安装依赖
234
- npm install
235
-
236
- # 构建
237
- npm run build
238
-
239
- # 清理构建目录
240
- gulp clean
241
- ```
242
-
243
- ## 许可证
244
-
245
- MIT License
@@ -1 +0,0 @@
1
- export{Vector2Utils}from"./Types/IVector2";export{PriorityQueue}from"./Utils/PriorityQueue";export{AStarPathfinder}from"./AI/Pathfinding/AStar/AStarPathfinder";export{AstarGridGraph}from"./AI/Pathfinding/AStar/AstarGridGraph";export{BreadthFirstPathfinder}from"./AI/Pathfinding/BreadthFirst/BreadthFirstPathfinder";export{UnweightedGraph}from"./AI/Pathfinding/BreadthFirst/UnweightedGraph";export{UnweightedGridGraph}from"./AI/Pathfinding/BreadthFirst/UnweightedGridGraph";var t=function(){function t(){}return t.equals=function(t,e){return t.equals?t.equals(e):t.x===e.x&&t.y===e.y},t.create=function(t,e){return{x:t,y:e}},t.clone=function(t){return{x:t.x,y:t.y}},t.add=function(t,e){return{x:t.x+e.x,y:t.y+e.y}},t.manhattanDistance=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},t.distance=function(t,e){var i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},t.toHash=function(t){return(t.x+this.MAX_COORD|0)<<16|(t.y+this.MAX_COORD|0)},t.toKey=function(t){return"".concat(t.x,",").concat(t.y)},t.fromHash=function(t){return{x:(t>>16)-this.MAX_COORD,y:(65535&t)-this.MAX_COORD}},t.HASH_MULTIPLIER=73856093,t.MAX_COORD=32767,t}();export{t as Vector2Utils};var e=function(){function t(){this._heap=[],this._size=0}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._heap.length=0,this._size=0},t.prototype.enqueue=function(t){this._heap[this._size]=t,this._bubbleUp(this._size),this._size++},t.prototype.dequeue=function(){if(0!==this._size){var t=this._heap[0];return this._size--,this._size>0&&(this._heap[0]=this._heap[this._size],this._bubbleDown(0)),t}},t.prototype.peek=function(){return this._size>0?this._heap[0]:void 0},t.prototype._bubbleUp=function(t){for(;t>0;){var e=Math.floor((t-1)/2);if(this._heap[t].priority>=this._heap[e].priority)break;this._swap(t,e),t=e}},t.prototype._bubbleDown=function(t){for(;;){var e=t,i=2*t+1,r=2*t+2;if(i<this._size&&this._heap[i].priority<this._heap[e].priority&&(e=i),r<this._size&&this._heap[r].priority<this._heap[e].priority&&(e=r),e===t)break;this._swap(t,e),t=e}},t.prototype._swap=function(t,e){var i=this._heap[t];this._heap[t]=this._heap[e],this._heap[e]=i},t}();export{e as PriorityQueue};var i=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var r,s=0,o=e.length;s<o;s++)!r&&s in e||(r||(r=Array.prototype.slice.call(e,0,s)),r[s]=e[s]);return t.concat(r||Array.prototype.slice.call(e))};import{Vector2Utils as t}from"../../../Types/IVector2";import{PriorityQueue as e}from"../../../Utils/PriorityQueue";var r=function(){function e(e,i,r,s){void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=null),this.priority=0,this.gCost=0,this.hCost=0,this.parent=null,this.hash=0,this.node=e,this.gCost=i,this.hCost=r,this.priority=i+r,this.parent=s,this.hash=t.toHash(e)}return e.prototype.updateCosts=function(t,e,i){void 0===i&&(i=null),this.gCost=t,this.hCost=e,this.priority=t+e,this.parent=i},e.prototype.updateNode=function(e,i,r,s){void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=null),this.node=e,this.gCost=i,this.hCost=r,this.priority=i+r,this.parent=s,this.hash=t.toHash(e)},e.prototype.reset=function(){this.node=null,this.priority=0,this.gCost=0,this.hCost=0,this.parent=null,this.hash=0},e}(),s=function(){function s(){}return s._getNode=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=null);var o=this._nodePool.pop();return o?o.updateNode(t,e,i,s):o=new r(t,e,i,s),o},s._recycleNode=function(t){this._nodePool.length<1e3&&(t.reset(),this._nodePool.push(t))},s.search=function(i,r,s){var o=new e,h=new Set,n=new Map,a=t.toHash(r),u=t.toHash(s);if(a===u)return{found:!0,goalNode:this._getNode(r,0,0)};var d,p=this._getNode(r,0,i.heuristic(r,s));for(o.enqueue(p),n.set(a,p);!o.isEmpty;){var c=o.dequeue(),l=c.hash;if(n.delete(l),l===u){d=c;break}h.add(l);for(var f=0,_=i.getNeighbors(c.node);f<_.length;f++){var g=_[f],y=t.toHash(g);if(!h.has(y)){var w=c.gCost+i.cost(c.node,g),N=n.get(y);if(N){if(w<N.gCost){var v=N.hCost;N.updateCosts(w,v,c)}}else{v=i.heuristic(g,s);var P=this._getNode(g,w,v,c);o.enqueue(P),n.set(y,P)}}}c!==d&&this._recycleNode(c)}for(;!o.isEmpty;){var S=o.dequeue();S!==d&&this._recycleNode(S)}return{found:!!d,goalNode:d}},s.searchPath=function(t,e,i){var r=this.search(t,e,i);return r.found&&r.goalNode?this.reconstructPathFromNode(r.goalNode,e):[]},s.reconstructPathFromNode=function(e,r){this._tempPath.length=0;for(var s=e,o=t.toHash(r);s;){this._tempPath.unshift(s.node);var h=s.hash,n=s.parent;h!==o&&this._recycleNode(s),s=n}return i([],this._tempPath,!0)},s.hasPath=function(t,e,i){var r=this.search(t,e,i);return r.goalNode&&this._recycleNode(r.goalNode),r.found},s.clearPool=function(){this._nodePool.length=0,this._tempPath.length=0},s.getPoolStats=function(){return{poolSize:this._nodePool.length,maxPoolSize:1e3}},s._nodePool=[],s._tempPath=[],s}();export{s as AStarPathfinder};import{Vector2Utils as t}from"../../../Types/IVector2";import{AStarPathfinder as s}from"./AStarPathfinder";var o=function(){function e(e,i){this.dirs=[t.create(1,0),t.create(0,-1),t.create(-1,0),t.create(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._wallsSet=new Set,this._weightedNodesSet=new Set,this._wallsDirty=!0,this._weightedNodesDirty=!0,this._width=e,this._height=i}return e.prototype.addWall=function(t){this.walls.push(t),this._wallsDirty=!0},e.prototype.addWalls=function(t){var e;(e=this.walls).push.apply(e,t),this._wallsDirty=!0},e.prototype.clearWalls=function(){this.walls.length=0,this._wallsSet.clear(),this._wallsDirty=!1},e.prototype.addWeightedNode=function(t){this.weightedNodes.push(t),this._weightedNodesDirty=!0},e.prototype.addWeightedNodes=function(t){var e;(e=this.weightedNodes).push.apply(e,t),this._weightedNodesDirty=!0},e.prototype.clearWeightedNodes=function(){this.weightedNodes.length=0,this._weightedNodesSet.clear(),this._weightedNodesDirty=!1},e.prototype._updateHashSets=function(){if(this._wallsDirty){this._wallsSet.clear();for(var e=0,i=this.walls;e<i.length;e++){var r=i[e];this._wallsSet.add(t.toHash(r))}this._wallsDirty=!1}if(this._weightedNodesDirty){this._weightedNodesSet.clear();for(var s=0,o=this.weightedNodes;s<o.length;s++){var h=o[s];this._weightedNodesSet.add(t.toHash(h))}this._weightedNodesDirty=!1}},e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x<this._width&&0<=t.y&&t.y<this._height},e.prototype.isNodePassable=function(e){return this._updateHashSets(),!this._wallsSet.has(t.toHash(e))},e.prototype.search=function(t,e){return s.hasPath(this,t,e)},e.prototype.searchPath=function(t,e){return s.searchPath(this,t,e)},e.prototype.getNeighbors=function(e){this._neighbors.length=0;for(var i=0,r=this.dirs;i<r.length;i++){var s=r[i],o=t.add(e,s);this.isNodeInBounds(o)&&this.isNodePassable(o)&&this._neighbors.push(o)}return this._neighbors},e.prototype.cost=function(e,i){return this._updateHashSets(),this._weightedNodesSet.has(t.toHash(i))?this.weightedNodeWeight:this.defaultWeight},e.prototype.heuristic=function(e,i){return t.manhattanDistance(e,i)},e.prototype.getStats=function(){return this._updateHashSets(),{walls:this.walls.length,weightedNodes:this.weightedNodes.length,gridSize:"".concat(this._width,"x").concat(this._height),wallsSetSize:this._wallsSet.size,weightedNodesSetSize:this._weightedNodesSet.size}},e}();export{o as AstarGridGraph};export{};import{Vector2Utils as t}from"../../../Types/IVector2";var h=function(){function e(){}return e.search=function(e,i,r,s){var o=[],h=new Set,n=s||new Map,a=t.toHash(i),u=t.toHash(r);if(a===u)return!0;for(o.push(i),h.add(a);o.length>0;){var d=o.shift();if(t.toHash(d)===u)return!0;for(var p=0,c=e.getNeighbors(d);p<c.length;p++){var l=c[p],f=t.toHash(l);h.has(f)||(h.add(f),n.set(f,d),o.push(l))}}return!1},e.searchPath=function(t,e,i){var r=new Map;return this.search(t,e,i,r)?this.reconstructPath(r,e,i):[]},e.reconstructPath=function(e,i,r){for(var s=[],o=r,h=t.toHash(i);t.toHash(o)!==h;){s.unshift(o);var n=t.toHash(o),a=e.get(n);if(!a)break;o=a}return s.unshift(i),s},e}();export{h as BreadthFirstPathfinder};export{};var n=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)||[]},t}();export{n as UnweightedGraph};import{Vector2Utils as t}from"../../../Types/IVector2";import{BreadthFirstPathfinder as h}from"./BreadthFirstPathfinder";var a=function(){function e(t,i,r){void 0===r&&(r=!1),this.walls=[],this._neighbors=[],this._width=t,this._height=i,this._dirs=r?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x<this._width&&0<=t.y&&t.y<this._height},e.prototype.isNodePassable=function(e){return!this.walls.find((function(i){return t.equals(i,e)}))},e.prototype.getNeighbors=function(e){this._neighbors.length=0;for(var i=0,r=this._dirs;i<r.length;i++){var s=r[i],o=t.add(e,s);this.isNodeInBounds(o)&&this.isNodePassable(o)&&this._neighbors.push(o)}return this._neighbors},e.prototype.searchPath=function(t,e){return h.searchPath(this,t,e)},e.prototype.hasPath=function(t,e){return h.search(this,t,e)},e.CARDINAL_DIRS=[t.create(1,0),t.create(0,-1),t.create(-1,0),t.create(0,1)],e.COMPASS_DIRS=[t.create(1,0),t.create(1,-1),t.create(0,-1),t.create(-1,-1),t.create(-1,0),t.create(-1,1),t.create(0,1),t.create(1,1)],e}();export{a as UnweightedGridGraph};
@@ -1 +0,0 @@
1
- export{Vector2Utils}from"./Types/IVector2";export{PriorityQueue}from"./Utils/PriorityQueue";export{AStarPathfinder}from"./AI/Pathfinding/AStar/AStarPathfinder";export{AstarGridGraph}from"./AI/Pathfinding/AStar/AstarGridGraph";export{BreadthFirstPathfinder}from"./AI/Pathfinding/BreadthFirst/BreadthFirstPathfinder";export{UnweightedGraph}from"./AI/Pathfinding/BreadthFirst/UnweightedGraph";export{UnweightedGridGraph}from"./AI/Pathfinding/BreadthFirst/UnweightedGridGraph";var t=function(){function t(){}return t.equals=function(t,e){return t.equals?t.equals(e):t.x===e.x&&t.y===e.y},t.create=function(t,e){return{x:t,y:e}},t.clone=function(t){return{x:t.x,y:t.y}},t.add=function(t,e){return{x:t.x+e.x,y:t.y+e.y}},t.manhattanDistance=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},t.distance=function(t,e){var i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},t.toHash=function(t){return(t.x+this.MAX_COORD|0)<<16|(t.y+this.MAX_COORD|0)},t.toKey=function(t){return"".concat(t.x,",").concat(t.y)},t.fromHash=function(t){return{x:(t>>16)-this.MAX_COORD,y:(65535&t)-this.MAX_COORD}},t.HASH_MULTIPLIER=73856093,t.MAX_COORD=32767,t}();export{t as Vector2Utils};var e=function(){function t(){this._heap=[],this._size=0}return Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this._heap.length=0,this._size=0},t.prototype.enqueue=function(t){this._heap[this._size]=t,this._bubbleUp(this._size),this._size++},t.prototype.dequeue=function(){if(0!==this._size){var t=this._heap[0];return this._size--,this._size>0&&(this._heap[0]=this._heap[this._size],this._bubbleDown(0)),t}},t.prototype.peek=function(){return this._size>0?this._heap[0]:void 0},t.prototype._bubbleUp=function(t){for(;t>0;){var e=Math.floor((t-1)/2);if(this._heap[t].priority>=this._heap[e].priority)break;this._swap(t,e),t=e}},t.prototype._bubbleDown=function(t){for(;;){var e=t,i=2*t+1,r=2*t+2;if(i<this._size&&this._heap[i].priority<this._heap[e].priority&&(e=i),r<this._size&&this._heap[r].priority<this._heap[e].priority&&(e=r),e===t)break;this._swap(t,e),t=e}},t.prototype._swap=function(t,e){var i=this._heap[t];this._heap[t]=this._heap[e],this._heap[e]=i},t}();export{e as PriorityQueue};var i=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var r,s=0,o=e.length;s<o;s++)!r&&s in e||(r||(r=Array.prototype.slice.call(e,0,s)),r[s]=e[s]);return t.concat(r||Array.prototype.slice.call(e))};import{Vector2Utils as t}from"../../../Types/IVector2";import{PriorityQueue as e}from"../../../Utils/PriorityQueue";var r=function(){function e(e,i,r,s){void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=null),this.priority=0,this.gCost=0,this.hCost=0,this.parent=null,this.hash=0,this.node=e,this.gCost=i,this.hCost=r,this.priority=i+r,this.parent=s,this.hash=t.toHash(e)}return e.prototype.updateCosts=function(t,e,i){void 0===i&&(i=null),this.gCost=t,this.hCost=e,this.priority=t+e,this.parent=i},e.prototype.updateNode=function(e,i,r,s){void 0===i&&(i=0),void 0===r&&(r=0),void 0===s&&(s=null),this.node=e,this.gCost=i,this.hCost=r,this.priority=i+r,this.parent=s,this.hash=t.toHash(e)},e.prototype.reset=function(){this.node=null,this.priority=0,this.gCost=0,this.hCost=0,this.parent=null,this.hash=0},e}(),s=function(){function s(){}return s._getNode=function(t,e,i,s){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=null);var o=this._nodePool.pop();return o?o.updateNode(t,e,i,s):o=new r(t,e,i,s),o},s._recycleNode=function(t){this._nodePool.length<1e3&&(t.reset(),this._nodePool.push(t))},s.search=function(i,r,s){var o=new e,h=new Set,n=new Map,a=t.toHash(r),u=t.toHash(s);if(a===u)return{found:!0,goalNode:this._getNode(r,0,0)};var d,p=this._getNode(r,0,i.heuristic(r,s));for(o.enqueue(p),n.set(a,p);!o.isEmpty;){var c=o.dequeue(),l=c.hash;if(n.delete(l),l===u){d=c;break}h.add(l);for(var f=0,_=i.getNeighbors(c.node);f<_.length;f++){var g=_[f],y=t.toHash(g);if(!h.has(y)){var w=c.gCost+i.cost(c.node,g),N=n.get(y);if(N){if(w<N.gCost){var v=N.hCost;N.updateCosts(w,v,c)}}else{v=i.heuristic(g,s);var P=this._getNode(g,w,v,c);o.enqueue(P),n.set(y,P)}}}c!==d&&this._recycleNode(c)}for(;!o.isEmpty;){var S=o.dequeue();S!==d&&this._recycleNode(S)}return{found:!!d,goalNode:d}},s.searchPath=function(t,e,i){var r=this.search(t,e,i);return r.found&&r.goalNode?this.reconstructPathFromNode(r.goalNode,e):[]},s.reconstructPathFromNode=function(e,r){this._tempPath.length=0;for(var s=e,o=t.toHash(r);s;){this._tempPath.unshift(s.node);var h=s.hash,n=s.parent;h!==o&&this._recycleNode(s),s=n}return i([],this._tempPath,!0)},s.hasPath=function(t,e,i){var r=this.search(t,e,i);return r.goalNode&&this._recycleNode(r.goalNode),r.found},s.clearPool=function(){this._nodePool.length=0,this._tempPath.length=0},s.getPoolStats=function(){return{poolSize:this._nodePool.length,maxPoolSize:1e3}},s._nodePool=[],s._tempPath=[],s}();export{s as AStarPathfinder};import{Vector2Utils as t}from"../../../Types/IVector2";import{AStarPathfinder as s}from"./AStarPathfinder";var o=function(){function e(e,i){this.dirs=[t.create(1,0),t.create(0,-1),t.create(-1,0),t.create(0,1)],this.walls=[],this.weightedNodes=[],this.defaultWeight=1,this.weightedNodeWeight=5,this._neighbors=new Array(4),this._wallsSet=new Set,this._weightedNodesSet=new Set,this._wallsDirty=!0,this._weightedNodesDirty=!0,this._width=e,this._height=i}return e.prototype.addWall=function(t){this.walls.push(t),this._wallsDirty=!0},e.prototype.addWalls=function(t){var e;(e=this.walls).push.apply(e,t),this._wallsDirty=!0},e.prototype.clearWalls=function(){this.walls.length=0,this._wallsSet.clear(),this._wallsDirty=!1},e.prototype.addWeightedNode=function(t){this.weightedNodes.push(t),this._weightedNodesDirty=!0},e.prototype.addWeightedNodes=function(t){var e;(e=this.weightedNodes).push.apply(e,t),this._weightedNodesDirty=!0},e.prototype.clearWeightedNodes=function(){this.weightedNodes.length=0,this._weightedNodesSet.clear(),this._weightedNodesDirty=!1},e.prototype._updateHashSets=function(){if(this._wallsDirty){this._wallsSet.clear();for(var e=0,i=this.walls;e<i.length;e++){var r=i[e];this._wallsSet.add(t.toHash(r))}this._wallsDirty=!1}if(this._weightedNodesDirty){this._weightedNodesSet.clear();for(var s=0,o=this.weightedNodes;s<o.length;s++){var h=o[s];this._weightedNodesSet.add(t.toHash(h))}this._weightedNodesDirty=!1}},e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x<this._width&&0<=t.y&&t.y<this._height},e.prototype.isNodePassable=function(e){return this._updateHashSets(),!this._wallsSet.has(t.toHash(e))},e.prototype.search=function(t,e){return s.hasPath(this,t,e)},e.prototype.searchPath=function(t,e){return s.searchPath(this,t,e)},e.prototype.getNeighbors=function(e){this._neighbors.length=0;for(var i=0,r=this.dirs;i<r.length;i++){var s=r[i],o=t.add(e,s);this.isNodeInBounds(o)&&this.isNodePassable(o)&&this._neighbors.push(o)}return this._neighbors},e.prototype.cost=function(e,i){return this._updateHashSets(),this._weightedNodesSet.has(t.toHash(i))?this.weightedNodeWeight:this.defaultWeight},e.prototype.heuristic=function(e,i){return t.manhattanDistance(e,i)},e.prototype.getStats=function(){return this._updateHashSets(),{walls:this.walls.length,weightedNodes:this.weightedNodes.length,gridSize:"".concat(this._width,"x").concat(this._height),wallsSetSize:this._wallsSet.size,weightedNodesSetSize:this._weightedNodesSet.size}},e}();export{o as AstarGridGraph};export{};import{Vector2Utils as t}from"../../../Types/IVector2";var h=function(){function e(){}return e.search=function(e,i,r,s){var o=[],h=new Set,n=s||new Map,a=t.toHash(i),u=t.toHash(r);if(a===u)return!0;for(o.push(i),h.add(a);o.length>0;){var d=o.shift();if(t.toHash(d)===u)return!0;for(var p=0,c=e.getNeighbors(d);p<c.length;p++){var l=c[p],f=t.toHash(l);h.has(f)||(h.add(f),n.set(f,d),o.push(l))}}return!1},e.searchPath=function(t,e,i){var r=new Map;return this.search(t,e,i,r)?this.reconstructPath(r,e,i):[]},e.reconstructPath=function(e,i,r){for(var s=[],o=r,h=t.toHash(i);t.toHash(o)!==h;){s.unshift(o);var n=t.toHash(o),a=e.get(n);if(!a)break;o=a}return s.unshift(i),s},e}();export{h as BreadthFirstPathfinder};export{};var n=function(){function t(){this.edges=new Map}return t.prototype.addEdgesForNode=function(t,e){return this.edges.set(t,e),this},t.prototype.getNeighbors=function(t){return this.edges.get(t)||[]},t}();export{n as UnweightedGraph};import{Vector2Utils as t}from"../../../Types/IVector2";import{BreadthFirstPathfinder as h}from"./BreadthFirstPathfinder";var a=function(){function e(t,i,r){void 0===r&&(r=!1),this.walls=[],this._neighbors=[],this._width=t,this._height=i,this._dirs=r?e.COMPASS_DIRS:e.CARDINAL_DIRS}return e.prototype.isNodeInBounds=function(t){return 0<=t.x&&t.x<this._width&&0<=t.y&&t.y<this._height},e.prototype.isNodePassable=function(e){return!this.walls.find((function(i){return t.equals(i,e)}))},e.prototype.getNeighbors=function(e){this._neighbors.length=0;for(var i=0,r=this._dirs;i<r.length;i++){var s=r[i],o=t.add(e,s);this.isNodeInBounds(o)&&this.isNodePassable(o)&&this._neighbors.push(o)}return this._neighbors},e.prototype.searchPath=function(t,e){return h.searchPath(this,t,e)},e.prototype.hasPath=function(t,e){return h.search(this,t,e)},e.CARDINAL_DIRS=[t.create(1,0),t.create(0,-1),t.create(-1,0),t.create(0,1)],e.COMPASS_DIRS=[t.create(1,0),t.create(1,-1),t.create(0,-1),t.create(-1,-1),t.create(-1,0),t.create(-1,1),t.create(0,1),t.create(1,1)],e}();export{a as UnweightedGridGraph};