zimmed-pathfinder
Adapted from https://github.com/anvaka/ngraph.path and streamlined for a specific project I'm developing.
Using this NBAStar implementation got the pathfinding time for my game world (including post-processing) to ~0.2ms average, and ~0.5ms when requesting a blocked node as the end point.
Although this implementation is specific, you might be able to use it, or at least find it a helpful reference when rolling your own A* functions.
Installation
$ npm i --save zimmed-pathfinder
Usage
; const createTile = x y weight ...data ;const createGrid = Arrayrows;const grid = ;let path = Pathfinder; console; // 45,45 <- ... <- 40,38 grid4545weight = 0;path = Pathfinder; console; // 44,44 <- ... <- 40,38
If you like instantiating everything, for some reason:
; const pathFinder = Pathfinder; // Or new Pathfinder(...)const createTile = x y weight ...data ;const createGrid = Arrayrows;const grid = ;let path = pathFinder; console; // 100,100 <- ... <- 90,86 grid4545weight = 0;path = Pathfinder; console; // 98,98 <- ... <- 90,86
Include source to use your own transpilation rules
; ...
Build from source
$ git clone https://github.com/zimmed/zimmed-pathfinder.git
$ cd zimmed-pathfinder
$ npm i
$ npm run build
License
Whatever man, it's math. No one owns math. Use it as you see fit.