All Projects → valantonini → AStar

valantonini / AStar

Licence: MIT license
A 2D A Star (A*) pathfinding implementation in C# focused on ease of use

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to AStar

Cupoch
Robotics with GPU computing
Stars: ✭ 225 (+240.91%)
Mutual labels:  pathfinding
EvOLuTIoN
A simple simulation in Unity, which uses genetic algorithm to optimize forces applied to cubes
Stars: ✭ 44 (-33.33%)
Mutual labels:  pathfinding
AI-Companion
Created in Unity 5 for the purposes of learning AI techniques. Features behaviour trees and A* pathfinding.
Stars: ✭ 22 (-66.67%)
Mutual labels:  pathfinding
php-a-star
A* (A Star) search algorithm for PHP
Stars: ✭ 61 (-7.58%)
Mutual labels:  pathfinding
Pathfinding Visualization
A ReactJS project visualizes the path-finding algorithms with additional cool features like speed adjustment, maze generation, mobile support, etc.
Stars: ✭ 14 (-78.79%)
Mutual labels:  pathfinding
ml pathfind
Pathfind module for MTA:SA-Server
Stars: ✭ 25 (-62.12%)
Mutual labels:  pathfinding
Astar
A fast 2D path finding library based on the A* algorithm. Works with both grids and graphs. Supports any .NET variant that supports .NETStandard 2.0 or higher. This library has no external dependencies. The library is licensed under the MIT license.
Stars: ✭ 215 (+225.76%)
Mutual labels:  pathfinding
Pathfinding
A pmmp virion (library) for pathfinding using A*
Stars: ✭ 36 (-45.45%)
Mutual labels:  pathfinding
The-Kraken-Pathfinding
A tentacle-based pathfinding library for nonholonomic robotic vehicles
Stars: ✭ 24 (-63.64%)
Mutual labels:  pathfinding
pythonfinder
PythonFinder: Cross Platform Search Tool for Finding Pythons
Stars: ✭ 30 (-54.55%)
Mutual labels:  pathfinding
circular-obstacle-pathfinding
Pathfinding around a set of circular obstacles
Stars: ✭ 26 (-60.61%)
Mutual labels:  pathfinding
cepathfind
a path find for tilebase game in unity
Stars: ✭ 30 (-54.55%)
Mutual labels:  pathfinding
a star on grids
Best practices for implementing A* with a focus on four- and eight-connected grid worlds.
Stars: ✭ 23 (-65.15%)
Mutual labels:  pathfinding
FyWorld
FyWorld - Base-Building / Simulation Game & Tutorial in Unity
Stars: ✭ 207 (+213.64%)
Mutual labels:  pathfinding
astar-gridmap-2d
A* algorithms for 2D gridmaps. The fastest one, until you prove me wrong
Stars: ✭ 43 (-34.85%)
Mutual labels:  pathfinding
Pathfinder.vim
Vim plugin to suggest better movements
Stars: ✭ 228 (+245.45%)
Mutual labels:  pathfinding
path planning GAN
Path Planning using Generative Adversarial Network (GAN)
Stars: ✭ 36 (-45.45%)
Mutual labels:  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 (-21.21%)
Mutual labels:  pathfinding
algoviz
Codebase for educational tool on algorithms
Stars: ✭ 21 (-68.18%)
Mutual labels:  pathfinding
gruid
Cross-platform grid-based UI and game framework.
Stars: ✭ 67 (+1.52%)
Mutual labels:  pathfinding

A 2D A* (A Star) algorithm for C#

Travis (.com) branch NuGet

The world is represented by a WorldGrid that is essentially a matrix of the C# short data type. A value of 0 indicates the cell is closed / blocked. Any other number indicates the cell is open and traversable. It is recommended to use 1 for open cells as numbers greater and less than 0 may be used to apply penalty or priority to movement through those nodes in the future.

The WorldGrid can be indexed via either:

  1. The provided Position struct where a row represents the vertical axis and column the horizontal axis (Similar to indexing into a matrix Prc).

  2. The C# Point struct that operates like a cartesian co-ordinate system where X represents the horizontal axis and Y represents the vertical axis (Pxy).

Paths can be found using either Positions (matrix indexing) or Points (cartesian indexing).

Example usage

PathingExample

   var pathfinderOptions = new PathFinderOptions { 
      PunishChangeDirection = true,
      UseDiagonals = false, 
   };

   var tiles = new short[,] {
      { 1, 0, 1 },
      { 1, 0, 1 },
      { 1, 1, 1 },
   };

    var worldGrid = new WorldGrid(tiles);
    var pathfinder = new PathFinder(worldGrid, pathfinderOptions);
    
    // The following are equivalent:
    
    // matrix indexing
    Position[] path = pathfinder.FindPath(new Position(0, 0), new Position(0, 2));
    
    // point indexing
    Point[] path = pathfinder.FindPath(new Point(0, 0), new Point(2, 0));

Options

  • Allowing / restricting diagonal movement
  • A choice of heuristic (Manhattan, MaxDxDy, Euclidean, Diagonal shortcut)
  • The option to punish direction changes.
  • A search limit to short circuit the search

FAQ

q. Why doesn't this algorithm always find the shortest path?

a. A* optimises speed over accuracy. Because the algorithm relies on a heuristic to determine the distances from start and finish, it won't necessarily produce the shortest path to the target.

Changes from 1.0.0 to 1.1.0

  • Reimplemented the punish change direction to perform more consistently

Changes from 0.1.x to 1.0.0

  • The world is now represented by a WorldGrid that uses shorts internally instead of bytes
  • If no path is found, the algorithm now reports an empty array instead of null
  • Moved out of the AStar.Core namespace into simply AStar
  • Replaced former Point class with the new Position class that uses Row / Column instead of X / Y to avoid confusion with cartesian co-ordinates
  • Implemented support for Point class indexing and pathing which represent a traditional cartesian co-ordinate system
  • Changed path from List to Array and changed type from PathFinderNode to Position or Point
  • Reversed the order of the returned path to start at the start node
  • Rationalised and dropped buggy options (heavy diagonals)
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].