Pathfinding on large map

前端 未结 7 1242
我在风中等你
我在风中等你 2021-02-02 12:34

I\'m creating a game with a 10,000 by 10,000 map.
I would like for a user to be able to set a location and have the computer instantly find the best path.
However, since

7条回答
  •  Happy的楠姐
    2021-02-02 12:48

    If your map has uniform weight (except for obstacles of course), you may have better performance with either:

    1. An algorithm that preprocesses the grid into a graph, collapsing large, empty spaces into a single node. Navigation meshes break the traversable area into convex polygons each of which can be traversed in a single step. L1 path finder groups the obstacles together, reducing them to a visibility graph calculates the path over that.

    2. An algorithm that does not expand every node. Jump-point search takes advantage of symmetry between different paths, only expanding nodes adjacent to obstacles, whereas A* would expand every node along the shortest path.

提交回复
热议问题