All Projects → prettymuchbryce → Easystarjs

prettymuchbryce / Easystarjs

Licence: mit
An asynchronous A* pathfinding API written in Javascript.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Easystarjs

Pathfinding
A pmmp virion (library) for pathfinding using A*
Stars: ✭ 36 (-97.93%)
Mutual labels:  astar, pathfinding
astar-typescript
A* search algorithm in TypeScript
Stars: ✭ 37 (-97.88%)
Mutual labels:  astar, pathfinding
tektosyne
The Tektosyne Library for Java provides algorithms for computational geometry and graph-based pathfinding, along with supporting mathematical utilities and specialized collections.
Stars: ✭ 52 (-97.02%)
Mutual labels:  astar, pathfinding
path demo
An experimental set of pathfinding algorithms for video games
Stars: ✭ 16 (-99.08%)
Mutual labels:  astar, pathfinding
Roguesharp
A .NET Standard class library providing map generation, path-finding, and field-of-view utilities frequently used in roguelikes or 2D tile based games. Inspired by libtcod
Stars: ✭ 316 (-81.87%)
Mutual labels:  pathfinding, game
astar-gridmap-2d
A* algorithms for 2D gridmaps. The fastest one, until you prove me wrong
Stars: ✭ 43 (-97.53%)
Mutual labels:  astar, pathfinding
NavMeshDemo
Unity client navmesh export to server for pathfinding
Stars: ✭ 31 (-98.22%)
Mutual labels:  astar, pathfinding
pathfinding-visualizer
Website built using React Framework for visualizing Pathfinding and Maze Generation Algorithms.
Stars: ✭ 33 (-98.11%)
Mutual labels:  astar, pathfinding
Graphhopper
Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.
Stars: ✭ 3,457 (+98.34%)
Mutual labels:  pathfinding, astar
Baritone
google maps for block game
Stars: ✭ 3,868 (+121.92%)
Mutual labels:  pathfinding, astar
unity-pathfinding
Find paths in Unity Tilemaps with A* Search
Stars: ✭ 70 (-95.98%)
Mutual labels:  astar, pathfinding
09 Zombierunner Original
First person shooter with Unity terrain and AI pathfinding (http://gdev.tv/cudgithub)
Stars: ✭ 64 (-96.33%)
Mutual labels:  pathfinding, game
Blockly Gamepad
A Blockly extension designed to develop games (made with love ❤)
Stars: ✭ 18 (-98.97%)
Mutual labels:  asynchronous, game
Toast Haste.framework
TOAST Haste framework is a pure java implementation of asynchronous game server framework
Stars: ✭ 95 (-94.55%)
Mutual labels:  asynchronous, game
Canvas Test
🎮 happy canvas
Stars: ✭ 1,722 (-1.2%)
Mutual labels:  game
Pysot
Surrogate Optimization Toolbox for Python
Stars: ✭ 136 (-92.2%)
Mutual labels:  asynchronous
Hippo
💨A well crafted go packages that help you build robust, reliable, maintainable microservices.
Stars: ✭ 134 (-92.31%)
Mutual labels:  asynchronous
Binance grid trader
A grid trading strategy and trading-bot for Binance Exchange. 币安交易所的网格交易
Stars: ✭ 132 (-92.43%)
Mutual labels:  grid
Dhooks
A simple python Discord webhook API wrapper
Stars: ✭ 136 (-92.2%)
Mutual labels:  asynchronous
Hugrid
Hugrid (Hugo+grid) is a simple grid theme for Hugo. It's a kind of boilerplate to perform anyone or anything quickly. Portfolio, collection, bookmarks, contacts and so on.
Stars: ✭ 136 (-92.2%)
Mutual labels:  grid

HTML5/Javascript Pathfinding Library

Click here for a demonstration

Installation

  • Web: Find the minified file in the /bin directory
  • node.js: npm install easystarjs
  • Phaser: see Phaser Plugin
  • Bower: bower install easystarjs

Description

easystar.js is an asynchronous A* pathfinding API written in Javascript for use in your HTML5 games and interactive projects. The goal of this project is to make it easy and fast to implement performance conscious pathfinding.

Features

  • Calculates asynchronously for better overall performance
  • Simple API
  • Small. ~7kb
  • Use it with any existing Javascript Framework
  • TypeScript support

API

Main Methods

var easystar = new EasyStar.js();
easystar.setGrid(twoDimensionalArray);
easystar.setAcceptableTiles(arrayOfAcceptableTiles);
easystar.findPath(startX, startY, endX, endY, callback);
easystar.calculate();

Additional Features

easystar.setIterationsPerCalculation(someValue);
easystar.avoidAdditionalPoint(x, y);
easystar.enableDiagonals();
easystar.enableCornerCutting();
easystar.setAdditionalPointCost(x, y, cost);
easystar.setTileCost(tileType, multiplicativeCost);
easystar.enableSync();
easystar.setDirectionalCondition(x, y, [EasyStar.TOP, EasyStar.LEFT]); // only accessible from the top and left
var instanceId = easystar.findPath(startX, startY, endX, endY, callback);
// ...
easystar.cancelPath(instanceId);

Usage

First create EasyStar.

// for web
var easystar = new EasyStar.js();

// for node.js
var easystarjs = require('easystarjs');
var easystar = new easystarjs.js();

Create a grid, or tilemap. You may have made this with a level editor, or procedurally. Let's keep it simple for this example.

var grid = [[0,0,1,0,0],
            [0,0,1,0,0],
            [0,0,1,0,0],
            [0,0,1,0,0],
            [0,0,0,0,0]];

Set our grid.

easystar.setGrid(grid);

Set tiles which are "walkable".

easystar.setAcceptableTiles([0]);

Find a path.

easystar.findPath(0, 0, 4, 0, function( path ) {
	if (path === null) {
		alert("Path was not found.");
	} else {
		alert("Path was found. The first Point is " + path[0].x + " " + path[0].y);
	}
});

EasyStar will not yet start calculating my path.

In order for EasyStar to actually start calculating, I must call the calculate() method.

You should call easystar.calculate() on a ticker, or setInterval.

If you have a large grid, then it is possible that these calculations could slow down the browser. For this reason, it might be a good idea to give EasyStar a smaller iterationsPerCalculation value via

easystar.setIterationsPerCalculation(1000);

It may take longer for you to find a path this way, but you won't completely halt your game trying to find one. The only thing left to do now is to calculate the path.

easystar.calculate();

License

easystar.js is licensed under the MIT license. You may use it for commercial use.

Running the demo locally

In order to run the demo you will need node.js, and npm installed.

git clone https://github.com/prettymuchbryce/easystarjs.git

cd easystarjs/demo

npm install

node app.js

Open your browser to 127.0.0.1:3000 to see the example.

Testing

npm run test

Support

If you have any questions, comments, or suggestions please open an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].