onepathCookbook
onepath cookbook
Short recipes for common OnePath tasks, each with complete code you can copy.
Recipes
Grid pathfinding: A*, JPS, Theta* and HPA*Find paths on a square grid with OnePath, compare the search algorithms on one map, size the path for a larger agent, and add area costs.Replanning and flow fieldsKeep a path up to date as the map changes with OnePath’s incremental replanner, and route many units to one goal with a single flow field.Navigation mesh queriesBuild a navigation mesh from a tile map with OnePath, then find a path around an obstacle, cast a ray along the mesh, snap a point to the nearest walkable spot, and save the mesh to bytes to load at run time.Crowds in a rollback gameRun a OnePath crowd with a fixed time step, save its state, roll back and resimulate, and check with a state hash that the second run reaches the same bits.Routes on graphsFind routes on a weighted graph with OnePath, speed up repeated queries with landmarks, and link nearby points into a point graph.