Game path planning method, storage medium and program product

By constructing paths with two positions as the starting point and end point on the game map, and determining the target paths with intersection points, the problem of low efficiency in game path planning in the existing technology is solved, and more efficient path planning is achieved.

CN119770976AActive Publication Date: 2025-04-08SHENZHEN MINIPLAY TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510203491.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-04-08
Estimated Expiration
2045-02-24

AI Technical Summary

Technical Problem

When the prior art automatically plans game paths, more computing resources are required, resulting in user game lag and path planning efficiency is low.

Method used

By obtaining the movable area and obstacle positions of the game map, taking the first position and the second position as the starting point and the end point, the first path and the second path are constructed, and the target game path is obtained based on the intersection points of the two.

Benefits of technology

This method makes the determination of the target game path more efficient, avoids the waste of repeated computing resources, and improves the efficiency of path planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119770976A_ABST
    Figure CN119770976A_ABST
Patent Text Reader

Abstract

The invention discloses a game path planning method, a storage medium and a program product. The method comprises the following steps: acquiring a movable area, an obstacle position, a first position and a second position of a game map; constructing a first path and a second path between the first position and the second position by taking the first position as a starting point and an ending point respectively; and according to the intersection point of the first path and the second path, combining the first path and the second path to obtain a target game path. According to the technical scheme, efficient planning of the game path is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of game data processing, and specifically relates to a game path planning method, storage medium, and program product. Background Art

[0002] With the development of technology, the gaming industry has become more and more popular, and games have become an indispensable entertainment activity for people. However, when users play games, for some "running map" tasks, they need to waste a lot of time looking for the target location and manipulating the game characters to keep approaching the target location.

[0003] This causes users to waste a lot of time and energy to control the game characters to "run the map", which greatly reduces the user experience. Therefore, most games will launch an automatic "running map" function, that is, after the user sets the target location, the game character will automatically plan a path, and then automatically move to the target location along the planned path.

[0004] However, currently, when automatically planning a path, it is often necessary to traverse various game map locations to select a navigable game path. This requires more computing resources to plan the path automatically, which can cause game lags and low path planning efficiency. Therefore, how to efficiently plan the game path is a technical problem that needs to be solved urgently. Summary of the invention

[0005] The purpose of this application is to efficiently plan game paths.

[0006] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0007] According to one aspect of an embodiment of the present application, a method for planning a game path is provided, comprising:

[0008] Get the movable area and obstacle positions, the first position and the second position of the game map;

[0009] Taking the first position as a starting point and an end point, respectively, to construct a first path and a second path between the first position and the second position;

[0010] According to the intersection of the first path and the second path, the first path and the second path are combined to obtain a target game path.

[0011] According to one aspect of an embodiment of the present application, taking the first position as a starting point and an end point respectively, constructing a first path and a second path between the first position and the second position, including:

[0012] Taking one of the first position and the second position as a starting point and taking the other of the first position and the second position as an end point;

[0013] Taking the starting point as the target node, obtaining the initial nodes that can be moved around the target node, and calculating the score of the initial node according to the first distance and the second distance, the distance between the initial node and the starting point as the first distance, and the distance between the initial node and the end point as the second distance;

[0014] Determining a target node among the initial nodes according to the initial node scores;

[0015] According to the most recently determined target node, determine the next target node until the end point appears in the initial node, and take the end point as the last target node;

[0016] According to each of the target nodes, a first path and a second path are determined.

[0017] According to one aspect of an embodiment of the present application, according to one aspect of an embodiment of the present application, calculating the score of the initial node according to the first distance and the second distance includes:

[0018] Calculating the actual cost and the estimated cost of each of the initial nodes according to the first distance and the second distance respectively, and calculating the weight parameter of each of the nodes according to the obstacle information between each of the initial nodes and the end point;

[0019] The score of each of the initial nodes is calculated according to the actual cost, estimated cost, and weight parameter of each of the initial nodes.

[0020] According to one aspect of an embodiment of the present application, calculating each node weight parameter according to obstacle information between each initial node and the end point includes:

[0021] Using a line segment connecting the initial node and the end point as a reference line segment;

[0022] Determine, according to the reference line segment, an area within a set range of the reference line segment as a reference area;

[0023] Counting the number of nodes occupied by obstacles in the reference area as a reference number;

[0024] The weight parameter of each initial node is calculated according to the reference quantity corresponding to each initial node.

[0025] According to one aspect of an embodiment of the present application, determining a target node in the initial node according to the initial node score includes:

[0026] Add the initial nodes with scores less than the set score threshold to the closed list, and add the initial nodes with scores greater than or equal to the set score threshold to the open list. The initial nodes in the closed list cannot be used as target nodes;

[0027] The initial node with the highest score in the open list is selected as the target node, and the initial node in the open list is used as the candidate node.

[0028] According to one aspect of an embodiment of the present application, determining a next target node according to a latest determined target node includes:

[0029] Get the initial nodes that can be moved around the latest determined target node;

[0030] Scoring the initial node, wherein if the initial node has been used as a discarded node, the discarded node is not scored; if the initial node has been used as a candidate node, the candidate node is re-scored and used as the initial node again;

[0031] In the open list, the initial node with the highest score is selected as the next target node.

[0032] According to one aspect of an embodiment of the present application, combining the first path and the second path to obtain a target path according to an intersection of the first path and the second path includes:

[0033] When constructing the first path and the second path, if the first path and the second path have an intersection, the unfinished first path and the second path are directly combined to obtain the target path.

[0034] According to one aspect of an embodiment of the present application, a computer device is provided, including a memory, a processor, and a readable program stored in the memory, wherein the processor executes the readable program to implement any of the methods described above.

[0035] According to one aspect of an embodiment of the present application, a readable storage medium is provided, on which a readable program / instruction is stored. When the readable program / instruction is executed by a processor, any of the methods described above is implemented.

[0036] According to one aspect of an embodiment of the present application, a program product is provided, including a readable program / instruction, and when the readable program / instruction is executed by a processor, any of the methods described above is implemented.

[0037] In the present application, by determining the first position and the second position, taking the first position as the starting point and the end point respectively, and constructing the first path and the second path between the first position and the second position at the same time, if the first path and the second path have an intersection, it means that the first path and the second path have been mutually verified, proving that the target game path determined according to the first path and the second path are both better game paths. And by taking the first position and the second position as the starting point respectively, determining the first path and the second path in both directions, and finally determining the target game path according to the first path and the second path, this "two-end blooming" approach also makes the determination of the target game path more efficient.

[0038] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.

[0039] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 A flow chart of a method for planning a game path according to an embodiment of the present application is shown.

[0042] Figure 2 A flowchart is shown in which a first position is used as a starting point and an end point respectively to construct a first path and a second path between the first position and the second position according to an embodiment of the present application.

[0043] Figure 3 A flowchart of calculating a score of an initial node according to a first distance and a second distance according to an embodiment of the present application is shown.

[0044] Figure 4 A flowchart is shown for calculating weight parameters of each node based on obstacle information between each initial node and an end point according to an embodiment of the present application.

[0045] Figure 5 A flowchart of determining a target node in an initial node according to an initial node score according to an embodiment of the present application is shown.

[0046] Figure 6A flowchart of determining a next target node based on a most recently determined target node according to an embodiment of the present application is shown.

[0047] Figure 7 A block diagram of a computer system structure for implementing a method for planning a game path according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.

[0049] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0050] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0051] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0052] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0053] See also Figure 1 , Figure 1A flowchart of a method for planning a game path according to an embodiment of the present application is shown. The present application embodiment provides a method for planning a game path, including:

[0054] Step S110, obtaining the movable area and obstacle positions, the first position and the second position of the game map;

[0055] Step S120, taking the first position as a starting point and an end point, respectively, to construct a first path and a second path between the first position and the second position;

[0056] Step S130, combining the first path and the second path according to the intersection of the first path and the second path to obtain a target game path.

[0057] The above three steps are described in detail below.

[0058] In step S110, the movable area of ​​the game map is obtained, that is, the location of the entire game map, that is, the location of each node in the game map. In theory, each node in the game map can be reached by the game character, but obstacles will be set on the game map. If there are obstacles on the node, the node can no longer be reached by the game character.

[0059] Therefore, the positions of obstacles in the game map are obtained to determine which nodes on the game map cannot be reached.

[0060] In some embodiments, the game map is in a grid shape, each node is a rectangle, and the movement of the game character can be regarded as the game character moving from one rectangle to another rectangle.

[0061] It should be clear that one of the first position and the second position is the starting point in the game map, and the other is the destination in the game map. In the embodiment of the present application, in order to better describe the technical means included in the present application, the first position is taken as the starting point and the second position is taken as the destination.

[0062] In step S120, a first path is constructed by taking the first position as a starting point and the second position as an end point. A second path is constructed by taking the second position as a starting point and the first position as an end point. That is, multiple paths are constructed between the first position and the second position, so as to select a better path among these paths, or to combine these paths to obtain an optimized target game path.

[0063] On the one hand, by using the first position and the second position as the starting point to construct the first path and the second path respectively, using the "two-end blooming" method, multiple paths can be obtained more quickly, increasing the efficiency of determining the target game path. On the other hand, using different positions as the starting point, the better path can be verified from multiple angles and selected as the target game path.

[0064] See also Figure 2 , Figure 2 A flowchart of constructing a first path and a second path between the first position and the second position using the first position as the starting point and the end point, respectively, according to an embodiment of the present application is shown. The embodiment of the present application provides a step S120 of constructing a first path and a second path between the first position and the second position using the first position as the starting point and the end point, respectively, including:

[0065] Step S121, taking one of the first position and the second position as a starting point and taking the other of the first position and the second position as an end point;

[0066] Step S122, taking the target node as the target node, obtaining the initial nodes that can be moved around the target node, and calculating the score of the initial node according to the first distance and the second distance, the distance between the initial node and the starting point as the first distance, and the distance between the initial node and the end point as the second distance;

[0067] Step S123, determining a target node among the initial nodes according to the initial node scores;

[0068] Step S124, determining the next target node according to the most recently determined target node, until the end point appears in the initial node, and taking the end point as the last target node;

[0069] Step S125, determining the first path and the second path according to each target node.

[0070] The above five steps are described in detail below.

[0071] In step S121, one of the first position and the second position is used as the starting point, and the other of the first position and the second position is used as the end point, that is, the path is constructed with the first position as the starting point and the second position as the end point, and the path is constructed with the second position as the starting point and the first position as the end point.

[0072] To more vividly describe the technical means included in the present application, a path constructed with the first position as the starting point and the second position as the end point is referred to as the first path, and a path constructed with the second position as the starting point and the first position as the end point is referred to as the second path.

[0073] In step S122, the first position and the second position are used as starting points to construct a path to the second position and the first position. In the process of constructing the path, the following technical means are used:

[0074] First, the starting point is taken as the target node, and there are four initial nodes around the target node: front, back, left, and right. The four initial nodes are scored according to the first distance and the second distance of the four initial nodes to obtain the scores of the four initial nodes. Among them, the first distance refers to the distance between the initial node and the starting point, and the second distance refers to the distance between the initial node and the end point. The target node refers to the node included in the path to be constructed.

[0075] In some embodiments, the first distance refers to the distance that needs to be moved from the initial node to the starting point, that is, the number of target nodes between the initial node and the starting point. The second distance refers to the straight-line distance between the initial node and the end point. It should be clear that the first distance of the initial node is negatively correlated with the score of the initial node, and the second distance of the initial node is negatively correlated with the score of the initial node.

[0076] For example, when constructing the first path, determine the nodes to which the target node finally obtained can theoretically move: four initial nodes: front, back, left, and right. The moving distance between each initial node and the first position is taken as the first distance, and the straight-line distance between each initial node and the second position is taken as the second distance. The score of the initial node is calculated based on the first distance and the second distance.

[0077] See also Figure 3 , Figure 3 A flowchart of calculating the score of the initial node according to the first distance and the second distance according to an embodiment of the present application is shown. The present application embodiment provides a step S122 of calculating the score of the initial node according to the first distance and the second distance, including:

[0078] Step S201, calculating the actual cost and the estimated cost of each initial node according to the first distance and the second distance respectively, and calculating the weight parameter of each node according to the obstacle information between each initial node and the end point;

[0079] Step S202, calculating the score of each initial node according to the actual cost, estimated cost, and weight parameter of each initial node.

[0080] The above two steps are described in detail below.

[0081] In step S201, the actual cost and the estimated cost of each initial node are calculated according to the first distance and the second distance, respectively. The first distance is used as the actual cost of the initial node, and the second distance is used as the estimated cost of the initial node. The weight parameter of each node is calculated according to the obstacle information between each initial node and the end point. Exemplarily, the sum of the actual cost and the estimated cost is used as the initial score, and the product of the initial score and the initial node weight parameter is used as the score of the initial node.

[0082] In some embodiments, taking into account the situation where there are obstacles in the initial node itself or nearby, the initial score of each initial node is calculated based on each initial node, and the initial score of the initial node is multiplied by the weight parameter corresponding to each initial node to obtain the score of the initial node.

[0083] The weight parameters for the initial nodes can be calculated as follows:

[0084] In some embodiments, the initial node is used as a reference, and a reference area of ​​the initial node is divided, and the number of obstacles in the reference area of ​​the initial node and the distance between the initial node and the obstacle are calculated. The distance between the initial node and the nearest obstacle is used as the numerator, the number of obstacles is used as the denominator, and the obtained ratio is used as the weight parameter of the initial node. That is, if there is an obstacle on the initial node, the score of the initial node is zero, indicating that it is not suitable as a target node.

[0085] In some embodiments, the reference area of ​​the initial node is divided with the initial node as a reference, the number of obstacles in the reference area of ​​the initial node and the distance between the initial node and the obstacle are calculated, the distance between the initial node and the nearest obstacle is used as the numerator, the number of obstacles is used as the denominator, and the obtained ratio is used as the obstacle sub-value. The obstacle sub-values ​​of each initial node are summed to obtain the obstacle sum value. The ratio of the obstacle sub-value of each initial node to the obstacle sum value is used as the weight parameter of each initial node. If there is an obstacle on an initial node, the obstacle sub-value of the initial node is zero, and the weight parameter is also zero. This indicates that the initial node cannot be used as a target node.

[0086] In some embodiments, the reference area may be determined in the following manner: a line segment connecting an initial node and an end point is used as a reference line segment.

[0087] According to the reference line segment, the area within the set range of the reference line segment is determined as the reference area. First, the initial node where the current target node exists is determined. Each initial node corresponds to a direction. Generally, there are three initial nodes, that is, three directions. Because the node in one direction is the previous target node (the way to come), it cannot be used as the initial node. This avoids scoring nodes that cannot be used as target nodes and avoids wasting computing resources.

[0088] For example, if the initial node is to the left of the target node, a semicircular area is determined to the left of the reference line segment with the reference line segment of the initial node as the diameter, as the reference area of ​​the initial node.

[0089] If the initial node is to the right of the target node, a semicircular area is determined to the right of the reference line segment with the reference line segment of the initial node as the diameter, as the reference area of ​​the initial node.

[0090] If the initial node is in front of or behind the target node, the reference line segment of the initial node is divided into two equal parts to obtain two sub-reference line segments, and circular areas are determined with the sub-reference line segments as diameters to obtain two circular areas as reference areas of the initial node.

[0091] Since the distances between the initial nodes are relatively close, the lengths of the reference line segments of the initial nodes are close, thereby ensuring that the reference areas of the initial nodes are similar and the fairness of the weight parameters is guaranteed.

[0092] See also Figure 4 , Figure 4 A flowchart of calculating the weight parameters of each node according to the obstacle information between each initial node and the end point according to an embodiment of the present application is shown. The embodiment of the present application provides a step S201 of calculating the weight parameters of each node according to the obstacle information between each initial node and the end point, including:

[0093] Step S301, taking the line segment connecting the initial node and the end point as a reference line segment;

[0094] Step S302, determining an area within a set range of the reference line segment according to the reference line segment as a reference area;

[0095] Step S303, counting the number of nodes occupied by obstacles in the reference area as a reference number;

[0096] Step S304, calculating the weight parameter of each initial node according to the reference quantity corresponding to each initial node.

[0097] The above four steps are described in detail below.

[0098] In step S301, a line segment connecting an initial node and an end point is used as a reference line segment.

[0099] To more conveniently describe the technical means in the embodiments of the present application, taking the score of the initial node in the first path as an example (the second path can refer to the first path), the line segment connecting the initial node and the second position is used as a reference line segment.

[0100] In step S302, an area within the set range of the reference line segment is determined according to the reference line segment as the reference area. First, the initial node where the current target node exists is determined. Each initial node corresponds to a direction. Generally, there are three initial nodes, that is, three directions. Because the node in one direction is the previous target node (the way to come), it cannot be used as the initial node. This avoids scoring nodes that cannot be used as target nodes and avoids wasting computing resources.

[0101] For example, if the initial node is to the left of the target node, a semicircular area is determined to the left of the reference line segment with the reference line segment of the initial node as the diameter, as the reference area of ​​the initial node.

[0102] If the initial node is to the right of the target node, a semicircular area is determined to the right of the reference line segment with the reference line segment of the initial node as the diameter, as the reference area of ​​the initial node.

[0103] If the initial node is in front of or behind the target node, the reference line segment of the initial node is divided into two equal parts to obtain two sub-reference line segments, and circular areas are determined with the sub-reference line segments as diameters to obtain two circular areas as reference areas of the initial node.

[0104] Since the distances between the initial nodes are relatively close, the lengths of the reference line segments of the initial nodes are close, thereby ensuring that the reference areas of the initial nodes are similar and the fairness of the weight parameters is guaranteed.

[0105] In step S303, the number of nodes occupied by obstacles in the reference area of ​​each initial node is counted as a reference number.

[0106] In step S304, the weight parameter of each initial node is calculated according to the reference quantity corresponding to each initial node. For example, the sum of the reference quantity corresponding to each initial node is obtained as the reference sum value. The ratio between the reference quantity corresponding to each initial node and the reference sum value is used as the weight parameter of the initial node.

[0107] In some embodiments, the score of the initial node can also be calculated with reference to the distance between the initial node and the obstacles in the reference area. Specifically, the distance between the initial node and the nearest obstacle is used as the numerator, the reference number or the number of obstacles is used as the denominator, and the obtained ratio is used as the weight parameter of the initial node. That is, if there is an obstacle on the initial node, the score of the initial node is zero, indicating that it is not suitable as a target node.

[0108] In some embodiments, the reference area of ​​the initial node is divided with the initial node as a reference, the number of obstacles in the reference area of ​​the initial node and the distance between the initial node and the obstacle are calculated, the distance between the initial node and the nearest obstacle is used as the numerator, the number of parameters or the number of obstacles is used as the denominator, and the obtained ratio is used as the obstacle sub-value. The obstacle sub-values ​​of each initial node are summed to obtain the obstacle sum value. The ratio of the obstacle sub-value of each initial node to the obstacle sum value is used as the weight parameter of each initial node. If there is an obstacle on an initial node, the obstacle sub-value of the initial node is zero, and the weight parameter is also zero. This indicates that the initial node cannot be used as a target node.

[0109] In step S202, the sum of the actual cost and the estimated cost is used as the initial score of the initial node, and the product of the initial score of the initial node and the initial node weight parameter is used as the score of the initial node.

[0110] Each initial node can be scored in the above manner.

[0111] In step S123, based on the initial node scores, the initial node with the highest score is determined as the target node.

[0112] See also Figure 5 , Figure 5 A flowchart of determining a target node in an initial node according to an initial node score according to an embodiment of the present application is shown. The present application embodiment provides a step S123 of determining a target node in an initial node according to an initial node score, including:

[0113] Step S401, add the initial nodes whose scores are less than the set score threshold to the closed list, and add the initial nodes whose scores are greater than or equal to the set score threshold to the open list. The initial nodes in the closed list cannot be used as target nodes;

[0114] Step S402: Select the initial node with the highest score in the open list as the target node, and use the initial node in the open list as the candidate node.

[0115] The above two steps are described in detail below.

[0116] In step S401, the initial nodes with scores less than the set score threshold are added to the closed list, and the initial nodes with scores greater than or equal to the set score threshold are added to the open list. The initial nodes in the closed list cannot be used as target nodes. That is, only the initial nodes in the open list can participate in the determination of the target node. The abandoned nodes in the closed list cannot participate in the determination of the target node.

[0117] In some embodiments, after an initial node is selected as a target node, the initial node is added to a closed list as an abandoned node. That is, a node that has been a target node can no longer become an initial node to participate in the selection of the next target node. In this way, the number of initial nodes is reduced, and the occupation of computing resources is reduced.

[0118] In some embodiments, in the process of determining the first path and the second path, the discarded nodes cannot participate in determining the target nodes in the first path and the second path.

[0119] In step S402, the initial node with the highest score in the open list is selected as the target node, and the initial node in the open list is used as a candidate node to distinguish the initial node of the next target node.

[0120] In the embodiment of the present application, by treating some initial nodes with low scores as abandoned nodes, it is avoided to continue to waste computing resources for screening initial nodes that are unlikely to become target nodes in the future, thereby saving computing resources and thus improving the efficiency of determining the first path and the second path.

[0121] In some embodiments, spare nodes and / or abandoned nodes are cleared from the open list and / or after a set time (unlikely to be used any more) to release storage resources.

[0122] In some embodiments, in some embodiments, for spare nodes and / or abandoned nodes, if the distance to the most recently determined target node is greater than a distance threshold (cannot be used anymore), they are cleared from the open list and / or to release storage resources.

[0123] It should be clear that for paths with different starting and ending positions, corresponding open lists and closed lists are constructed respectively. That is, each path has its own corresponding open list and closed list.

[0124] In step S124, according to the latest determined target node, the technical means described in step S123 are used to determine the next target node until the end point appears in the initial node, and the end point is used as the last target node. Exemplarily, taking the first path as an example, until the second position appears in the initial node, the second position is directly used as the last target node. All target nodes constitute the first path.

[0125] It should be clear that in some embodiments, when determining the next target node of a target node, there must be a node among the four nodes that can be moved theoretically: front, back, left, and right that is the previous target node of the current target node (the way it came). The initial nodes that have already been target nodes are removed from the initial nodes. In other words, the initial nodes that have already been target nodes are no longer used as initial nodes. In other words, the nodes that have been target nodes can no longer become initial nodes to participate in the selection of the next target node. In this way, the number of initial nodes is reduced and the occupation of computing resources is reduced.

[0126] See also Figure 6 , Figure 6 A flowchart of determining a next target node according to a latest determined target node according to an embodiment of the present application is shown. The present application embodiment provides a step S124 of determining a next target node according to the latest determined target node, including:

[0127] Step S501, obtaining the initial nodes that can be moved around the latest determined target node;

[0128] Step S502, scoring the initial node, wherein if the initial node has been used as a discarded node, the discarded node is not scored; if the initial node has been used as a candidate node, the candidate node is re-scored and used as the initial node again;

[0129] Step S503: In the open list, select the initial node with the highest score as the next target node.

[0130] The above three steps are described in detail below.

[0131] In step S501, the initial nodes that can be moved around the latest determined target node are obtained.

[0132] In step S502, the initial node is scored, wherein if the initial node has been used as a discarded node, the discarded node is not scored. If the initial node has been used as a candidate node, the candidate node is re-scored and used as the initial node again to participate in the selection of the target node.

[0133] In step S503, the initial node with the highest score is selected as the next target node in the open list, so as to ensure that the initial node participating in the target node selection each time is the latest determined initial node, thus avoiding the waste of computing resources.

[0134] In step S125 , the first path and the second path are determined by using the same technical means as described in steps S121 to S124 .

[0135] In the embodiment of the present application, by gradually determining the target node to determine the first path and the second path, the first path and the second path can be optimized, thereby ensuring the optimization of the first target game path.

[0136] In step S130, it should be noted that when the first path and the second path are constructed from the first position and the second position respectively and simultaneously toward each other, it is highly likely that the first path and the second path will intersect.

[0137] According to the intersection of the first path and the second path, the first path and the second path are combined to obtain the target game path in the following manner:

[0138] First, during the construction of the first path and the second path, monitor whether the first path and the second path have an intersection. If the first path and the second path have an intersection, the first path and the second path have not been completed at this time. The unfinished first path and the second path can be directly spliced ​​from the intersection to obtain the target game path. In this way, the target game path can be determined more quickly, which greatly speeds up the confirmation efficiency of the target game path.

[0139] If there is no intersection between the first path and the second path during the construction of the first path and the second path, then after the first path and the second path are constructed, the length of the first path and the second path is calculated, and the length refers to the number of nodes in the path, and the smaller one of the first path and the second path is selected as the target game path. The intersection refers to the node where the first path and the second path overlap.

[0140] Second, regardless of the intersection of the first path and the second path during the construction process, after the first path and the second path are constructed, if the first path and the second path have two intersections (the first position and the second position), then by calculating the length of the first path and the second path, the length refers to the number of nodes in the path, and the smaller one of the first path and the second path is selected as the target game path. The intersection refers to the node where the first path and the second path overlap.

[0141] Third, without considering the intersection of the first path and the second path during the construction process, after the first path and the second path are constructed, the number of intersections of the first path and the second path is judged; if the number of overlapping nodes (intersections) of the first path and the second path, the length of the first path, and the length of the second path are the same, it means that the first path and the second path completely overlap, and any one of the first path and the second path can be selected as the target game path.

[0142] Fourthly, without considering the intersection of the first path and the second path during the construction process, after the first path and the second path are constructed, the number of intersections of the first path and the second path is determined. If the first path and the second path have three or more overlapping nodes (the overlapping nodes include the first position and the second position), there are at least two sub-paths between every two adjacent overlapping nodes (the first path can be multiple or one, and the second path can be multiple or one). Select the sub-path with the shortest length as the target sub-path among the sub-paths between every two adjacent overlapping nodes, and obtain multiple target sub-paths. Combine all target sub-paths to obtain the target game path.

[0143] Exemplarily, without considering the intersection of the first path and the second path during the construction process, if the first path and the second path have three overlapping nodes (the overlapping nodes include the first position and the second position), there are two subpaths from the first position to the overlapping nodes, and there are also two subpaths from the overlapping nodes at the second position. The shorter subpath is selected as the target subpath from the two subpaths from the first position to the overlapping nodes. The shorter subpath is selected as the target subpath from the two subpaths of the overlapping nodes at the second position. The two target subpaths are combined to obtain the target game path.

[0144] In the embodiment of the present application, by determining the first position and the second position, taking the first position as the starting point and the end point respectively, and constructing the first path and the second path between the first position and the second position at the same time, if the first path and the second path have an intersection, it means that the first path and the second path have been mutually verified, proving that the target game path determined according to the first path and the second path are both better game paths. And by taking the first position and the second position as the starting point respectively, determining the first path and the second path in both directions, and finally determining the target game path according to the first path and the second path, this "two-end blooming" approach also makes the determination of the target game path more efficient.

[0145] In some embodiments, the game map is in a grid shape, each grid represents a node, and the movement of the game character can be regarded as moving from one grid to another. In order to more efficiently determine the target game path. In order to more quickly determine the target game path, the following technical means can also be used to determine the target game path:

[0146] The grids (nodes) of the game map are divided into M levels, where the side length of the N+1 level grid (node) is X times that of the N level grid (node), where M is a positive integer greater than or equal to 2, N is a positive integer, N+1 is less than or equal to M, and X is greater than 1.

[0147] First, the game map including M-level nodes is used to determine the M-level game path using the technical means used in the embodiment of the present application; the starting point and destination in each M-level node can be obtained, and then each M-level grid is used as a sub-game map, and the M-1-level grid is used as a node, and the technical means used in the embodiment of the present application are used to determine the M-1-level game path. Until the 1-level grid is used as a node, the 1-level game path is determined using the technical means used in the embodiment of the present application, and finally the target game path is obtained. In this way, the target game path can be gradually determined, and different levels of precision can be performed for different precisions, which increases the precision of the target game path, as well as the customization of the user. And in this way, the multi-threaded concurrent method can be used to determine the game path in multiple advanced grids, thereby greatly increasing the efficiency of determining the target game path.

[0148] Figure 7 A block diagram of a computer system structure for implementing a method for planning a game path according to an embodiment of the present application is shown.

[0149] It should be noted that Figure 7 The computer system 800 shown is only an example and should not affect the functions and usage scope of the embodiments of the present application.

[0150] like Figure 7As shown, the computer system 800 includes a central processing unit 801 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 802 (ROM) or the program loaded from the storage part 808 to the random access memory 803 (RAM). Various programs and data required for system operation are also stored in the random access memory 803. The central processing unit 801, the read-only memory 802 and the random access memory 803 are connected to each other through a bus 804. The input / output interface 805 (Input / Output interface, i.e., I / O interface) is also connected to the bus 804.

[0151] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.

[0152] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processor 801, various functions defined in the system of the present application are executed.

[0153] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0154] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0155] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0156] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0157] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.

[0158] It should be understood that the present application is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for planning a game path, characterized in that: include: Get the movable area and obstacle positions of the game map, the first position and the second position; Taking the first position as a starting point and an end point, respectively, to construct a first path and a second path between the first position and the second position; According to the intersection of the first path and the second path, the first path and the second path are combined to obtain a target game path.

2. The method according to claim 1, characterized in that Taking the first position as a starting point and an end point respectively, constructing a first path and a second path between the first position and the second position, comprising: Taking one of the first position and the second position as a starting point and taking the other of the first position and the second position as an end point; Taking the starting point as the target node, obtaining the initial nodes that can be moved around the target node, and calculating the score of the initial node according to the first distance and the second distance, the distance between the initial node and the starting point as the first distance, and the distance between the initial node and the end point as the second distance; Determining a target node among the initial nodes according to the initial node scores; According to the most recently determined target node, determine the next target node until the end point appears in the initial node, and take the end point as the last target node; According to each of the target nodes, a first path and a second path are determined.

3. The method according to claim 2, characterized in that Calculating the score of the initial node according to the first distance and the second distance includes: Calculating the actual cost and the estimated cost of each of the initial nodes according to the first distance and the second distance respectively, and calculating the weight parameter of each of the nodes according to the obstacle information between each of the initial nodes and the end point; The score of each of the initial nodes is calculated according to the actual cost, estimated cost, and weight parameter of each of the initial nodes.

4. The method according to claim 3, characterized in that Calculating the weight parameter of each node according to the obstacle information between each initial node and the end point includes: Using a line segment connecting the initial node and the end point as a reference line segment; Determine, according to the reference line segment, an area within a set range of the reference line segment as a reference area; Counting the number of nodes occupied by obstacles in the reference area as a reference number; The weight parameter of each initial node is calculated according to the reference quantity corresponding to each initial node.

5. The method according to claim 2, characterized in that: Determining a target node in the initial node according to the initial node score includes: Add the initial nodes with scores less than the set score threshold to the closed list, and add the initial nodes with scores greater than or equal to the set score threshold to the open list. The initial nodes in the closed list cannot be used as target nodes; The initial node with the highest score in the open list is selected as the target node, and the initial node in the open list is used as the candidate node.

6. The method according to claim 5, characterized in that According to the latest determined target node, determine the next target node, including: Get the initial nodes that can be moved around the latest determined target node; Scoring the initial node, wherein if the initial node has been used as a discarded node, the discarded node is not scored; if the initial node has been used as a candidate node, the candidate node is re-scored and used as the initial node again; In the open list, the initial node with the highest score is selected as the next target node.

7. The method according to claim 1, characterized in that Combining the first path and the second path according to the intersection of the first path and the second path to obtain a target path includes: When constructing the first path and the second path, if the first path and the second path have an intersection, the unfinished first path and the second path are directly combined to obtain the target path.

8. A computer device comprising a memory, a processor and a readable program stored in the memory, characterized in that: The processor executes the readable program to implement the method according to any one of claims 1 to 7.

9. A readable storage medium, characterized in that: A readable program / instruction is stored thereon, and when the readable program / instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. A program product, comprising a readable program / instruction, characterized in that: When the readable program / instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Path planning method

    CN116492685A

  • Path planning method and device, electronic equipment, storage medium and program product

    CN117073706A

  • Path planning method and device, electronic equipment and storage medium

    CN117570991A

  • Disaster monitoring method and device and electronic equipment

    CN117805801A

  • Path planning method and apparatus, and cloud platform

    WO2023174080A1