{"id":29765613,"url":"https://github.com/tbvanderwoude/grid_pathfinding","last_synced_at":"2025-07-27T00:15:28.690Z","repository":{"id":56782907,"uuid":"524756173","full_name":"tbvanderwoude/grid_pathfinding","owner":"tbvanderwoude","description":"Pathfinding on grids using jumping point search and connected components.","archived":false,"fork":false,"pushed_at":"2025-01-05T14:10:42.000Z","size":157,"stargazers_count":26,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T11:52:59.932Z","etag":null,"topics":["2d","astar","grid","jps","pathfinding","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/grid_pathfinding","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tbvanderwoude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-14T19:01:41.000Z","updated_at":"2025-01-03T16:02:07.000Z","dependencies_parsed_at":"2024-07-12T17:39:28.573Z","dependency_job_id":"2b4ca50e-f815-44b5-90e0-aae83c08d55f","html_url":"https://github.com/tbvanderwoude/grid_pathfinding","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tbvanderwoude/grid_pathfinding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbvanderwoude%2Fgrid_pathfinding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbvanderwoude%2Fgrid_pathfinding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbvanderwoude%2Fgrid_pathfinding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbvanderwoude%2Fgrid_pathfinding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tbvanderwoude","download_url":"https://codeload.github.com/tbvanderwoude/grid_pathfinding/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tbvanderwoude%2Fgrid_pathfinding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267274290,"owners_count":24062721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2d","astar","grid","jps","pathfinding","rust"],"created_at":"2025-07-27T00:15:18.773Z","updated_at":"2025-07-27T00:15:28.677Z","avatar_url":"https://github.com/tbvanderwoude.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grid_pathfinding\n\nA grid-based pathfinding system. Implements [Jump Point Search](https://en.wikipedia.org/wiki/Jump_point_search) with \n[improved pruning rules](https://www.researchgate.net/publication/287338108_Improving_jump_point_search) for speedy pathfinding. Pre-computes\n[connected components](https://en.wikipedia.org/wiki/Component_(graph_theory))\nto avoid flood-filling behavior if no path exists. Both [4-neighborhood](https://en.wikipedia.org/wiki/Von_Neumann_neighborhood) and [8-neighborhood](https://en.wikipedia.org/wiki/Moore_neighborhood) grids are supported and a custom variant of JPS is implemented for the 4-neighborhood. \n\n### Example\nBelow a [simple 8-grid example](examples/simple_8.rs) is given, illustrating how to set a basic problem and find a path.\n```rust,no_run\nuse grid_pathfinding::PathingGrid;\nuse grid_util::grid::Grid;\nuse grid_util::point::Point;\n\n// In this example a path is found on a 3x3 grid with shape\n//  ___\n// |S  |\n// | # |\n// |  E|\n//  ___\n// where\n// - # marks an obstacle\n// - S marks the start\n// - E marks the end\n\nfn main() {\n    let mut pathing_grid: PathingGrid = PathingGrid::new(3, 3, false);\n    pathing_grid.set(1, 1, true);\n    pathing_grid.generate_components();\n    println!(\"{}\", pathing_grid);\n    let start = Point::new(0, 0);\n    let end = Point::new(2, 2);\n    let path = pathing_grid\n        .get_path_single_goal(start, end, false)\n        .unwrap();\n    println!(\"Path:\");\n    for p in path {\n        println!(\"{:?}\", p);\n }\n}\n```\nThis assumes an 8-neighborhood, which is the default grid type. The same problem can be solved for a 4-neighborhood, disallowing diagonal moves, by adding the line\n```rust,no_run\npathing_grid.allow_diagonal_move = false;\n```\nbefore component generation, which is done in example [simple_4](examples/simple_4.rs).\n\n\n\nSee [examples](examples/) for finding paths with multiple goals and generating waypoints instead of full paths.\n\n### Benchmarks\nThe system can be benchmarked using scenarios from the [Moving AI 2D pathfinding benchmarks](https://movingai.com/benchmarks/grids.html). The [grid_pathfinding_benchmark](grid_pathfinding_benchmark) utility crate provides general support for loading these files. The default benchmark executed using `cargo bench` runs three scenario sets from the [Dragon Age: Origins](https://movingai.com/benchmarks/dao/index.html): `dao/arena`, `dao/den312` and `dao/arena2` (or `dao/den009d` when using the rectilinear algorithm). Running these requires the corresponding map and scenario files to be saved in folders called `maps/dao` and `scenarios/dao`.\n\nA baseline can be set using\n```bash\ncargo bench -- --save-baseline main\n```\nNew runs can be compared to this baseline using \n```bash\ncargo bench -- --baseline main\n```\n\n### Performance\nUsing an i5-6600 quad-core running at 3.3 GHz, running the `dao/arena2` set of 910 scenarios on a 281x209 grid takes 123 ms using JPS allowing diagonals and with improved pruning disabled. Using default neighbor generation as in normal A* (enabled by setting `GRAPH_PRUNING = false`) makes this take 1.26 s, a factor 10 difference. As a rule, the relative difference increases as maps get larger, with the `dao/arena` set of 130 scenarios on a 49x49 grid taking 721 us and 1.01 ms respectively with and without pruning. \n\n\nAn existing C++ [JPS implementation](https://github.com/nathansttt/hog2) runs the same scenarios in about 60 ms. The fastest solver known to the author is the [l1-path-finder](https://mikolalysenko.github.io/l1-path-finder/www/) (implemented in Javascript) which can do this in 38 ms using A* with landmarks (for a 4-neighborhood).\n\n\n### Goal of crate\nThe long-term goal of this crate is to provide a fast off-the-shelf pathfinding implementation for grids.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbvanderwoude%2Fgrid_pathfinding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftbvanderwoude%2Fgrid_pathfinding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftbvanderwoude%2Fgrid_pathfinding/lists"}