#path-finding #a-star #2d #bevy #game

nightly sark_pathfinding

A simple implementation of the astar pathfinding algorthim from red blob games https://www.redblobgames.com/pathfinding/a-star/implementation.html

5 releases

0.2.0 Nov 13, 2022
0.1.3 May 25, 2022
0.1.2 Jan 17, 2022
0.1.1 Jan 16, 2022
0.1.0 Jan 16, 2022

#1593 in Game dev

43 downloads per month

MIT license

120KB
257 lines

License: MIT Crates.io docs

A simple implementation of the astar pathfinding algorithm from red blob games.

In order to use the pathfinder you must have a path map for it to navigate. You can define one by implementing the PathingMap trait, or you can use the built-in PathMap2d.

Example

use sark_pathfinding::*;

let map = PathMap2d::new([50,50]);
let mut astar = AStar::from_size([50,50]);

let path = astar.find_path(&map, [4,4], [10,10]).unwrap();

From the "terminal" example.


lib.rs:

A simple implementation of the astar pathfinding algorithm from red blob games.

In order to use the pathfinder you must have a path map for it to navigate. You can define one by implementing the [PathingMap] trait, or you can use the built-in [PathMap2d].

Example

use sark_pathfinding::*;

let map = PathMap2d::new([50,50]);
let mut astar = AStar::new(20);

let path = astar.find_path(&map, [4,4], [10,10]).unwrap();

Dependencies

~3MB
~94K SLoC