A space-time efficient path search method for blockchain road maps in online games

By using vector iterative cosine function as a heuristic function, a minimum binary heap and an index array in the game path search algorithm, and optimizing the OPEN table structure, combined with the Bresenham linear algorithm, the problem of inefficient search of large dynamic map paths in the existing technology is solved, efficient and accurate path search is achieved, and the real-time and realism of the game is improved.

CN117839217BActive Publication Date: 2025-04-25BUTTERFLY INTERACTIVE (SHANGHAI) INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310778526.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-04-25
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

Existing game path search algorithms are inefficient when processing large dynamic maps, making it difficult to achieve efficient and accurate path search, resulting in game characters walking away from their target positions or stopping and walking.

Method used

Optimization methods based on heuristic block search algorithm are adopted, including using vector iterative cosine function as heuristic function of heuristic search algorithm, minimum binary heap storage OPEN table structure, and index array optimization query by value, and path refinement combined with Bresenham linear algorithm.

Benefits of technology

It improves the efficiency and accuracy of path search, reduces the number of useless nodes, reduces the time complexity of path planning, and can meet the needs of real-time and realism in the game.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117839217B_ABST
    Figure CN117839217B_ABST
Patent Text Reader

Abstract

The network game blockchain road map time-space efficient path search method provided by this application is optimized in three aspects: preprocessing, online path finding, and the heuristic search algorithm used based on the heuristic block search algorithm. First, it proposes to use the vector iterative cosine function as the heuristic function of the heuristic search algorithm, use the index array, and use the minimum binary heap to store the OPEN table structure. In the path finding process, the heuristic function takes the direction information of the node into account, and can effectively eliminate a large number of useless nodes. Based on the minimum binary heap iterative logical structure, the minimum value can be read quickly, and insertion and deletion are convenient. Using the index array, it is possible to query whether the node exists in the OPEN table with a time complexity of O(1). Second, it is proposed to mark the status of the area according to the distribution of obstacle nodes between regions, and the reliability, efficiency, feasibility, and realism of the network game map search path system have been greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a method for searching a path on an online game map, and more particularly to a method for searching a time-space efficient path on an online game blockchain map, and belongs to the technical field of online game map search. Background Art

[0002] At present, online games, especially mobile games, are developing rapidly. If you only rely on repetitive and single monster-killing and upgrading modes and monotonous and simple image quality, it is no longer possible to attract the attention of players. Only by improving the playability of the game and the performance of the server can the stickiness of players be improved. For a game, the role of artificial intelligence control systems in the game is becoming increasingly prominent. For the artificial intelligence control system in the game, the path search system in the game scene is one of the most basic systems. As the maps in the game have developed from the earliest closed maps to seamless open maps, the game maps have become larger and larger, making it difficult for standard pathfinding algorithms to meet the operation requirements of a high-quality game.

[0003] Most game path search systems in the prior art are difficult to achieve both high efficiency and accuracy. In a dynamic large map, the problem is that the game character deviates greatly from the target position during walking or the game character stops and starts due to poor algorithm performance on the way to the destination. Even more serious is the situation where the path search system determines that the path search has failed even though the destination is obviously reachable. Whether the path search system can meet the requirements of reliability, efficiency, feasibility, and realism is the standard for judging the quality of the path search system.

[0004] The difficulties encountered by the game search path algorithm and the criteria for measuring the quality of the final path of the search path algorithm are guiding the development direction of a high-quality game. An efficient and accurate search path system can bring players a real and smooth gaming experience, and plays a positive role in the optimization of the actual game algorithm.

[0005] In the development of map games, the path search algorithm is the most fundamental and important part, and finding a correct path is also an essential skill for game characters. As game maps gradually become more dynamic and large-scale, the amount of computing in the server has increased dramatically, and the game players' needs for realism have to be taken into account. The optimization of the path search algorithm has also become a core issue in the game development process and a bottleneck in improving game performance.

[0006] The blind search path algorithm is an uninformed search algorithm that does not consider the characteristics of the problem itself. Since it is a brute force search algorithm that does not consider node information, it is extremely inefficient in both time and space and can generally only be used to solve simple problems. When the game map becomes more and more complex, the number of nodes in the game map increases, and the blind search algorithm is unable to handle it. The heuristic search algorithm provides a new idea for solving complex maps.

[0007] However, the performance of heuristic search algorithms in solving the pathfinding problem of large game maps is still unsatisfactory. The heuristic block search pathfinding algorithm first divides the large map into several small maps evenly, then connects multiple abstract nodes to form multiple abstract interconnected graphs by setting abstract nodes on the small maps, and finally performs a heuristic search algorithm on the abstract interconnected graph to find the best path. However, the heuristic block search algorithm does not take the obstacle node information of the map into account during the preprocessing and online pathfinding stages, but only performs a simple and rigid division. Although it can reduce the judgment time to a certain extent, it is easy to cause unnecessary waste of time and space, which hinders the further improvement of pathfinding search efficiency.

[0008] In addition to the above problems and defects, the problems and key technical difficulties that need to be solved in this application also include:

[0009] (1) The logical structure used by the OPEN table of the standard heuristic search algorithm cannot efficiently find the node with the smallest key value. When using the heuristic search algorithm for path retrieval, it is necessary to frequently insert nodes, query nodes, and delete nodes in the OPEN table, which will involve repeated reading and sorting of information in the table. If the logical structure of the OPEN table is inappropriate, these operations are likely to consume a lot of time and space. Since the key value information of all nodes in the OPEN table must be compared before the node with the smallest estimated value in the table can be obtained. Therefore, whether a suitable sorting algorithm can be selected is particularly critical. The goal of the selection is to find a method that can reduce the number of queries to the OPEN table and improve the efficiency of each query for the node with the smallest key value, so that the path planning algorithm can meet the real-time requirements in the map game, thereby improving player satisfaction and user stickiness.

[0010] (2) The efficiency of querying the OPEN table by value is low. If you want to determine the next node to traverse, you need to judge the nodes in the eight directions of the current node one by one, and then decide on further operations on these nodes. Among them, if the node is not an obstacle node, you need to query the OPEN table to see if the node already exists, and then decide on the next operation steps. That is, when expanding the next node, you need to repeatedly query the node by value in the OPEN table. In the standard heuristic search algorithm, the logical structure of the OPEN table uses a queue. Regardless of whether you choose a linked list queue or an array queue, the efficiency of querying by value is O(n), which is not high. Even after the logical structure of the OPEN table is changed from a queue to a minimum binary heap that is more convenient for querying the minimum key value, the efficiency of querying by value is only improved from o(n) to O(log n ), there is still room for improvement. One of the goals of this application is to reduce the time complexity of the OPEN table value query operation to O(1).

[0011] (3) The heuristic function cannot meet the high-intensity path-finding requirements. The heuristic function can determine the success or failure of the path selected by the heuristic search algorithm. If the appropriate heuristic function is selected, it can not only make the characters in the game move towards the target correctly, but also make the path search process smooth and unobstructed, that is, the calculation time is short and there is no lag. If the appropriate heuristic function is not found, it is easy to cause the final search result to be not the optimal path, and the efficiency is extremely low during the search process, and even the searched path is far from the optimal path. The difficulty of the heuristic function in calculation is determined by the total amount of heuristic information in the game map. When the heuristic function is complex, it is easy to increase the amount of heuristic information required and increase the amount of calculation. However, the complex heuristic function has more stringent conditions for node information screening, and naturally excludes more invalid nodes, which can also speed up the efficiency of path search. Therefore, how to balance the contradiction between search accuracy and search speed is an unavoidable problem in game development. In the standard heuristic search algorithm, a heuristic function based on Euclidean distance is used. Although the algorithm is simple in execution and the shortest in length. However, in the game scene, the walking of the game character often cannot follow a straight line. Therefore, the distance between the starting node and the destination node calculated by Euclidean distance is likely to be quite different from the actual walking of the game character, and it is not very practical. Compared with the Euclidean distance function, the Manhattan distance function is more practical as a heuristic function. However, when calculating the distance between two points, the Manhattan distance simply adds the absolute value of the horizontal and vertical coordinates. In the real game map, the game character can move in eight directions of the current node. In the Manhattan distance, if the game character wants to reach the diagonal node, it can only move horizontally first and then move vertically. This way of moving is not only inefficient in planning routes, but also too rigid in walking, which is not good in terms of the realism of the game, and cannot bring players a more realistic game experience.

[0012] (4) When the scale of the game map is large, the existing technologies fail to take the node information in the map into account during the pathfinding process. Moreover, when the density of obstacles is different, even the pathfinding performance of the same algorithm varies greatly, making it difficult to achieve real-time performance. The time complexity of the Dijkstra algorithm in the standard heuristic search algorithm and the blind search algorithm is relatively high, and the efficiency is not satisfactory when dealing with the pathfinding problem of large maps. The map is simply divided into four parts evenly without taking the obstacle node information in the map into account, making the algorithm extremely inefficient in searching for paths when dealing with large-area non-obstruction node maps; when partitioning, only the starting node and the target node are taken into account, which easily leads to slow pathfinding speed in other partitions, and too many extended nodes will also cause a waste of time. The online pathfinding stage uses a standard heuristic search algorithm. The limitations of the entire pathfinding algorithm are manifested in two aspects. First, in real game scenes, the proportion of obstacle nodes is not high, that is, most of the partitions are blank areas, and using heuristic search algorithms on blank areas is actually inefficient and completely unnecessary; second, the standard heuristic search algorithm itself has aspects that need to be improved. The search path system cannot meet the requirements of reliability, efficiency, feasibility, and realism. Summary of the invention

[0013] This application is based on the optimization of the heuristic block search algorithm in three aspects: preprocessing, online path finding, and the heuristic search algorithm used. It proposes to use a vector iterative cosine function as the heuristic function of the heuristic search algorithm, use an index array, and use a minimum binary heap to store the OPEN table structure. In the path finding process, the heuristic function takes the direction information of the node into account, and can effectively eliminate a large number of useless nodes. Based on the minimum binary heap iterative logical structure, the minimum value can be read quickly, and insertion and deletion are convenient. Using the index array, it is possible to query whether the node exists in the OPEN table with a time complexity of O(1). And in the path finding process of the heuristic block search algorithm, the optimized heuristic search algorithm is used. In the execution process of the heuristic block search algorithm, it is proposed to mark the state of the area according to the distribution of obstacle nodes between areas, and to determine whether the current area continues to be further divided by the state information and to refine the path on the current sub-area after obtaining the abstract path. If the current sub-region status information is a non-obstacle node, the region will not be divided further and the Bresenham straight line algorithm is used instead of the heuristic search algorithm to refine the path in the online pathfinding stage. The reliability, efficiency, feasibility and realism of the search path system are greatly improved.

[0014] In order to achieve the above technical effects, the technical solutions adopted in this application are as follows:

[0015] The space-time efficient path search method for online game blockchain road map is optimized based on the heuristic block search algorithm in three aspects: preprocessing, online path finding, and the heuristic search algorithm used, including the heuristic optimization search algorithm based on vector iterated cosine and the heuristic block search optimization algorithm based on map information link;

[0016] The heuristic optimization search algorithm based on vector iterative cosine includes optimizing the logical structure of the OPEN table, optimizing the query of the OPEN table by value based on the index array, and the heuristic function based on the vector iterative cosine distance. In the process of path finding, the total number of visited nodes is reduced. The storage structure of the OPEN table is optimized by using the minimum binary heap method that is convenient for querying the minimum key value and has extremely high insertion and deletion efficiency, and using the index array to optimize the heuristic search algorithm.

[0017] The block search optimization algorithm based on map information link heuristic is optimized from four aspects: setting the required coefficient, dividing the sub-area, abstracting the sub-area, and online pathfinding. The pathfinding process includes two parts: preprocessing and online pathfinding. Preprocessing includes map selection, dividing the sub-area, and forming abstract connectivity. Figure 3 steps; the online pathfinding stage includes three steps: inserting the start node and the target node, generating the shortest path on the abstract node, and refining the abstract path; the information of the obstacle points in the map is taken into account to optimize the heuristic block search algorithm. First, when dividing the map, the state information of the current sub-area is used to decide whether to proceed to the next division, and after the abstract connected graph is formed, the optimized heuristic search algorithm is used to obtain an abstract path. Then, according to the different state information of the sub-area, it is decided to use the heuristic search algorithm based on cosine vector optimization or the right-angle line distance to refine the abstract path, and finally a complete path is obtained.

[0018] Preferably, the logical structure of the OPEN table is optimized: based on the feature that the heuristic search algorithm needs to repeatedly select the minimum key value from the OPEN table and delete it, a minimum binary heap iterative logical structure is used to process the node information in the OPEN table. The key value of the parent node is always not less than the key values ​​of its left and right children, and the subtrees of each node meet the conditions of the minimum binary heap. In this way, the recursive definition satisfies the requirements of searching the OPEN table and finding the minimum heuristic function value, and the minimum binary heap iterative logical structure is used to process the relationship between the various data in the OPEN table, efficiently obtain the minimum key value in the table and delete the node with the smallest key value in the table; including adding new link nodes and deleting nodes with the smallest key values.

[0019] Preferably, a heuristic function based on the iterative cosine distance of the vectors is:

[0020] When determining the next node information, the direction of the line connecting the node and the target node is taken into account, and the nodes in the direction away from the target node are excluded to avoid the path planning from turning back or going backwards after adding a node far away from the target node. When considering the node direction, the vector iterative cosine function is used as an offset and added to the heuristic function of the standard heuristic search algorithm to ensure that the path planning algorithm moves in the direction of the target node when expanding the next node.

[0021] The vector iterative cosine distance with a negative value added to the original Euclidean distance is used as an offset to optimize the original heuristic function. By taking the node direction information into account, the path planned by the algorithm is prevented from turning back, as shown in Equation 2 and Equation 3:

[0022] h′(n)=h0(n)+h cos (n) Formula 2

[0023] h cos (n) = -ωcosβ Formula 3

[0024] In the formula, h' represents the optimized heuristic function, whose value is equal to the heuristic function h0 of the standard basis and the Euclidean distance plus the value of the vector iterative cosine function, ω is the adjustable weight, β is the angle between the node and the starting node and the optimal path, where the optimal path here refers to a straight line connecting the starting node to the target node;

[0025] If the starting node is S and the target node is N, nodes A and B are the nodes that the algorithm needs to examine in the expansion. The angle between vector SN and vector SA is α, and the angle between vector SN and vector SB is β. If the f values ​​of nodes A and B are equal when using the standard heuristic search algorithm, both nodes need to be compared. After using the vector iterative cosine as the offset of the heuristic function, if the path cost g of node B is the same as that of node A, and since the direction of node B has deviated from the optimal path, that is, β is greater than α, the estimated function value f of node B is naturally larger than that of node A, then node B will be regarded as a useless node.

[0026] In the standard heuristic search algorithm, the f values ​​of nodes A and B are equal, as shown in Equation 4:

[0027] f(A)=g(A)+h(A)

[0028] f(B)=g(B)+h(B)

[0029] f cos (A) = f cos (B) Formula 4

[0030] The cosine function with a negative sign is monotonically increasing, and we can draw the following conclusions:

[0031] h cos (A) = -ωcosα

[0032] h cos (B) = -ωcosβ

[0033] h cos (A)<h cos (B) Formula 5

[0034] Substituting the above results into the optimized heuristic function, that is, combining equation 4, equation 5 and equation 2, we get:

[0035] h'(A)=g(A)+h(A)+h cos (A)

[0036] h(B)=g(B)+h(B)+h cos (B)

[0037] h'(A)<h'(B) Formula 6

[0038] Point A is closer to the optimal path from the starting node to the target node than point B, and the heuristic function value of point A is smaller than that of point B. If point A has all the same data as point B except that the angle formed with the optimal path is smaller than that of point B, then point A will be selected as the next traversal node. Moreover, by screening nodes in this way, the next node selected can be closer to the optimal path, reducing the number of useless node inspections.

[0039] Preferably, the heuristic block search algorithm is optimized based on the map distribution information, the node information of the map is taken into account when partitioning the large-scale map, and when in the process of online path finding, the situations of using the heuristic search algorithm or the Bresenham line algorithm are classified;

[0040] The node information in the map is taken into account, and the game map is unevenly divided into sub-areas according to the distribution information of the obstacle nodes. When dividing, a status bit is used to indicate the obstacle distribution information λ of the sub-area. The next operation of the sub-area is judged according to the status bit. The obstacle information status λ is divided into the following three situations: one is that the sub-areas are all blank, that is, the current area is all non-obstacle nodes, then let λ = 0; the second is that the obstacle nodes in the sub-area are greater than the set critical value, that is, λ = 1; the third is that the obstacle node ratio of the sub-area is less than the set critical value, then continue to divide into four equal parts until the division times. The number of nodes is ≤4. Then, on the divided sub-areas, key points are selected to connect to form an abstract connected graph. Then, a heuristic search algorithm based on cosine vector optimization is used on the abstract connected graph to obtain an abstract path. Finally, the abstract path is refined according to the state information of the sub-area λ. If λ=0, the Bresenham straight line algorithm is used; otherwise, the optimized heuristic search algorithm is used to obtain the actual path. Three coefficients are introduced in the path search process, namely: the state information λ of the sub-area, the critical value β of the obstacle node set in advance, and the proportion of the obstacle nodes in the sub-area δ.

[0041] Preferably, the required coefficient is set as follows: the proportion of obstacle nodes in the sub-region δ is the proportion of obstacle nodes in the sub-region to the total number of nodes, defined as Formula 7:

[0042]

[0043] λ, which indicates the status information of the sub-region, is the status indicator of each small partition. If the value of λ is not 0, it must be 1. When it is 0, it means that the nodes of the current sub-region are all blank nodes, that is, non-obstacle nodes, and the region will no longer be cut, and it is in the stage of online path finding. For the sub-region with λ value of 0, Bresenham straight line algorithm is used;

[0044] The critical value β ranges from 0 to 1. The larger the β value is, the more key points are selected, which means that the map division is more refined.

[0045] Preferably, the division of sub-areas: first, the map is evenly divided into four parts, and the node information on the specific current sub-area is considered in the termination condition. The termination condition is related to the critical value β and the obstacle node ratio δ, and is divided into three cases according to the relative size of these two parameters:

[0046] 1) δ = 0: It means that there is no obstacle node in the current sub-region, so the current sub-region will not be divided into the next step, and the Bresenham straight line algorithm will be directly used to plan the path, and the state information value λ of the current sub-region will be set to 0;

[0047] 2) δ>β: that is, the obstacle node occupancy rate of the current sub-area is greater than the critical value set in advance, indicating that there are many obstacle nodes in the sub-area, and the degree of refinement of the divided area has met the requirements, and there is no need for further division. The heuristic search algorithm based on vector iterative cosine is used to obtain the route, and the status information of the current sub-area is set to 1;

[0048] 3)δ<β: That is, the obstacle nodes of the current partition are relatively small, and the current sub-area is further divided into four parts, and then a judgment is made. If the number of divisions has reached four times, the stratification is terminated and the status information of the current sub-area is set to 1.

[0049] Preferably, the abstraction of sub-regions is divided into three steps: map division, abstract graph formation and online path finding. The abstract nodes are located at the connecting ports of adjacent sub-regions. A critical value is set before the algorithm starts. When the number of continuous connected nodes is less than the critical value, the middle connected node is selected as the key point; when the number of continuous nodes is greater than the critical value, the nodes on both sides are selected as the key points. The key nodes in the same sub-region are first connected, and then the key points of adjacent sub-regions are connected to form the final abstract connected graph to complete the preprocessing.

[0050] Preferably, online pathfinding:

[0051] 1) Insert the start and target nodes

[0052] An abstract interconnected graph with key nodes is formed. When inserting the start node and the target node into the interconnected graph, there are two situations. One is that the start node and the target node themselves coincide with the abstracted key node, then the step of inserting the start node and the target node is no longer performed, but path finding is performed directly; the other is that the start node and the target node do not coincide with the abstract node, then the start node and the target node are connected with the abstract nodes in the area where they are located to complete the insertion step;

[0053] 2) Get the abstract path

[0054] (1) When the λ value is 0, the current sub-area is a blank area, and all nodes are non-obstacle nodes. The Bresenham straight line algorithm can be used directly to find the path in the non-obstacle node area;

[0055] (2) When the λ value is 1, the occupancy rate of obstacle nodes in the current sub-region is greater than the set critical value. If there are many obstacle nodes in the current region, a heuristic search algorithm is used to search for paths in the region. After the paths between the nodes of the abstract path are refined, an actual path is obtained in the bottom-level region.

[0056] Preferably, the pathfinding process preprocesses:

[0057] (1) Map selection: First, the game map is quantified and abstracted into a two-dimensional grid map for subsequent processing. The game map to be processed is set to be a square with an area that is an integer power of 4;

[0058] (2) Sub-area division: The status information of the area is marked according to the occupancy rate of the obstacle nodes in the current sub-area, and then the relationship between the partition status information of different sub-areas and the pre-set obstacle node occupancy threshold is used to determine whether to proceed to the next area division;

[0059] (3) Forming an abstract connected graph: When the number of consecutive connected nodes is less than 2, the middle connected node is selected as the key point; when the number of consecutive nodes is greater than this critical value, the nodes on both sides are selected as key points; first, the key nodes in the same sub-region are connected, and then the key points of adjacent sub-regions are connected to form the final abstract connected graph.

[0060] Preferably, online pathfinding:

[0061] Step 1, insert the starting node and the target node: first determine whether the starting node and the target node have been abstracted into key nodes. If so, skip this step and proceed to step 2. If the target node and the starting node do not overlap with the key points, connect these two special nodes with the key nodes on the boundary of their sub-areas.

[0062] Step 2: Get the abstract shortest path: determine whether the target node and the starting node are in the same sub-region. If so, skip this step and proceed to the next step. If not, use the optimized heuristic search algorithm between the starting node, the target node, and the key nodes to get an abstract path.

[0063] Step 3, path refinement: If the state information λ is 0, the Bresenham straight line algorithm is used to plan the path when refining the path. Each time a point is drawn, the point with the smallest difference in y coordinate with the intersection of the straight line is selected; otherwise, the optimized heuristic search algorithm is used to plan the actual path.

[0064] Compared with the prior art, the innovations and advantages of this application are:

[0065] (1) This application optimizes the heuristic block search algorithm in three aspects: preprocessing, online path finding, and the heuristic search algorithm used. It proposes to use a vector iterative cosine function as the heuristic function of the heuristic search algorithm, use an index array, and adopt a minimum binary heap to store the OPEN table structure. During the path finding process, the heuristic function takes the direction information of the node into account, and can effectively eliminate a large number of useless nodes. Based on the minimum binary heap iterative logical structure, the minimum value can be read quickly, and insertion and deletion are convenient. Using the index array, it is possible to query whether the node exists in the OPEN table with a time complexity of O(1). And in the path finding process of the heuristic block search algorithm, the optimized heuristic search algorithm is used. During the execution of the heuristic block search algorithm, it is proposed to mark the state of the area according to the distribution of obstacle nodes between areas, and to determine whether the current area continues to be further divided based on the state information and to refine the path on the current sub-area after obtaining the abstract path. If the current sub-region status information is a non-obstacle node, the region will not be further divided and the Bresenham straight line algorithm is used instead of the heuristic search algorithm to refine the path during the online pathfinding phase. This classification method greatly improves the pathfinding efficiency and accuracy.

[0066] (2) This application creatively proposes a heuristic optimization search algorithm based on vector iterative cosine. First, in the design of the heuristic function, the vector iterative cosine distance that best fits the actual situation is used as the heuristic function of the heuristic search algorithm based on cosine vector optimization. Second, when it is found that the heuristic search algorithm needs to repeatedly check the OPEN table and delete the minimum key value in the OPEN table during the path finding process, the storage structure of the OPEN table in the standard heuristic search algorithm is optimized using the structure of the minimum binary heap. The minimum binary heap can obtain the current minimum key value with a time complexity of O(1), and has excellent performance in inserting and deleting nodes, which just meets the operation requirements of the OPEN table. Third, when expanding the next node, it is necessary to repeatedly determine whether the node already exists in the OPEN table. If the minimum binary heap iterative logical structure is still used, the efficiency of searching the OPEN table by value is not high. This application introduces a two-dimensional index array, using the array subscript to correspond to the position in the map, and the value stored in the array to indicate whether the node exists in the OPEN table, which significantly improves efficiency.

[0067] (3) This application creatively proposes a map information link-based heuristic block search optimization algorithm, which optimizes four aspects: setting the required coefficients, dividing sub-regions, abstracting sub-regions, and online pathfinding. The pathfinding process includes two parts: preprocessing and online pathfinding. The preprocessing includes map selection, dividing sub-regions, and forming abstract connectivity. Figure 3The online pathfinding stage includes three steps: inserting the starting node and the target node, generating the shortest path on the abstract node, and refining the abstract path. When partitioning a large-scale map, the node information of the map is taken into account, and when in the process of online pathfinding, the situations of using the heuristic search algorithm or the Bresenham straight line algorithm are classified and processed. In addition, in the part where the heuristic search algorithm is to be used, the heuristic search algorithm is further optimized to further improve the algorithm's pathfinding efficiency. The reliability, efficiency, feasibility, and realism of the search path system have been greatly improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] Figure 1 It is a schematic diagram of the minimum binary heap that optimizes the logical structure of the OPEN table.

[0069] Figure 2 It is a schematic diagram of a binary heap array that optimizes the logical structure of an OPEN table.

[0070] Figure 3 This is a schematic diagram of the minimum binary heap after adding a new link node.

[0071] Figure 4 It is a flow chart of the heuristic optimization search algorithm based on vector iterative cosine.

[0072] Figure 5 It is a schematic diagram of the cosine function based on the iterative cosine distance of the vector.

[0073] Figure 6 It is a partitioning flowchart of the heuristic block search optimization algorithm based on map information links.

[0074] Figure 7 It is a path-finding flowchart based on the map information link heuristic block search optimization algorithm.

[0075] Figure 8 It is a map partition diagram based on the map information link heuristic block search optimization algorithm.

[0076] Fig. 9 It is a sub-area division diagram based on the map information link heuristic block search optimization algorithm.

[0077] Fig.10 It is an abstract connected graph based on map information link heuristic block search optimization algorithm.

[0078] Fig.11 This is a diagram showing the data sources of the simulation experiment.

[0079] Fig.12 It is a simulation experiment that cuts the game map and displays it in a grid. DETAILED DESCRIPTION

[0080] The following, in conjunction with the accompanying drawings, further describes the technical solution of the online game blockchain road map time and space efficient path search method provided by the present application, so that technical personnel in the field can better understand the present application and implement it.

[0081] In the intelligent control system of map-based games, the path search system is the most important component. The quality of a path search algorithm in terms of path finding performance affects the load capacity of the server and more directly determines the user experience of the player. This application optimizes the three aspects of preprocessing, online path finding, and the heuristic search algorithm used based on the heuristic block search algorithm, and improves the algorithm's path finding efficiency as much as possible while ensuring that the best path can be found.

[0082] First, the optimization of the heuristic search algorithm in terms of the choice of heuristic function and the structure of the OPEN table is proposed. Among them, after comparing the advantages and disadvantages of Euclidean distance, diagonal distance and vector iterated cosine distance, the vector iterated cosine distance, which is more in line with the actual situation, is finally adopted as the heuristic function. The selection of this heuristic function can reduce the total number of nodes visited in the path-finding process. In the storage structure of the OPEN table, the minimum binary heap method that is convenient for querying the minimum key value and extremely efficient for insertion and deletion is selected, and the index array is used to optimize the heuristic search algorithm.

[0083] Secondly, after weighing the pros and cons of several existing block search algorithms, an optimization idea that takes into account the information of obstacle points in the map is proposed to optimize the heuristic block search algorithm. First, when dividing the map, the state information of the current sub-area is used to decide whether to proceed to the next division. And after forming an abstract connected graph, the optimized heuristic search algorithm is used to obtain an abstract path. Then, according to the different state information of the sub-area, it is decided to use the heuristic search algorithm based on cosine vector optimization or the right-angle line distance to refine the abstract path, and finally obtain a complete path.

[0084] 1. Heuristic optimization search algorithm based on vector iterative cosine

[0085] Based on the standard heuristic search algorithm, three aspects of optimization are carried out to lay the foundation for the subsequent optimization of the heuristic block search algorithm.

[0086] 1. Deficiencies of standard heuristic search algorithms

[0087] The standard heuristic search algorithm has three shortcomings: the logical structure used by the OPEN table cannot efficiently find the node with the smallest key value, querying the OPEN table by value is inefficient, and the heuristic function cannot meet the high-intensity pathfinding requirements.

[0088] 1. Insufficient logical structure of OPEN table

[0089] When using heuristic search algorithms for path retrieval, it is necessary to frequently insert nodes, query nodes, and delete nodes on the OPEN table, which involves repeated reading and sorting of information in the table. If the logical structure of the OPEN table is inappropriate, these operations are likely to consume a lot of time and space.

[0090] Since the key value information of all nodes in the OPEN table must be compared before the node with the minimum estimated value in the table can be obtained, it is particularly important to choose a suitable sorting algorithm. The goal of the selection is to find a method that can reduce the number of queries to the OPEN table and improve the efficiency of each query of the minimum key value node, so that the path planning algorithm can meet the real-time requirements of the map game, thereby improving player satisfaction and user stickiness.

[0091] 2. Disadvantages of querying OPEN tables by value

[0092] In the standard heuristic search algorithm, if you want to determine the next node to traverse, you need to judge the nodes in the eight directions of the current node one by one, and then decide on the further operations on these nodes. Among them, if the node is not an obstacle node, you need to query whether the node already exists according to the OPEN table, and then decide on the next operation steps. That is, when expanding the next node, you need to repeatedly perform the operation of querying the node by value in the OPEN table. In the standard heuristic search algorithm, the logical structure of the OPEN table uses a queue. Regardless of whether you choose a linked list queue or an array queue, the efficiency of querying by value is O(n), and the query efficiency is not high. Even after the logical structure of the OPEN table is changed from a queue to a minimum binary heap that is more convenient for querying the minimum key value, the efficiency of querying by value is only improved from o(n) to O(log n ), there is still room for improvement. One of the goals of this application is to reduce the time complexity of the OPEN table value query operation to O(1).

[0093] 3. Shortcomings of heuristic functions

[0094] The heuristic function determines the success of the path selected by the heuristic search algorithm. If the appropriate heuristic function is selected, not only can the characters in the game move toward the target correctly, but also the path search process can be smooth and unobstructed, that is, the calculation time is short and there is no lag. If the appropriate heuristic function is not found, it is easy to cause the final search result to be not the optimal path, and the efficiency is extremely low during the search process, and even the searched path is far from the optimal path.

[0095] The computational difficulty of the heuristic function is determined by the total amount of heuristic information in the game map. When the heuristic function is complex, it is easy to increase the amount of heuristic information required, which increases the amount of calculation. However, complex heuristic functions have more stringent conditions for node information screening, and naturally exclude more invalid nodes, which can also speed up the efficiency of searching for paths. Therefore, how to balance the contradiction between search accuracy and search speed is an unavoidable problem in game development.

[0096] In the standard heuristic search algorithm, a heuristic function based on Euclidean distance is used. Although the algorithm is simple to execute and the shortest in terms of length, in the game scene, the walking of the game character often cannot follow a straight line. Therefore, the distance between the starting node and the destination node calculated by Euclidean distance is likely to be quite different from the actual walking of the game character, and is not very practical.

[0097] Compared with the Euclidean distance function, the Manhattan distance function is more practical as a heuristic function. However, when calculating the distance between two points, the Manhattan distance simply adds the absolute value of the horizontal and vertical coordinates. In a real game map, the game character can move in eight directions towards the current node. In the Manhattan distance, if the game character wants to reach the diagonal node, it can only move horizontally first and then move vertically. This way of moving is not only inefficient in planning routes, but also too rigid in terms of the realism of the game, and the effect is not good, and it cannot bring players a more realistic game experience.

[0098] (II) Optimizing the logical structure of the OPEN table

[0099] In the path-finding process of the standard heuristic search algorithm, the most time-consuming part is to constantly search for the node with the smallest heuristic function f(n) value in the OPEN table. When the total number of nodes in the game map increases from dozens to tens of thousands, the number of nodes stored in the OPEN table will increase dramatically. The operation of repeatedly searching the OPEN table will also cause a corresponding decrease in search efficiency. The length of time to search the table depends largely on its storage method. If the storage node method is used improperly, it is easy to have a very bad impact on the search efficiency.

[0100] In the execution of the standard heuristic search algorithm, node information is stored sequentially, the logical structure is to use a queue, and the OPEN table is accessed repeatedly. Although the method is simple and the node insertion efficiency is extremely high, the performance of the queue logical structure is poor when selecting and deleting the node with the smallest heuristic function value.

[0101] Therefore, based on the feature that the heuristic search algorithm needs to repeatedly select the minimum key value from the OPEN table and delete it, the application adopts a minimum binary heap iterative logic structure to process the node information in the OPEN table. The key value of the parent node is always not less than the key values ​​of its left and right children, and the subtrees of each node meet the conditions of the minimum binary heap. In this way, the recursive definition meets the requirements of searching the OPEN table and finding the minimum heuristic function value. The minimum binary heap iterative logic structure is used to process the relationship between the various data in the OPEN table, efficiently obtain the minimum key value in the table and delete the node with the smallest key value in the table.

[0102] exist Figure 1 It is a minimum binary heap. The key value of each node represents the estimated value of the heuristic function in the path-finding process of the heuristic search algorithm. According to the characteristic that the root node is the node with the smallest key value, the minimum value of the heuristic function is obtained with a time complexity of O(1).

[0103] Figure 2 It shows the specific process of using an array to store the logical structure of the minimum binary heap. The hierarchical traversal method is used to put them into a one-dimensional array in turn, and the final result is Figure 1 The corresponding minimum binary heap array is as follows Figure 2 shown.

[0104] 1. Add a new link node

[0105] Add a new link node in the minimum binary heap. The initial state of the minimum binary heap array is: 10 30 2035 40 2530. It is divided into the following four steps:

[0106] Step 1: If you want to Figure 2 In the minimum binary heap shown, add a node with a key value of 15. First put the node to be added at the end of the one-dimensional array: 10 30 20 35 40 25 30 15

[0108] Step 2: Compare the key value of the last node with the key value of the fourth node (8 / 2=4). Since 15 is smaller, swap the positions of the two nodes. The adjusted array is as follows: 10 30 20 15 40 25 30 35

[0110] Step 3: Compare the key value of the node at the fourth position with the second node, and find that the fourth node is still smaller, so continue to swap the two nodes. The adjusted array is as follows: 10 15 20 30 40 25 30 35

[0112] Step 4: Compare the key value of the second node with the key value of the root node. The key value of the root node is the smallest, and the positions of the two nodes do not need to be changed. This is the final adjusted state, and the minimum binary heap after adding the new link node is as follows Figure 3 shown.

[0113] 2. Delete the node with the smallest key value

[0114] Delete the node with the smallest key value in the minimum binary heap, that is, delete the root node. First, swap the root node with the node at the end of the array and delete it. Then adjust the remaining array so that the remaining nodes can also form a minimum binary heap. The adjustment is completed. The process of deleting the node with the smallest key value in the binary heap will be divided into four steps:

[0115] The initial array is: 10 5 20 30 40 25 30 35

[0117] Step 1: First, swap the key values ​​of the nodes at the beginning and end of the array, and then delete the node with the smallest key value, which is the end node of the array, to get the following array: 35 5 20 30 40 25 30

[0119] Step 2: Compare the key values ​​of the root node and its child nodes to decide whether to swap the positions of the root node and its left child. In the array of the previous row, the key value of the left child is 15, which is less than the root node key value 3. Swap the positions of the root node and the left child. The position of the left child is multiplied by 2 by the parent node position. The adjusted array is as follows: 15 35 20 30 40 25 30

[0121] Step 3: Compare the key values ​​of the node at the second position with its left and right child nodes. The positions of the left and right children of the second node are the fourth and fifth positions respectively. The left child at the fourth position is smaller than the parent node at the second position, so swap the positions of the two nodes. The adjusted array is as follows: 15 30 20 35 40 25 30

[0123] Step 4: Compare the node at the fourth position with its left and right children according to the above method. When the left child is compared, it is found that the parent node does not have a right child node, that is, the position of the parent node multiplied by two plus one exceeds the length of the array, then terminate the adjustment algorithm. 15 30 20 35 40 25 30

[0125] In a standard minimum binary heap, if you delete the root node or the node with the minimum key value, it will still be a standard minimum binary heap structure after adjustment.

[0126] Based on the minimum binary heap iterative logic structure, it is extremely efficient in finding the minimum key value, deleting the minimum key value, and adding new link nodes. The heuristic search algorithm uses the minimum binary heap structure. Compared with the standard and relatively simple queue form, it can further improve the efficiency of the heuristic search algorithm in the path search process. And as the map scale increases, this advantage becomes more and more obvious. The algorithm flow chart is as follows Figure 4 shown.

[0127] (III) Optimizing query by value in OPEN table based on index array

[0128] In the standard heuristic search algorithm, the queue logic structure is used to record the OPEN table. In order to meet the need to repeatedly search the OPEN table for the node with the smallest key value when selecting the next node. This application changes the logical structure of the OPEN table to use a minimum binary heap, which can quickly query the node with the smallest key value with an efficiency of O(1). However, in the subsequent operation, it is necessary to check whether the nodes in the four directions of the current node exist in the OPEN table one by one, that is, to search the OPEN table by value. If the OPEN table after using the minimum binary heap is queried by value, it will only change the original O(n) to O(logn), and the effect is still not ideal.

[0129] Therefore, this application uses a two-dimensional index array to store information about whether a node exists in the OPEN table. The position of the node is represented by the horizontal and vertical coordinates, that is, the corresponding subscript in the two-dimensional array is uniquely determined. First, create a two-dimensional array with the same number of rows and columns as the map nodes. The number of nodes in the map is 64×64, then create an index array isBelong with 64 rows and 64 columns, isBelong[0][0] corresponds to the node information of the first row and first column in the map, and so on.

[0130] In the initial state, all nodes are not in the OPEN table, and the initial values ​​of the index array elements are set to 0. When a new link node is inserted into the OPEN table, the value of the index array element corresponding to the node will be modified to 1; when a node is deleted from the OPEN table, the value of the element in the index array corresponding to the deleted node will be modified to 0, which greatly improves efficiency.

[0131] According to the value of the index array element, it is determined whether the node is in the OPEN table:

[0132]

[0133] When the current node is the node at the 3rd row and 3rd column, if you want to determine whether the node is in the OPEN table, you only need to take the value of the element isBelong[2][2] to make a judgment. If the value of isBelong[2][2] is 1, the node at the 3rd row and 3rd column is in the OPEN table. Otherwise, the node is not in the OPEN table. The search performance is improved by exchanging space for time, and the space consumed is extremely small, which will not cause any trouble to the calculation.

[0134] (IV) Heuristic function based on vector iterative cosine distance

[0135] Heuristic search: As the current node n gets closer to the target node, the valuation function value h will become smaller, and the current cost value g will become larger. If the current node is farther away from the target node, the valuation function h value of the point will become larger, and the current cost value will become smaller. Therefore, if the direction of the next extended node is not considered, and the sum of the h value and the g value is simply judged, the next search node is very likely to appear in the direction away from the target node. The heuristic search algorithm will compare the total valuations of these nodes one by one, and then discard the useless nodes. This inefficient method will waste a lot of time.

[0136] Therefore, the present application aims at optimizing the heuristic function, that is, when judging the information of the next node, the direction of the line connecting the node and the target node is taken into account, and the nodes in the direction away from the target node are excluded, so as to avoid the phenomenon that the planned path turns back or regresses after adding a node far away from the target node. When considering the node direction, the vector iterative cosine function is used as the offset and added to the heuristic function of the standard heuristic search algorithm to ensure that the path planning algorithm makes the path move in the direction of the target node when expanding the next node.

[0137] The smaller the value of the estimation function, the better the path through the node. The vector iterative cosine function decreases in the range of 0 to 180. The vector iterative cosine is slightly modified to meet the definition of the estimation function in the heuristic search algorithm, that is, the smaller the angle with the optimal path, the smaller the valuation function. This application uses the vector iterative cosine distance with a negative value added to the original Euclidean distance as an offset to optimize the original heuristic function. By taking the node direction information into account, the path planned by the algorithm is avoided from turning back, as shown in Formula 2 and Formula 3:

[0138] h'(n)=h0(n)+hx os (n) Formula 2

[0139] h cos (n) = -ωcosβ Formula 3

[0140] In the formula, h' represents the optimized heuristic function, whose value is equal to the heuristic function h0 of the standard basis and the Euclidean distance plus the vector iterative cosine function value, ω is the adjustable weight, and β is the angle between the node and the starting node and the optimal path. The optimal path here refers to a straight line connecting the starting node to the target node.

[0141] If the starting node is S and the target node is N, nodes A and B are the nodes that the algorithm needs to examine in the expansion. The angle between vector SN and vector SA is α, and the angle between vector SN and vector SB is β, such as Figure 5 As shown. If the f values ​​of nodes A and B are equal when using the standard heuristic search algorithm, both nodes will be compared. After using the vector iterative cosine as the offset of the heuristic function, if the path cost g of node B is the same as that of node A, and since the direction of node B has deviated from the optimal path, that is, β is greater than α, the estimated function value f of node B is naturally larger than that of node A, then node B will be regarded as a useless node.

[0142] In the standard heuristic search algorithm, Figure 5 The f values ​​of the two nodes A and B are equal, as shown in formula 4:

[0143] f(A)=g(A)+h(A)

[0144] f(B)=g(B)+h(B)

[0145] f cos (A) = f cos (B) Formula 4

[0146] The cosine function with a negative sign is monotonically increasing, and we can draw the following conclusions:

[0147] h cos (A) = -ωcosα

[0148] h cos (B) = -ωcosβ

[0149] h cos (A)<h cos (B) Formula 5

[0150] Substituting the above results into the optimized heuristic function, that is, combining equation 4, equation 5 and equation 2, we get:

[0151] h′(A)=g(A)+h(A)+h cos (A)

[0152] h′(B)=g(B)+h(B)+h cos (B)

[0153] h′(A)<h′(B) Formula 6

[0154] Point A is closer to the optimal path from the starting node to the target node than point B, and the heuristic function value of point A is smaller than that of point B. If point A has all the same data as point B except that the angle formed with the optimal path is smaller than that of point B, then point A will be selected as the next traversal node. Moreover, by filtering nodes in this way, the next node selected can be closer to the optimal path, which can effectively reduce the number of useless node inspections and improve the efficiency of the standard heuristic search path search algorithm.

[0155] 3.5 Summary of this application

[0156] This application optimizes three aspects: storage method of OPEN table in heuristic search algorithm, querying OPEN table by value and heuristic function.

[0157] (1) In the design of the heuristic function, the vector iterative cosine distance, which best fits the actual situation, is used as the heuristic function of the heuristic search algorithm based on cosine vector optimization.

[0158] (2) When we discovered that the heuristic search algorithm needs to repeatedly check the OPEN table and delete the minimum key value in the OPEN table during the path-finding process, we optimized the storage structure of the OPEN table in the standard heuristic search algorithm by using the minimum binary heap structure. The minimum binary heap can obtain the current minimum key value with a time complexity of O(1) and has excellent performance in inserting and deleting nodes, which just meets the operational requirements of the OPEN table.

[0159] (3) When expanding the next node, it is necessary to repeatedly determine whether the node already exists in the OPEN table. If the minimum binary heap iterative logic structure is still used, it is not efficient to search the OPEN table by value. This application introduces a two-dimensional index array, using the array subscript to correspond to the position in the map, and the value stored in the array indicates whether the node exists in the OPEN table.

[0160] Although the above algorithm is an optimization for the heuristic block search path algorithm, the essence of heuristic block search is to divide the large game map into smaller areas, and then use the heuristic search algorithm on the sub-areas. From a certain perspective, the heuristic block search algorithm itself is an optimization for the shortcoming that the heuristic search algorithm cannot solve large maps well. Therefore, in addition to optimizing the heuristic block search itself, it is also necessary to optimize the heuristic search algorithm used in the operation of the heuristic block search algorithm.

[0161] 2. Map Information Link-based Heuristic Block Search Optimization Algorithm

[0162] (I) Proposal of a heuristic block search algorithm based on map information links

[0163] When the game map is large in scale, the block path algorithm is used to solve the path finding problem in the game. The existing technology fails to take the node information in the map into account during the path finding process. Moreover, when the density of obstacles is different, the path finding performance of the same algorithm varies greatly, making it difficult to achieve real-time performance.

[0164] The time complexity of the Dijkstra algorithm in the standard heuristic search algorithm and the blind search algorithm is relatively high. The efficiency is not satisfactory when dealing with the path-finding problem of large maps. The map is simply divided into four parts evenly without taking into account the obstacle node information in the map, which makes the algorithm extremely inefficient in searching for paths when dealing with large-area non-obstacle node maps. When partitioning, only the starting node and the target node are taken into account, which easily leads to slow path-finding speed in other partitions, and too many extended nodes will also cause a waste of time.

[0165] The standard heuristic search algorithm is used in the online pathfinding stage. The limitations of the entire pathfinding algorithm are manifested in two aspects. First, in real game scenes, the proportion of obstacle nodes is not high, that is, most partitions are blank areas, and using heuristic search algorithms on blank areas is actually inefficient and completely unnecessary; second, the standard heuristic search algorithm itself has aspects that need to be improved.

[0166] In response to the two aspects mentioned above that need to be optimized, this application further optimizes and proposes a heuristic block search algorithm based on map distribution information. The node information of the map is taken into account when partitioning a large-scale map, and when in the process of online path finding, the situations of using the heuristic search algorithm or the Bresenham line algorithm are classified and processed. In addition, in the part where the heuristic search algorithm is to be used, the heuristic search algorithm is further optimized to further improve the algorithm's path finding efficiency.

[0167] (II) Optimize the four major modules

[0168] The node information in the map is taken into account, and the game map is unevenly divided into sub-areas according to the distribution information of the obstacle nodes. When dividing, a status bit is used to indicate the obstacle distribution information λ of the sub-area. The next operation of the sub-area is judged according to the status bit. The obstacle information status λ is divided into the following three situations: one is that the sub-areas are all blank, that is, the current area is all non-obstacle nodes, then let λ = 0; the second is that the obstacle nodes in the sub-area are greater than the set critical value, that is, λ = 1; the third is that the obstacle node ratio of the sub-area is less than the set critical value, then continue to divide into four equal parts until the division times The number of nodes is ≤4. Then, on the divided sub-areas, key points are selected to connect to form an abstract connected graph. Then, a heuristic search algorithm based on cosine vector optimization is used on the abstract connected graph to obtain an abstract path. Finally, the abstract path is refined according to the state information of the sub-area λ. If λ=0, the Bresenham straight line algorithm is used; otherwise, the optimized heuristic search algorithm is used to obtain the actual path. Three coefficients are introduced in the path search process, namely: the state information λ of the sub-area, the critical value β of the obstacle node set in advance, and the proportion of the obstacle nodes in the sub-area δ.

[0169] 1. Required coefficient setting

[0170] The proportion of obstacle nodes in a sub-region δ is the proportion of obstacle nodes in the sub-region to the total number of nodes, which is defined as Equation 7:

[0171]

[0172] λ, which indicates the status information of the sub-region, is the status indicator of each small partition, and if the value of λ is not 0, it must be 1. When it is 0, it indicates that the nodes of the current sub-region are all blank nodes, that is, non-obstacle nodes, and the region will no longer be cut, and it is in the stage of online path finding. For the sub-region with λ value of 0, the Bresenham straight line algorithm is used.

[0173] The critical value β ranges from 0 to 1. The larger the β value is, the more key points are selected, which means that the map division is more refined.

[0174] 2. Division of sub-regions

[0175] First, the map is divided into four equal parts. The termination condition takes into account the node information on the specific current sub-area. The termination condition is related to the critical value β and the proportion of obstacle nodes δ, and is divided into three cases according to the relative size of these two parameters:

[0176] 1) δ = 0: It means that there is no obstacle node in the current sub-region, so the current sub-region will not be divided into the next step, and the Bresenham straight line algorithm will be directly used to plan the path, and the state information value λ of the current sub-region will be set to 0;

[0177] 2) δ>β: that is, the obstacle node occupancy rate of the current sub-area is greater than the critical value set in advance, indicating that there are many obstacle nodes in the sub-area, and the degree of refinement of the divided area has met the requirements, and there is no need for further division. The heuristic search algorithm based on vector iterative cosine is used to obtain the route, and the status information of the current sub-area is set to 1;

[0178] 3) δ<β: that is, the number of obstacle nodes in the current partition is small, and the current sub-region is divided into four parts, and then judged. If the number of divisions has reached four times, the stratification is terminated and the status information of the current sub-region is set to 1;

[0179] The flow chart of the partition is as follows Figure 6 To avoid waste caused by too fine partitioning, the number of layers is controlled within four at most.

[0180] 3. Abstraction of sub-areas

[0181] It is divided into three steps: map division, abstract graph formation and online path finding. The abstract nodes are located at the connecting ports of adjacent sub-areas. A critical value is set before the algorithm starts. When the number of continuous connected nodes is less than this critical value, the middle connected node is selected as the key point; when the number of continuous nodes is greater than this critical value, the nodes on both sides are selected as key points; first connect the key nodes in the same sub-area, and then connect the key points of adjacent sub-areas to form the final abstract connected graph and complete the preprocessing.

[0182] 4. Online wayfinding

[0183] 1) Insert the start and target nodes

[0184] After preprocessing, an abstract connection graph with key nodes is formed. When inserting the start node and the target node in the connection graph, there are two situations. One is that the start node and the target node themselves coincide with the abstract key node, then the step of inserting the start node and the target node is no longer performed, but path finding is performed directly; the other is that the start node and the target node do not coincide with the abstract node, and the start and target nodes are connected to the abstract nodes in the area where they are located to complete the insertion step.

[0185] 2) Get the abstract path

[0186] (1) When the λ value is 0, the current sub-area is a blank area, and all nodes are non-obstacle nodes. The Bresenham straight line algorithm can be used directly to find the path in the non-obstacle node area;

[0187] (2) When the λ value is 1, the occupancy rate of obstacle nodes in the current sub-region is greater than the set critical value. If there are many obstacle nodes in the current region, the heuristic search algorithm is used to search for paths in the region. After the paths between the nodes of the abstract path are refined, an actual path is obtained in the bottom-level region. The flowchart of the online path-finding phase of the heuristic block search algorithm based on the map distribution information is as follows: Figure 7 As shown:

[0188] (III) Pathfinding process based on map information link heuristic block search

[0189] The pathfinding process includes two parts: preprocessing and online pathfinding. Preprocessing includes map selection, sub-area division and abstract connectivity formation. Figure 3 The online pathfinding phase includes three steps: inserting the start node and the target node, generating the shortest path on the abstract node, and refining the abstract path.

[0190] 1. Preprocessing

[0191] (1) Map selection: First, the game map is quantified and abstracted into a two-dimensional grid map for subsequent processing. The game map to be processed is set to a square with an area that is an integer power of 4, such as Figure 8 shown.

[0192] (2) Sub-area division: The status information of the area is marked according to the occupancy rate of the obstacle nodes in the current sub-area. Then, based on the relationship between the partition status information of different sub-areas and the obstacle node occupancy threshold set in advance, it is determined whether to proceed to the next step of area division. Fig. 9 That is to Figure 8 The result diagram after region division.

[0193] (3) Forming an abstract connected graph: When the number of continuous connected nodes is less than 2, the middle connected node is selected as the key point; when the number of continuous nodes is greater than this critical value, the nodes on both sides are selected as key points; first, the key nodes in the same sub-region are connected, and then the key points of adjacent sub-regions are connected to form the final abstract connected graph, thus completing the preprocessing part such as Fig.10 .

[0194] 2. Online wayfinding

[0195] (1) Insert the starting node and the target node: First determine whether the starting node and the target node have been abstracted into key nodes. If so, skip this step and proceed to step (2). If the target node and the starting node do not overlap with the key points, connect these two special nodes to the key nodes on the boundaries of their sub-regions.

[0196] (2) Obtaining the abstract shortest path: Determine whether the target node and the starting node are in the same sub-region. If so, skip this step and proceed to the next step. If not, use the optimized heuristic search algorithm between the starting node, the target node, and the key nodes to obtain an abstract path.

[0197] (3) Path refinement: If the state information λ is 0, the Bresenham straight line algorithm is used to plan the path when refining the path. Each time a point is drawn, the point with the smallest difference in y coordinate with the intersection of the straight line is selected; otherwise, the optimized heuristic search algorithm is used to plan the actual path.

[0198] 3. Experiment and Analysis

[0199] (I) Design of simulation experiment

[0200] A software application based on B / S architecture is used to simulate the path-finding process of the map game. Bootstrap and jQuery are used to build the front-end visual simulation interface, and C# is used to process the path search algorithm in the back end. The game maps used are all taken from the scene maps in the game Heroes of Might and Magic and Shadow of Death.

[0201] If Fig.11 Use 8*8 grid to segment and then simplify it into a two-dimensional grid map. The final effect will be as follows Fig.12 (b) as shown.

[0202] After the real scene in the game is gridded, the subsequent path-finding algorithm operation can be performed. The simulation experiment fills the obstacle node information of the gridded game map into the graphical interface displayed by the algorithm, such as Fig.12 (b). Fill the diagram information into the program. If you click Reset Obstacle Node Information, the node information in the entire current map will be cleared. If you want to reselect the starting node and target node in the current map, click the Reset Starting and Target Nodes button. This click will not change the obstacle node information in the map. After clicking, click to select the desired starting and target nodes in turn to complete the reset information. Select any ten groups of starting nodes and target nodes, perform path planning through different algorithms in turn, and then count the corresponding processing results and display them.

[0203] (II) Simulation experiment of optimizing heuristic search algorithm

[0204] 1. Optimize the OPEN table structure

[0205] After optimizing the OPEN table structure with a minimum binary heap, the total time consumed by using the optimized heuristic search algorithm is always slightly lower than the total time consumed by using the standard heuristic search algorithm. The reason is that the minimum binary heap has excellent performance in query, insertion, and deletion, which just meets the needs of repeated query, insertion, and deletion of the OPEN table in the heuristic search algorithm. And adding an index array can also improve the efficiency of querying whether a node exists in the OPEN table. The above experiments also verify the conclusion of this application. After using the minimum binary heap as the OPEN table structure and introducing the index array, the path-finding performance of the heuristic search algorithm is indeed improved, and as the map scale increases, the total number of nodes will also increase, then the advantages brought by the optimized OPEN table structure will become more and more prominent.

[0206] 2. Optimize the heuristic function

[0207] In the pathfinding process of the optimized heuristic search algorithm using vector iterated cosine as the heuristic function, the total number of nodes visited is less than the total number of nodes visited after using the standard heuristic search algorithm. When the number of visited nodes is reduced, the final search path efficiency will naturally be improved. Therefore, it can also be proved that using vector iterated cosine as a heuristic function is superior to Euclidean distance and diagonal distance.

[0208] (III) Simulation experiment of optimizing heuristic block search algorithm

[0209] The average performance of searching paths on ten maps is compared among the heuristic block search algorithm optimized based on map distribution information, the standard heuristic block search algorithm, and the M-heuristic search algorithm. The experimental data are analyzed in three dimensions: the total number of search nodes in the path-finding process is recorded as the total number of extended nodes vec, the total time consumed for the average search path is recorded as time t, and the total number of nodes from the starting node to the target node after the path is refined is recorded as the total length of the final path len.

[0210] 1. The total number of extended nodes

[0211] Under the two critical value settings, the total number of extended nodes required by the optimized heuristic block search algorithm is less than that of the M-heuristic search algorithm, but more than that of the original heuristic block search algorithm. The reason why the optimized heuristic block search algorithm is better than the heuristic block search algorithm that is not optimized based on map distribution information is that the original heuristic block search algorithm adopts a partitioning strategy of evenly dividing the area, and when forming an abstract connection graph, the heuristic block search algorithm only selects as few key points as possible on the boundary of the sub-area to connect with other areas. Although this reduces the total number of extended nodes, it also prevents the heuristic block search from obtaining the optimal path. Compared with the M-heuristic search algorithm, the M-heuristic search algorithm only partitions the area where the starting node and the target node are located multiple times, while the middle area directly uses the heuristic search algorithm or the Dijkstra algorithm, which is extremely inefficient. However, when searching for nodes in a sub-area based on the heuristic block search algorithm optimized based on map distribution information, the state information of the area will be used to decide whether to use the rectangular line distance or the optimized heuristic search algorithm to calculate the path, which can reduce unnecessary node searches when calculating the path.

[0212] 2. Average pathfinding time

[0213] Whether in the preprocessing stage or the online pathfinding stage, the process of optimizing the heuristic block search algorithm based on map distribution information has obvious advantages in theory. Therefore, in the final average pathfinding time, it is naturally slightly better than the M-heuristic search algorithm and the heuristic block search algorithm.

[0214] The heuristic block search algorithm optimized based on map distribution information can not only ensure that the actual result of the path is the optimal path, but also improve the speed of path finding and reduce the memory space required by the algorithm. Compared with the other two algorithms, the heuristic block search algorithm optimized based on map distribution information is more suitable for solving game path finding with high real-time requirements.

Claims

1. A time-space efficient path search method for online game blockchain road maps, characterized in that: Based on the heuristic block search algorithm, three aspects are optimized respectively in preprocessing, online path finding and the heuristic search algorithm used, including the heuristic optimization search algorithm based on vector iterative cosine and the heuristic block search optimization algorithm based on map information link; The heuristic optimization search algorithm based on vector iterative cosine includes optimizing the logical structure of the OPEN table, optimizing the query of the OPEN table by value based on the index array, and the heuristic function based on the vector iterative cosine distance. In the process of path finding, the total number of visited nodes is reduced. The storage structure of the OPEN table is optimized by using the minimum binary heap method that is convenient for querying the minimum key value and has extremely high insertion and deletion efficiency, and using the index array to optimize the heuristic search algorithm. Optimize the logical structure of the OPEN table: Based on the feature that the heuristic search algorithm needs to repeatedly select the minimum key value from the OPEN table and delete it, the minimum binary heap iterative logical structure is used to process the node information in the OPEN table. The key value of the parent node is always not less than the key values ​​of its left and right children, and the subtree of each node meets the conditions of the minimum binary heap. In this way, the recursive definition meets the requirements of searching the OPEN table and finding the minimum heuristic function value. The minimum binary heap iterative logical structure is used to process the relationship between the various data in the OPEN table, and the minimum key value in the table is efficiently obtained and the node with the smallest key value in the table is deleted; Including adding new link nodes and deleting nodes with the smallest key value; The block search optimization algorithm based on map information link heuristic is optimized from four aspects: setting the required coefficient, dividing the sub-area, abstracting the sub-area, and online path finding. The path finding process includes two parts: preprocessing and online path finding. The preprocessing includes three steps: map selection, dividing the sub-area, and forming an abstract connected graph. The online pathfinding phase includes three steps: inserting the start node and the target node, generating the shortest path on the abstract node, and refining the abstract path. The heuristic block search algorithm is optimized by taking the information of the obstacle points in the map into consideration. First, when dividing the map, the state information of the current sub-area is used to decide whether to proceed to the next division. After the abstract connected graph is formed, an abstract path is obtained by using the optimized heuristic search algorithm. Then, according to the different state information of the sub-area, the heuristic search algorithm based on cosine vector optimization or the right-angle distance is used to refine the abstract path, and finally a complete path is obtained. Required coefficient setting: The proportion of obstacle nodes in the sub-region δ is the proportion of obstacle nodes in the sub-region to the total number of nodes, defined as formula 7: λ, which indicates the status information of the sub-region, is the status indicator of each small partition, and if the value of λ is not 0, it must be 1. When λ is 0, it means that the nodes of the current sub-region are all blank nodes, that is, non-obstacle nodes, and the region will no longer be cut, and it is in the stage of online path finding. The Bresenham straight line algorithm is used for the sub-region with a λ value of 0; The critical value β is between 0 and 1. When the β value is larger, more key points are selected, which means that the map is divided more finely. Division of sub-areas: First, the map is divided into four equal parts. The termination condition takes into account the node information on the specific current sub-area. The termination condition is related to the critical value β and the proportion of obstacle nodes δ, and is divided into three cases according to the relative size of these two parameters: 1) δ = 0: It means that there is no obstacle node in the current sub-region, so the current sub-region will not be divided into the next step, and the Bresenham straight line algorithm will be directly used to plan the path, and the state information value λ of the current sub-region will be set to 0; 2) δ>β: that is, the obstacle node occupancy rate of the current sub-area is greater than the critical value set in advance, indicating that there are many obstacle nodes in the sub-area, and the degree of refinement of the divided area has met the requirements, and there is no need for further division. The heuristic search algorithm based on vector iterative cosine is used to obtain the route, and the status information of the current sub-area is set to 1; 3) δ<β: that is, the number of obstacle nodes in the current partition is small, and the current sub-region is divided into four parts, and then judged. If the number of divisions has reached four times, the stratification is terminated and the status information of the current sub-region is set to 1; Abstraction of sub-regions: It is divided into three steps: map division, abstract graph formation, and online path finding. Abstract nodes are located at the connection ports of adjacent sub-regions. A critical value is set before the algorithm starts. When the number of consecutive connected nodes is less than this critical value, the middle connected node is selected as the key point; when the number of consecutive nodes is greater than this critical value, the nodes on both sides are selected as key points. First, the key nodes in the same sub-region are connected, and then the key points of adjacent sub-regions are connected to form the final abstract connected graph, completing the preprocessing. Online Wayfinding: 1) Insert the start and target nodes An abstract interconnected graph with key nodes is formed. When inserting the start node and the target node into the interconnected graph, there are two situations. One is that the start node and the target node themselves coincide with the abstracted key node, then the step of inserting the start node and the target node is no longer performed, but path finding is performed directly; the other is that the start node and the target node do not coincide with the abstract node, then the start node and the target node are connected with the abstract nodes in the area where they are located to complete the insertion step; 2) Get the abstract path (1) When the λ value is 0, the current sub-area is a blank area, and all nodes are non-obstacle nodes. The Bresenham straight line algorithm can be used directly to find the path in the non-obstacle node area; (2) When the λ value is 1, the occupancy rate of obstacle nodes in the current sub-region is greater than the set critical value. If there are many obstacle nodes in the current region, a heuristic search algorithm is used to search for paths in the region. After the paths between the nodes of the abstract path are refined, an actual path is obtained in the bottom-level region.

2. According to claim 1, the time-space efficient path search method for the online game blockchain road map is characterized in that: Heuristic function based on vector iterative cosine distance: When determining the next node information, the direction of the line connecting the node and the target node is taken into account, and the nodes in the direction away from the target node are excluded to avoid the path planning from turning back or going backwards after adding a node far away from the target node. When considering the node direction, the vector iterative cosine function is used as an offset and added to the heuristic function of the standard heuristic search algorithm to ensure that the path planning algorithm moves in the direction of the target node when expanding the next node. The vector iterative cosine distance with a negative value added to the original Euclidean distance is used as an offset to optimize the original heuristic function. By taking the node direction information into account, the path planned by the algorithm is prevented from turning back, as shown in Equation 2 and Equation 3: h′(n) = h0(n) + h cos (n) Equation 2 h cos (n)=-ωcosθ Equation 3 In the formula, h' represents the optimized heuristic function, whose value is equal to the heuristic function h0 plus the vector iterative cosine function value, ω is the adjustable weight, θ is the angle between the node and the starting node and the optimal path, where the optimal path here refers to a straight line connecting the starting node to the target node; If the starting node is S, the target node is N, where nodes A and B are the nodes that the algorithm needs to examine in the expansion, the angle between vector SN and vector SA is α, and the angle between vector SN and vector SB is ψ. After using the vector iterative cosine as the offset of the heuristic function, if the path cost value g of node B is the same as that of node A, and because the direction of node B has deviated from the optimal path, that is, ψ is greater than α, the estimated function value f of node B is naturally larger than that of node A, then node B will be regarded as a useless node; In the standard heuristic search algorithm, the f values ​​of nodes A and B are equal, as shown in Equation 4: f(A)=g(A)+h(A) f(B)=g(B)+h(B) f cos (A) = f cos (B) Formula 4 The cosine function with a negative sign is monotonically increasing, and we can draw the following conclusions: h cos (A)=-ωcosα h cos (B)=-ωcosψ h cos (A)<h cos (B) Formula 5 Substituting the above results into the optimized heuristic function, that is, combining equation 4, equation 5 and equation 2, we get: h′(A)=g(A)+h(A)+h cos (A) h′(B)=g(B)+h(B)+h cos (B) h′ (A)<h′(B) Formula 6 Point A is closer to the optimal path from the starting node to the target node than point B, and the heuristic function value of point A is smaller than that of point B. If point A has all the same data as point B except that the angle formed with the optimal path is smaller than that of point B, then point A will be selected as the next traversal node. Moreover, by screening nodes in this way, the next node selected can be closer to the optimal path, reducing the number of useless node inspections.

3. According to claim 1, the time-space efficient path search method for the online game blockchain road map is characterized in that: Optimize heuristic block search algorithms based on map distribution information, take map node information into account when partitioning large maps, and classify situations where heuristic search algorithms or Bresenham's line algorithm are used during online pathfinding; The node information in the map is taken into account, and the game map is unevenly divided into sub-areas according to the distribution information of the obstacle nodes. When dividing, a status bit is used to indicate the obstacle distribution information λ of the sub-area. The next operation of the sub-area is judged according to the status bit. The obstacle information status λ is divided into the following three situations: one is that the sub-areas are all blank, that is, the current area is all non-obstacle nodes, then let λ = 0; the second is that the obstacle nodes in the sub-area are greater than the set critical value, that is, λ = 1; the third is that the obstacle node ratio of the sub-area is less than the set critical value, then continue to divide into four equal parts until the division times. The number of nodes is ≤4. Then, on the divided sub-areas, key points are selected to connect to form an abstract connected graph. Then, a heuristic search algorithm based on cosine vector optimization is used on the abstract connected graph to obtain an abstract path. Finally, the abstract path is refined according to the state information of the sub-area λ. If λ=0, the Bresenham straight line algorithm is used; otherwise, the optimized heuristic search algorithm is used to obtain the actual path. Three coefficients are introduced in the path search process, namely: the state information λ of the sub-area, the critical value β of the obstacle node set in advance, and the proportion of the obstacle nodes in the sub-area δ.

4. According to claim 1, the time-space efficient path search method for the online game blockchain road map is characterized in that: Pathfinding preprocessing: (1) Map selection: First, the game map is quantified and abstracted into a two-dimensional grid map for subsequent processing. The game map to be processed is set to be a square with an area that is an integer power of 4; (2) Sub-area division: The status information of the area is marked according to the occupancy rate of the obstacle nodes in the current sub-area, and then the relationship between the partition status information of different sub-areas and the pre-set obstacle node occupancy threshold is used to determine whether to proceed to the next area division; (3) Forming an abstract connected graph: When the number of consecutive connected nodes is less than 2, the middle connected node is selected as the key point; When the number of consecutive nodes is greater than this critical value, the nodes on both sides are selected as key points; First, the key nodes in the same sub-region are connected, and then the key points of adjacent sub-regions are connected to form the final abstract connected graph.

5. According to claim 1, the time-space efficient path search method for the online game blockchain road map is characterized in that: Online Wayfinding: Step 1: Insert the start node and the target node: First determine whether the start node and the target node have been abstracted into key nodes. If so, skip this step and proceed to step 2. If the target node and the start node do not coincide with the key point, connect these two special nodes with the key node on the boundary of their sub-regions. Step 2: Get the abstract shortest path: determine whether the target node and the starting node are in the same sub-region. If so, skip this step and proceed to the next step. If not, use the optimized heuristic search algorithm between the starting node, the target node, and the key nodes to get an abstract path. Step 3, path refinement: If the state information λ is 0, the Bresenham straight line algorithm is used to plan the path when refining the path. Each time a point is drawn, the point with the smallest difference in y coordinate with the intersection of the straight line is selected; otherwise, the optimized heuristic search algorithm is used to plan the actual path.

Citation Information

Patent Citations

  • Map road-seeking method and system

    CN101241507A

  • Route planning method based on road chain

    CN106441338A