A set of tools to find your path in a grid based dungeon. Field of view, pathfinding...
Inspired by tcod-rs and bracket-pathfinding, it aims to be simpler to use than tcod, without requiring a sdl2 dependency, and faster than bracket-pathfinding.
Get started
Implement the VisionMap trait to use the field of vision algorithms, or the PathMap trait to use the pathfinding algorithms.
use Point;
use ;
use ;
let sample_map = new;
// (…) You probably want at this point to add some walls to your map.
let from = ;
let to = ;
let radius = 5;
for visible_position in field_of_view
if let Some = astar_path_fourwaygrid
Even though torchbearer provides by default a pathfinding simple function for fourway grid maps (meaning, you can go north, south, east and west), you can also implement your own graph, to support other types of movements (8 ways, north, ne, east, se, south, sw, west, nw), or teleportation, or... You can also simply decide you want to tweak your heuristics, so that moving along roads is easier than climbing a mountain for instance.
use ;
let my_map = MyMap ;
let from = as NodeId;
let to = as NodeId;
if let Some = astar_path