Unity_DOTS_NodePathFinding:使用Eager Dijkstra修改的最短路径算法,基于Unity DOT

  • p0_700769
  • 116.1KB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-04-20 05:50
基于Unity DOTS节点的路径查找 使用Eager Dijkstra修改的最短路径算法的基于Unity DOTS节点的路径查找,请参见Unity DOTS论坛进行讨论。 (另请参见其他分支) 场景 场景表示具有高程和路径节点的某些地形。 项目不是使用网状路径,而是利用节点来生成具有可能路径的节点邻居网络。 由于当前系统不允许更改此网络,因此这些变为静态的。 进一步的路径规划器实体可以搜索最佳路径。 默认情况下,在OrderNewPathSystem.cs中为100个实体设置设置。 使用10k路径规划器实体进行了测试。 但是建议注释掉PathFindingSystem中的调试raycast。 一代 在现场初始化。 所有节点都进行了相对测试,并按每个高程进行了分组。 例如,地面路径节点与高层分开。 来自同一组中每个节点的射线广播将投射到同一级别上的每个下一个相邻节点。 这由初始化时的
# Unity DOTS Node based Path Finding Unity DOTS node based path finding, using Eager Dijkstra modified Shortest Path algorithm Please see Unity DOTS forum for discussions. https://forum.unity.com/threads/dots-node-based-path-finding-eager-dijkstra.1064294/ (See also other branches) ## Scene Scene represents some terrain with elevations and path nodes. Instead of mesh path, project utilizes nodes, to generate neighbour network of nodes, with possible routes. These become static, as current system do not allow for changing this network. Further path planner entities allow for searching best path. Setting are set for 100 entities by default, in OrderNewPathSystem.cs. Tested with 10k path planner entities. But advise to comment out debugging raycast, which is in PathFindingSystem. ![Watch the video](https://forum.unity.com/attachments/upload_2021-2-25_2-2-2-png.802490/) ## Generation At the scene initialization. all nodes are tested against each other, with grouping per elevation. For example ground path nodes are separate, from upper levels. Raycast from each node in same group are cast to each next neighbor node, on same the level. This is represented by gray color ray lines at initialization. Red lines indicate, that path to next node have been obstructed by wall, or ramp. Green lines inform of correct nodes links. Distances as weights are stored, with relation between nodes. Regarding elevation, like ram, nodes need to be marked manually, via inspector, with which other node link is allowed. That should be done in most cases for both up and down nodes. That relation is added to network of nodes. ![Watch the video](https://forum.unity.com/attachments/upload_2021-2-25_2-2-21-png.802493/) ## Path Finding When starting and ending points are selected, path planner entity is marked as ready for path finding. Path Finding System job is executed once, and debugging rays are rendered. White lines indicate tested near routes. Green lines mark best possible route. ## Controls * Left click on the node in the game view, is starting point. * Right click is the end point of the path. More will come soon. ## Support If you appricate my work, please star my repo. Many thanks :)