navigate

Grid navigation

jps pathfinding



1.A* algorithm plug-in

Different from the greedy algorithm, the greedy algorithm is suitable for dynamic programming to find the local optimal solution, and the optimal solution is not guaranteed. A* is the most efficient method for solving shortest paths in static meshes. It is also a time-consuming algorithm, and it is not suitable for occasions where pathfinding is frequent.

Generally speaking, it is suitable for occasions that require precision.

As with the heuristic search, the accuracy can be adjusted by changing mesh density, mesh dissipation.

Better places to use:
a. Strategy search in strategy games
b. Grid pathfinding in square grid games 2. U3D


's own navigation mesh system

U3D has a built-in NavMesh navigation mesh system. Generally speaking, most navigation mesh algorithms It is the "corner point algorithm", you can check it out for details. The efficiency is relatively high, but the optimal solution algorithm is not guaranteed.

Best places to use:
a. Monster pathfinding in the game scene
b. Dynamic obstacle

avoidance 3.WayPoint pathfinding plug-in

has the fastest speed, but the performance is also very limited. Suitable for complex occasions. For example it cannot change the travel path based on width, height, waypoint dissipation, etc.

The best places to use:
a. Tower defense monster travel path b.
AI patrol route


Grid production

Curved triangle, also known as Reuluo triangle. It is to use the three vertices of an equilateral triangle as the center of the circle, and the length of the side as the radius, to make the arc corresponding to each interior angle. Erase the original equilateral triangle, and the remaining figure is a curved triangle.

Its essence is actually a constant width curve.

Triangulation is the most basic research method in algebraic topology. Taking a surface as an example, we cut the surface into pieces, and the following conditions are required: (1) Each piece is a curved triangle; (2) Any

two the surface, either do not intersect, Either intersect on exactly one common edge (two or more edges cannot be intersected at the same time).

[Definition] Delaunay edge: Suppose an edge e in E (two endpoints are a, b),
if e satisfies the following conditions, it is called a Delaunay edge: there is a circle passing through two points a and b, inside the circle (note that is inside the circle, and there are at most three points on the circle, which do not contain any other points in the point set V. This feature is also called the empty circle feature.

[Definition] Delaunay triangulation: If a triangulation T of a point set V contains only Delaunay edges, then the triangulation is called a Delaunay triangulation.


Delaunay triangulation is a triangulation DT(P) such that no point in P is strictly inside the circumcircle of any triangle in DT(P). Delaunay triangulation maximizes the smallest angle of the triangles in this triangulation, in other

words , the algorithm tries to avoid "extremely thin" triangles. The algorithm is named after Boris Delaunay, in honor of his work in this field since 1934.



DT point

In a constrained Delaunay triangle, the vertex opposite an edge is called the DT point of that edge.

The process of determining the DT point is as follows:

Step1. Construct the circumcircle C(p1, p2, p3) of Δp1p2p3 and its mesh bounding box B (C(p1, p2, p3))

Step2. Access each element in the mesh bounding box in turn grid cells:

            search for grid cells that are not marked with the current pass number and mark them as the current pass number

           If there is a visible point p in a grid cell, and ∠p1pp2 > ∠p1p3p2, set p3=p1, go to Step1; otherwise, go to Step3.

Step3. If all grid cells in the current grid bounding box have been marked is the current number of passes, that is, there is no visible point in C(p1, p2, p3), then p3 is the DT point of p1p2. The algorithm for

generating Delaunay triangular mesh is as follows:

Step2. Take any outer boundary edge p1p2.

Step3. Calculate DT Point p3, form a constraint Delaunay triangle Δp1p2p3.

Step4. If the newly generated edge p1p3 is not a constraint edge, if it is already in the stack, delete it from the stack; otherwise, put it on the stack; similarly, p3p2 can be processed.

Step5. If the stack is not empty, take an edge from it and go to Step3; otherwise, the algorithm stops.



================================= =============

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326024453&siteId=291194637