Path finding method and device in game and electronic equipment

By using rays to adjust the height to determine key points in the game, the problem of poor flexibility and unreal flight trajectory of flying objects' automatic navigation flight is solved, and efficient memory usage and real gaming experience is achieved.

CN119633387AActive Publication Date: 2025-03-18NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411912008.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-03-18
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

The prior art has problems such as poor flexibility, not conforming to the flight trajectory of real flying objects, large data volume, and large memory consumption in the automatic navigation flight of flying objects in the game.

Method used

By obtaining the position information of the starting point and the end point, and emitting rays from the starting point to the end point, when the ray collided with the obstacle, adjust the height of the ray and determine the collision point between the ray and the obstacle as the key point of the pathfinding path.

Benefits of technology

It realizes that without increasing or less data and memory consumption, the flight path of the flyer automatically navigates closer to the flight trajectory of the real flyer, which improves the game experience and improves the pathfinding speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119633387A_ABST
    Figure CN119633387A_ABST
Patent Text Reader

Abstract

The invention discloses a way finding method and device in a game, electronic equipment and a computer readable storage medium. The method comprises the steps that position information corresponding to a starting point and a termination point is obtained, a first ray is emitted from the starting point to the termination point, and the position information at least comprises the height value of a point representing a game scene in the game scene; in response to the situation that the first ray does not reach the termination point, a first radiation midpoint of the first ray is determined, position information corresponding to the first radiation midpoint is obtained, and the first radiation midpoint is used for representing a point, corresponding to the collision position of the first ray and the obstacle, in the game scene; adjusting a first preset height on the height value of the position information corresponding to the first shot midpoint to form a first changed shot midpoint corresponding to the first shot midpoint; and determining the first change shot midpoint as the key point of the way-finding path. The method solves the technical problems that the flexibility is poor, the flight path of a real flyer is not conformed, the data volume is large and the memory consumption is large in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a path-finding method, device, electronic device, and computer-readable storage medium in a game. Background Art

[0002] Flying objects are common props in virtual games. In the game, in addition to relying on player control to fly, they often also involve the function of automatic navigation flight.

[0003] At present, the automatic navigation flight of flying objects in the game is realized through two methods: predetermined trajectory and pathfinding map. For the predetermined trajectory solution, the path trajectory is preset in advance, and it is impossible to achieve arbitrary point-to-point flight, which lacks flexibility. For the pathfinding map solution, the two-dimensional pathfinding map is generated according to the terrain of the game scene, making the path close to the ground, which does not conform to the flight trajectory of the real flying object, and will bring an unrealistic game experience to the players; and the three-dimensional pathfinding map is more complex, including too much key point information and connection information, which undoubtedly increases the data volume and memory consumption.

[0004] Therefore, there is an urgent need for a path-finding method that can make the path of an aircraft's automatic navigation flight closer to the flight trajectory of a real aircraft without increasing or reducing the amount of data and memory consumption, so as to solve the technical problems of the existing technology, such as poor flexibility, non-conformity with the flight trajectory of a real aircraft, large amount of data, and high memory consumption. Summary of the invention

[0005] The present application provides a path-finding method, device, electronic device, and computer-readable storage medium in a game to solve the technical problems of the prior art, such as poor flexibility, flight trajectory inconsistent with real flying objects, large data volume, and high memory consumption.

[0006] In a first aspect, an embodiment of the present application provides a pathfinding method in a game, the method comprising: obtaining position information corresponding to a starting point and an ending point, and emitting a first ray from the starting point to the ending point, the starting point and the ending point being any two points in a game scene, the position information comprising at least a height value in the game scene representing the point in the game scene; in response to the first ray failing to reach the ending point due to colliding with an obstacle in the game scene, determining a first hit point of the first ray, and obtaining position information corresponding to the first hit point, the first hit point being used to represent the point in the game scene corresponding to the collision position of the first ray with the obstacle; adjusting a first preset height based on the height value of the position information corresponding to the first hit point to form a first changed hit point corresponding to the first hit point; and determining the first changed hit point as a key point of the pathfinding path.

[0007] In a second aspect, an embodiment of the present application provides a pathfinding device in a game, the device comprising: a ray emitting unit, a hit point determination unit, a hit point change unit, and a key point determination unit; the ray emitting unit is used to obtain position information corresponding to a starting point and an end point, and to emit a first ray from the starting point to the end point, the starting point and the end point being any two points in a game scene, and the position information at least includes a height value representing the point in the game scene in the game scene; the hit point determination unit is used to determine a first hit point of the first ray in response to the first ray failing to reach the end point due to colliding with an obstacle in the game scene, and to obtain position information corresponding to the first hit point, the first hit point being used to represent the point in the game scene corresponding to the collision position of the first ray with the obstacle; the hit point change unit is used to adjust a first preset height on the height value of the position information corresponding to the first hit point to form a first changed hit point corresponding to the first hit point; the key point determination unit is used to determine the first changed hit point as a key point of the pathfinding path.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to implement the above method.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having one or more computer instructions stored thereon, which, when executed by a processor, executes the above method.

[0010] Compared with the prior art, the path-finding method in the game provided by the present application includes: obtaining position information corresponding to a starting point and an ending point, and emitting a first ray from the starting point to the ending point, the starting point and the ending point being any two points in the game scene, and the position information at least including a height value representing the point in the game scene in the game scene; in response to the first ray not reaching the ending point due to colliding with an obstacle in the game scene, determining a first hit point of the first ray, and obtaining position information corresponding to the first hit point, the first hit point being used to represent the point in the game scene corresponding to the collision position of the first ray with the obstacle; adjusting a first preset height based on the height value of the position information corresponding to the first hit point to form a first changed hit point corresponding to the first hit point; and determining the first changed hit point as a key point of the path-finding path. First, the method does not involve pre-setting the path trajectory, and the starting point and the end point can be any two points in the game scene, making the automatic navigation flight of the flying object in the game scene more flexible; second, the method is not based on a two-dimensional pathfinding map, and there is no situation where the flight path is close to the ground. The method determines the key points in the pathfinding path based on physical rays, which is more in line with the player's perception of autonomous control. In addition, the key points determined based on the method show a high and low change trend, which is more in line with the flight trajectory of the real flying object and can bring a real game experience to the player; third, the method determines the key points in the pathfinding path based on the existing physical rays of the game system, and does not add additional game data. Compared with the pathfinding scheme based on the three-dimensional pathfinding map, the memory occupancy and consumption of the key points determined based on physical rays are smaller, and the pathfinding speed is faster. In summary, the pathfinding method in the game provided by the present application is a pathfinding method that can make the path of the automatic navigation flight of the flying object closer to the flight trajectory of the real flying object without increasing or increasing the amount of data and memory consumption, and solves the technical problems of poor flexibility, non-conformity with the flight trajectory of the real flying object, large amount of data, and large memory consumption in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is an application system diagram of a path-finding method in a game provided by an embodiment of the present application;

[0012] Figure 2 is a flowchart of a path-finding method in a game provided by the first embodiment of the present application;

[0013] Figure 3 is a schematic diagram of a path-finding method in a game provided by the first embodiment of the present application;

[0014] Figure 4 is a schematic diagram of another path-finding method in a game provided by the first embodiment of the present application;

[0015] Figure 5 is a schematic diagram of another path-finding method in a game provided by the first embodiment of the present application;

[0016] Figure 6 is a schematic diagram of another path-finding method in a game provided in the first embodiment of the present application;

[0017] Figure 7 It is a flowchart of a path-finding method in a game provided by the first embodiment of the present application;

[0018] Figure 8 It is a flowchart of another path-finding method in a game provided by the first embodiment of the present application;

[0019] Fig. 9 It is a schematic diagram of the process of generating a flight path map provided by the first embodiment of the present application;

[0020] Fig.10 is a schematic diagram of the structure of a path-finding device in a game provided in the second embodiment of the present application;

[0021] Fig.11 It is a schematic diagram of the structure of an electronic device provided in the third embodiment of the present application. DETAILED DESCRIPTION

[0022] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0023] With the development of computer technology and the diversification of terminal functions, the game industry has entered an unprecedented stage of development. Game developers are no longer only concerned with the richness of game plots and gameplay, but also pay more and more attention to the experience the game brings to players and the memory consumption of the terminal device. A more realistic game experience and lower memory consumption are the goals that game developers are constantly pursuing.

[0024] Flying objects are common props in virtual games. They appear in various forms in the game, such as virtual airplanes, flying vehicles, flying mounts corresponding to virtual characters, flying creatures, etc. Flying objects not only increase the fun and challenge of the game, but also provide players with a more diverse gaming experience.

[0025] In the game, flying objects usually rely on the player's control to fly, and often involve automatic navigation flight. The purpose of automatic navigation is to reach the end point set by the player from the starting point set by the player according to a certain method and path. In the game, the reasonable planning of this method and path is conducive to improving the player's gaming experience.

[0026] At present, the automatic navigation of flying objects in games is achieved through the following two methods: First, the predetermined trajectory plan, specifically, the game developer sets the path from the starting point to the end point during the game development stage, and the flying object automatically navigates and flies along the set path in the game. Second, the pathfinding map solution, specifically, a two-dimensional or three-dimensional pathfinding map is generated in the game editor in advance, and the pathfinding Figure 1 Generally, it includes multiple key points and the connection relationship between the points. In the game, according to the pathfinding map, the key points that need to be passed from the starting point to the end point are found based on the shortest path planning algorithm, so that the flying object can pass through the key points one by one for automatic navigation flight. For the predetermined trajectory scheme, since the path trajectory is preset in advance, it is impossible to achieve arbitrary point-to-point flight, which makes the automatic navigation flight of the flying object in the game lack flexibility. For the pathfinding map pathfinding scheme, firstly, since the two-dimensional pathfinding map is generated according to the terrain of the game scene, the pathfinding path obtained based on the two-dimensional pathfinding map is close to the ground, which does not conform to the flight trajectory of the real flying object, giving the player an unreal game experience; secondly, since the three-dimensional pathfinding map itself is relatively complex, including too many key points and connection information, the amount of game data has increased exponentially, and the memory consumption of the terminal device has undoubtedly increased during the application process.

[0027] Therefore, the automatic navigation flight of flying objects in existing games has technical problems such as poor flexibility, non-compliance with real flight trajectories, large data volume, and high memory consumption.

[0028] In view of this, the present application provides a pathfinding method in a game, which is a pathfinding method that can make the path of the automatic navigation flight of a flying object closer to the flight trajectory of a real flying object without increasing or reducing the amount of data and memory consumption. First, the method does not involve the advance preset of the path trajectory, and the starting point and the end point can be any two points in the game scene, making the automatic navigation flight of the flying object in the game scene more flexible; second, the method is not based on a two-dimensional pathfinding map, and there is no situation where the flight path is close to the ground. The method determines the key points in the pathfinding path based on physical rays, which is more in line with the player's perception of autonomous control. In addition, the key points determined based on the method show a high and low change trend, which is more in line with the flight trajectory of a real flying object, and can bring a real game experience to the player; third, the method determines the key points in the pathfinding path based on the existing physical rays of the game system, and does not add additional game data. Compared with the pathfinding solution based on the three-dimensional pathfinding map, the memory occupancy and consumption of the key points determined based on physical rays are smaller, and the pathfinding speed is faster.

[0029] The path-finding method, device, electronic device, and computer-readable storage medium in the game described in this application are further described in detail below in conjunction with specific embodiments and drawings.

[0030] Figure 1 1 is an application system diagram of a pathfinding method in a game provided by an embodiment of the present application. Figure 1 As shown in (a), the system includes a user terminal 101 and a server terminal 102. The user terminal 101 can be any device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant (PDA), etc. The server terminal 102 can be a processing device electrically connected to the user terminal 101, or it can be a server communicatively connected to multiple user terminals 101. The server terminal 102 is deployed with the pathfinding method in the game provided by the present application. After receiving the flight instructions issued by the player based on the user terminal 101, it can obtain a pathfinding path that is more in line with the flight trajectory of the real flying object based on this method. Figure 1 As shown in (b), the system includes a user terminal 103, and the user terminal 103 can be any device such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant (PDA), etc. The pathfinding method in the game provided in this application is deployed on the user terminal 103, and the user terminal 103 can obtain a pathfinding path that is more consistent with the flight trajectory of a real flying object based on the method, thereby realizing the automatic navigation flight of the flying object.

[0031] The first embodiment of the present application provides a path finding method in a game. The method is deployed in Figure 1 The server 102 or the user terminal 103 shown is used to support automatic navigation flight of virtual flying objects in the game.

[0032] The automatic navigation flight can be understood as a process in which the user specifies a starting point and an end point, and the virtual flying object automatically finds a way to fly. Of course, the user can also only specify the end point, and use the current position of the virtual flying object as the starting point to automatically find a way to fly.

[0033] In an optional implementation, the pathfinding method in the game provided by this embodiment is an operation performed by the server 102 in response to the user terminal 101 sending an automatic navigation flight instruction to the server 102. The automatic navigation flight instruction can be instruction information generated by the user terminal 101 in response to the player's operation, such as in response to the player's triggering operation of the automatic navigation flight control, in response to the player's selection operation of the starting point and the end point, etc. After receiving the automatic navigation flight instruction sent by the user terminal 101, the server 102 executes the method provided in this embodiment to find key points, so that the virtual flying object can automatically fly according to the key points.

[0034] Figure 2 Flowchart of the path finding method in the game provided by this embodiment. Figure 2The path finding method in the game provided by this embodiment is described in detail. The embodiments described below are used to explain the technical solution of this application and are not intended to be used as limitations for actual use.

[0035] like Figure 2 As shown, the path-finding method in the game provided in this embodiment includes the following steps S210 to S240:

[0036] Step S210, obtain the position information corresponding to the starting point and the ending point, and emit a first ray from the starting point to the ending point, the starting point and the ending point are any two points in the game scene, and the position information at least includes a height value representing the point in the game scene in the game scene.

[0037] The starting point in this embodiment may include the original starting point specified by the user, and may also include a new starting point determined after the path finding operation. The end point in this embodiment is the original end point specified by the user. In this embodiment, the point-to-point path trajectory is not preset in advance, so the original starting point and end point specified by the user may be any point in the game scene, and the new starting point determined after the path finding operation may also be any point in the game scene.

[0038] The position information can be understood as the coordinates of the points in the game scene in the game scene coordinate system, and the game scene coordinate system can use the plane where the lowest terrain in the game scene is located as the XZ plane, and the coordinate axis perpendicular to the XZ plane as the Y axis. The position information is composed of the X-axis coordinate value and the Z-axis coordinate value corresponding to the projection point of the point in the game scene projected on the XZ plane, and the Y-axis coordinate value corresponding to the point in the game scene. Exemplarily, the X-axis coordinate value corresponding to the projection point B projected on the XZ plane by point A is a, the Z-axis coordinate value is c, and the Y-axis coordinate value corresponding to point A is b, then the position information corresponding to point A is (a, b, c). Since the Y axis is perpendicular to the XZ plane, the XZ plane is the plane where the lowest terrain in the game scene is located, therefore, the Y-axis coordinate value corresponding to the point in the game scene can also represent the height of the point in the game scene, and the Y-axis coordinate value is the height value of the point in the game scene. In this embodiment, the position information at least includes a height value representing the height of the point in the game scene in the game scene, and of course also includes a position value representing the position of the point in the game scene relative to the plane where the lowest terrain is located in the game scene.

[0039] The ray is a tool in the game engine, which can be understood as a straight line extending infinitely from a point to a direction. In the game, the ray function interface provided by the game engine can be called to control the ray emission behavior by specifying the ray emission starting point, end point, direction, length, etc. In this embodiment, the ray emitted from the starting point to the end point is defined as the first ray.

[0040] Step S220, in response to the first ray not reaching the termination point due to colliding with an obstacle in the game scene, determining a first hit point of the first ray, and obtaining position information corresponding to the first hit point, the first hit point being used to represent a point in the game scene corresponding to the collision position of the first ray with the obstacle.

[0041] When the first ray is emitted from the starting point to the end point, there will be two results. One is that the first ray reaches the end point, and the other is that the first ray does not reach the end point. It can be understood that when there is an obstacle between the starting point and the end point and the obstacle can block the first ray, the first ray cannot reach the end point. When there is no obstacle between the starting point and the end point, or there is an obstacle but the obstacle cannot block the first ray, the first ray can reach the end point. This is consistent with the flight principle of a real flying object. When an obstacle blocks the flight of a real flying object, the real flying object cannot directly reach the end point. When there is no obstacle blocking or the obstacle is not enough to block the flight of the real flying object, the real flying object can directly reach the end point. Therefore, determining the key points of the path of a virtual flying object based on ray inspection is more in line with the flight principle of a real flying object.

[0042] In this embodiment, in the case where the first ray fails to reach the end point due to collision with an obstacle in the game scene, subsequent operations are performed based on the collision position of the first ray and the obstacle to find the key point of the corresponding path finding path.

[0043] Specifically, when the first ray does not reach the termination point, the hit point corresponding to the first ray is determined based on the collision position of the first ray with the obstacle. In this embodiment, the hit point corresponding to the first ray is defined as the first hit point. The first hit point can be understood as a point in the game scene corresponding to the collision position of the first ray with the obstacle, and the first hit point can also be understood as the collision point of the first ray with the obstacle.

[0044] In this embodiment, after the first hit point is determined, the position information corresponding to the first hit point needs to be obtained. The position information corresponding to the points in the game scene is known, so after the first hit point is determined, the position information corresponding to the first hit point can be directly obtained.

[0045] Step S230, adjusting the first preset height based on the height value of the position information corresponding to the first hitting point to form a first changed hitting point corresponding to the first hitting point.

[0046] It is understandable that when an obstacle blocks the flight of a real flying object, the real flying object will gradually increase its flight altitude to fly above the obstacle. Or in some special cases, it will gradually decrease its flight altitude to fly below the obstacle. In the method provided in this embodiment, the flight principle of a real flying object is simulated, and the first shooting point is raised or lowered to increase or decrease the flight altitude of the virtual flying object in the game scene.

[0047] Specifically, a first preset height is set, and the first preset height is added or subtracted from the height value of the position information corresponding to the first hit point to form new position information. The point corresponding to the new position information is higher or lower than the first hit point. In this embodiment, the point corresponding to the new position information is defined as the first changed hit point. Whether to add the first preset height or reduce the first preset height to the height value of the position information corresponding to the first hit point can be adjusted according to the specific game settings, or automatically adjusted according to the position and volume proportion of the obstacle in the game scene during the game, without specific restrictions. In some subsequent examples, the example of adding the first preset height to the height value of the position information corresponding to the first hit point is used for illustration. Exemplarily, the position information corresponding to the first hit point K is (a, b, c), where b is the height value corresponding to the first hit point K. Assuming that the first preset height is d, the first preset height d is added to the height value b of the position information (a, b, c) corresponding to the first hit point K to form new position information (a, b + d, c). The point corresponding to the new position information (a, b+d, c) is the first changed hit point M corresponding to the first hit point K. In the game scene, the first changed hit point M is higher than the first hit point K.

[0048] The first preset height is an adjustable value, which can be adjusted according to the terrain conditions of the specific game scene. Optionally, the first preset height is set according to the terrain difference between the lowest terrain and the highest terrain in the game scene. For example, one percent of the terrain difference is used as the first preset height. It is understandable that if the first preset height is set too low, the number of pathfinding cycles will increase, the number of key points in the flight path will increase, and the amount of calculation and memory consumption will increase. If the first preset height is set too high, the virtual flying object will be raised or lowered to an unnecessary height for flight, affecting the realism of the flight path. Therefore, in actual applications, the appropriate first preset height can be determined through multiple debugging.

[0049] Step S240, determining the first changed hit point as the key point of the path finding path.

[0050] After the first changed hit point is determined, the first changed hit point can be determined as a key point of the path finding path. Specifically, after the first changed hit point is added to the starting point, a path finding path including at least the starting point and the first updated hit point is formed, so that the virtual flying object flies from the starting point to the first changed hit point along the path finding path.

[0051] In this embodiment, after the first changed hit point is determined as the key point of the path finding path, the method provided by this embodiment may also include: taking the first changed hit point as the new starting point, repeating the path finding until the first ray reaches the end point. That is, the path finding method provided by this embodiment is a cyclic iterative process. After a key point is determined, the key point will be used as the new starting point, and the next key point will continue to be found based on the above steps S210 to S240 until the first ray reaches the end point, and the path finding is terminated. At this time, the path finding path will be composed of the starting point, the key point, and the end point. In an optional implementation method, a maximum number of executions will be set for the above repeated operations to prevent an infinite loop. Optionally, when the number of repeated operations has reached the maximum number of executions, and the first ray still cannot reach the end point, it will be determined that this path finding operation has failed.

[0052] In this embodiment, when the first ray reaches the end point, the pathfinding will be terminated directly, and the starting point and the end point will form a pathfinding path, so that the virtual flying object will fly directly from the starting point to the end point along the pathfinding path. Based on this, the method provided by this embodiment can also include the following steps S11 to S12:

[0053] Step S11, in response to the first ray reaching the end point, ending the path finding.

[0054] Step S12, forming a path finding path by the starting point and the ending point.

[0055] The path-finding method provided in this embodiment is illustrated below with specific examples. Figure 3 It is a schematic diagram of a path-finding method in a game provided by this embodiment.

[0056] like Figure 3 As shown, the starting point preset by the player is point A in the game scene, and the ending point is point B in the game scene. There is an obstacle 30 between point A and point B. Pathfinding based on the pathfinding method in the game provided in this embodiment may include the following steps:

[0057] Step S301, obtain the position information corresponding to point A and point B, and emit the first ray 311 from point A to point B. Since the first ray 311 collides with the obstacle 30 and cannot reach point B, point C corresponding to the collision position of the first ray 311 and the obstacle 30 is used as the first hit point, and the position information corresponding to point C is obtained.

[0058] Step S302, add the first preset height L to the height value of the position information corresponding to point C to form point C', which is the first changed hit point corresponding to the first hit point, and determine point C' as the key point of the path finding. The current path finding path includes: point A→point C'.

[0059] Step S303, taking point C' as the new starting point, obtaining the position information corresponding to point C', emitting the first ray 312 from point C' to point B. Since the first ray 312 collides with the obstacle 30 and cannot reach point B, point D corresponding to the collision position of the first ray 312 and the obstacle 30 is taken as the first hit point, obtaining the position information corresponding to point D.

[0060] Step S304, add the first preset height L to the height value of the position information corresponding to point D to form point D', which is the first changed hit point corresponding to the first hit point, and determine point D' as the key point of the path finding. The current path finding path includes: point A → point C' → point D'.

[0061] Step S305, taking point D' as the new starting point, obtaining the position information corresponding to point D', emitting the first ray 313 from point D' to point B. Since the first ray 313 collides with the obstacle 30 and cannot reach point B, point E corresponding to the collision position of the first ray 313 and the obstacle 30 is taken as the first hit point, obtaining the position information corresponding to point E.

[0062] Step S306, add the first preset height L to the height value of the position information corresponding to point E to form point E'. Point E' is the first changed hit point corresponding to the first hit point. Point E' is determined as the key point of the path finding. The current path finding path includes: point A → point C' → point D' → point E'.

[0063] Step S307, taking point E' as the new starting point, obtaining the position information corresponding to point E', emitting the first ray 314 from point E' to point B. Since the first ray 314 collides with the obstacle 30 and cannot reach point B, point F corresponding to the collision position of the first ray 314 and the obstacle 30 is taken as the first hit point, obtaining the position information corresponding to point F.

[0064] Step S308, add the first preset height L to the height value of the position information corresponding to point F to form point F'. Point F' is the first changed hit point corresponding to the first hit point. Point F' is determined as the key point of the path finding. The current path finding path includes: point A → point C' → point D' → point E' → point F'.

[0065] Step S309, taking point F' as the new starting point, obtaining the position information corresponding to point F', emitting the first ray 315 from point F' to point B, and ending the pathfinding because the first ray 315 reaches point B. The pathfinding path is: point A → point C' → point D' → point E' → point F' → point B.

[0066] Through the above steps, a path from the starting point (point A) to the end point (point B) is generated. The virtual flying object starts from point A along the path, passes through points C', D', E', and F' in sequence, and arrives at point B.

[0067] Since the first change hit point is a point formed by raising the first hit point to a first preset height, the first ray can reach the first hit point from the starting point, but there are still special cases, that is, there is an obstacle between the starting point and the first change hit point. In this case, the first change hit point is still used as the key point of the path, and the virtual flying object cannot fly from the starting point to the first change hit point. Based on this, in an optional implementation provided by this embodiment, before determining the first change hit point as the key point of the path finding path, it is necessary to further verify whether there is an obstacle between the starting point and the first change hit point that can block the flight of the virtual flying object based on ray inspection. Specifically, a ray is emitted from the starting point to the first change hit point to determine whether the ray can reach the first change hit point. In this embodiment, the ray emitted from the starting point to the change hit point is defined as the second ray. Further, when the second ray can reach the first change hit point, the first change hit point can be determined as a key point. When the second ray cannot reach the first change hit point due to collision with an obstacle, the first change hit point cannot become a key point. Based on this, determining the first changed hit point as the key point of the path finding path may specifically include: in response to the second ray reaching the first changed hit point due to not colliding with an obstacle, determining the first changed hit point as the key point of the path finding path.

[0068] In an optional implementation, this embodiment further provides a solution when the second ray cannot reach the first changed hit point due to collision with an obstacle, which may specifically include the following steps S21 to S24:

[0069] Step S21, in response to the second ray not reaching the first changed hit point due to collision with an obstacle, determine the second hit point of the second ray, and obtain position information corresponding to the second hit point, the second hit point is used to represent the point in the game scene corresponding to the collision position of the second ray and the obstacle.

[0070] Step S22, adjusting the first preset height based on the height value of the position information corresponding to the second hit point to form a second changed hit point corresponding to the second hit point.

[0071] Step S23, emitting a second ray from the starting point to the second changed hit point, and determining whether the second ray fails to reach the second changed hit point due to collision with an obstacle.

[0072] Step S24, in response to the second ray reaching the second changed hit point due to not colliding with the obstacle, the second changed hit point is determined as a key point of the path finding path.

[0073] In this embodiment, in the case that the second ray fails to reach the first changed hit point, a subsequent operation is performed based on the collision position of the second ray with the obstacle to find the corresponding key point again.

[0074] Specifically, when the second ray does not reach the first changed hit point, the hit point corresponding to the second ray is determined based on the collision position of the second ray with the obstacle. In this embodiment, the hit point corresponding to the second ray is defined as the second hit point. The second hit point can be understood as a point in the game scene corresponding to the collision position of the second ray with the obstacle, and the second hit point can also be understood as the collision point of the second ray with the obstacle.

[0075] In this embodiment, after the second hit point is determined, it is necessary to obtain the position information corresponding to the second hit point. The position information corresponding to the point in the game scene is known, so after the second hit point is determined, the position information corresponding to the second hit point can be directly obtained. Then, the first preset height is added or subtracted from the height value of the position information corresponding to the second hit point to form new position information. The point corresponding to the new position information is higher or lower than the second hit point. In this embodiment, the point corresponding to the new position information is defined as the second changed hit point. Optionally, the first preset height is added to the height value of the position information corresponding to the second hit point to form the second changed hit point corresponding to the second hit point. Exemplarily, the position information corresponding to the second hit point P is (a, b, c), where b is the height value corresponding to the second hit point P. Assuming that the first preset height is d, the first preset height d is added to the height value b of the position information (a, b, c) corresponding to the second hit point P to form new position information (a, b + d, c). The point corresponding to the new position information (a, b+d, c) is the second changed hit point Q corresponding to the second hit point P. In the game scene, the second changed hit point Q is higher than the second hit point P.

[0076] After the second change hit point is determined, it is also necessary to determine whether there is an obstacle between the starting point and the second change hit point that hinders the flight of the virtual flying object. Therefore, a second ray is emitted from the starting point to the second change hit point to determine whether the second ray can reach the second change hit point. Further, when the second ray can reach the second change hit point, the second change hit point can be determined as a key point of the path finding path. When the second ray cannot reach the second change hit point, the second change hit point cannot become a key point.

[0077] In this embodiment, in the case where the second ray can reach the second changed hit point, after determining the second changed hit point as the key point of the path finding path, the second changed hit point will be used as the new starting point to repeat the path finding until the first ray reaches the end point, forming a path finding path consisting of the starting point, the key point, and the end point. In the case where the second ray cannot reach the second changed hit point, steps S21 to S23 will be repeated until the second changed hit point reachable by the second ray is found. In an optional implementation, a maximum number of executions will be set for the above-mentioned repeated operations to prevent an infinite loop. Optionally, when the number of repeated operations has reached the maximum number of executions and the second changed hit point reachable by the second ray has not been found, it will be determined that this path finding operation has failed.

[0078] The path-finding method provided in this embodiment is illustrated below with specific examples. Figure 4 It is a schematic diagram of another path-finding method in a game provided by this embodiment.

[0079] like Figure 4 As shown, the starting point preset by the player is point A in the game scene, and the ending point is point B in the game scene. There is an obstacle 40 between point A and point B. Pathfinding based on the pathfinding method in the game provided in this embodiment may include the following steps:

[0080] Step S401, obtain the position information corresponding to point A and point B, and emit the first ray 411 from point A to point B. Since the first ray 411 collides with the obstacle 40 and cannot reach point B, point C corresponding to the collision position of the first ray 411 and the obstacle 40 is used as the first hit point to obtain the position information corresponding to point C.

[0081] Step S402, adding a first preset height L to the height value of the position information corresponding to point C to form point C', where point C' is a first changed hitting point corresponding to the first hitting point.

[0082] Step S403, obtain the position information corresponding to point C', and emit the second ray 421 from point A to point C'. Since the second ray 421 collides with the obstacle 40 and cannot reach point C', point D corresponding to the collision position of the second ray 421 and the obstacle 40 is used as the second hit point to obtain the position information corresponding to point D.

[0083] Step S404, adding the first preset height L to the height value of the position information corresponding to point D to form point D', where point D' is the second changed hitting point corresponding to the second hitting point.

[0084] Step S405, obtain the position information corresponding to point D', and emit the second ray 422 from point A to point D'. Since the second ray 422 collides with the obstacle 40 and cannot reach point D', point E corresponding to the collision position of the second ray 422 and the obstacle 40 is used as the second hit point to obtain the position information corresponding to point E.

[0085] Step S406, adding the first preset height L to the height value of the position information corresponding to point E to form point E', where point E' is the second changed hitting point corresponding to the second hitting point.

[0086] Step S407, obtain the position information corresponding to point E', and emit a second ray 423 from point A to point E'. Since the second ray 423 can reach point E', point E' is determined as the key point of the path finding path. The current path finding path includes: point A→point E'.

[0087] Step S408, taking point E' as the new starting point, obtaining the position information corresponding to point E', emitting the first ray 412 from point E' to point B. Since the first ray 412 collides with the obstacle 40 and cannot reach point B, taking point F corresponding to the collision position of the first ray 412 and the obstacle 40 as the first hit point, obtaining the position information corresponding to point F.

[0088] Step S409, adding the first preset height L to the height value of the position information corresponding to point F to form point F', where point F' is the first changed hitting point corresponding to the first hitting point.

[0089] Step S410, obtain the position information corresponding to point F', and emit a second ray 424 from point A to point F'. Since the second ray 424 can reach point F', point F' is determined as the key point of the path finding path. The current path finding path includes: point A → point E' → point F'.

[0090] Step S411, take point F' as the new starting point, obtain the position information corresponding to point F', and emit the first ray 413 from point F' to point B. Since the first ray 413 collides with the obstacle 40 and cannot reach point B, take point G corresponding to the collision position of the first ray 413 and the obstacle 40 as the first hit point, and obtain the position information corresponding to point G.

[0091] Step S412, adding the first preset height L to the height value of the position information corresponding to point G to form point G', where point G' is the first changed hitting point corresponding to the first hitting point.

[0092] Step S413, obtain the position information corresponding to point G', and emit a second ray 425 from point A to point G'. Since the second ray 425 can reach point G', point G' is determined as the key point of the path finding path. The current path finding path includes: point A → point E' → point F' → point G'.

[0093] In step S414, point G' is used as a new starting point, the position information corresponding to point G' is obtained, and a first ray 414 is emitted from point G' to point B. Since the first ray 414 collides with the obstacle 40 and cannot reach point B, point H corresponding to the collision position of the first ray 414 and the obstacle 40 is used as the first hit point, and the position information corresponding to point H is obtained.

[0094] Step S415 , adding the first preset height L to the height value of the position information corresponding to point H to form point H′, where point H′ is the first changed hitting point corresponding to the first hitting point.

[0095] Step S416, obtain the position information corresponding to point H', and emit a second ray 426 from point A to point H'. Since the second ray 426 can reach point H', point H' is determined as the key point of the path finding path. The current path finding path includes: point A → point E' → point F' → point G' → point H'.

[0096] Step S417, taking point H' as the new starting point, obtaining the position information corresponding to point H', emitting the first ray 415 from point H' to point B, and ending the pathfinding because the first ray 415 can reach point B. The pathfinding path is: point A → point E' → point F' → point G' → point H' → point B.

[0097] Through the above steps, a path from the starting point (point A) to the end point (point B) is generated. The virtual flying object starts from point A along the path, passes through points E', F', G', and H' in sequence, and arrives at point B.

[0098] In some game scenes with large terrain fluctuations, the virtual flying object may rise too high, which will not meet the player's real experience. In response to this situation, in an optional implementation, the pathfinding method provided in this embodiment also includes switching the pathfinding scheme. Specifically, in the process of pathfinding using the above method, when it is found that the height to which the virtual flying object needs to be raised is too high (for example, exceeding the preset height), the current pathfinding scheme can be switched to the pathfinding map pathfinding scheme to achieve a detour for the overly high area. Such a flight path is more in line with the flight trajectory of the real flying object.

[0099] Based on this, in an optional implementation, before determining the first changed hit point as a key point of the path finding path, the method provided in this embodiment may further include: judging whether the height value corresponding to the first changed hit point is greater than the second preset height according to the position information corresponding to the first changed hit point. Further, determining whether to switch the path finding scheme based on the judgment result.

[0100] The second preset height is an adjustable value, which can be understood as the maximum height set by developers or players for allowing virtual flying objects to fly. Developers can set it according to the terrain conditions of the specific game scene, and players can set it according to their own game preferences. There are no specific restrictions here.

[0101] In this embodiment, when the height value corresponding to the first changed hit point does not exceed the maximum height (the second preset height) allowed for the virtual flying object to fly, the first changed hit point can be determined as a key point of the path finding path, allowing the virtual flying object to fly to the first changed hit point. Based on this, determining the first changed hit point as a key point of the path finding path can specifically include: in response to the height value corresponding to the first changed hit point being less than or equal to the second preset height, determining the first changed hit point as a key point of the path finding path.

[0102] In this embodiment, when the height value corresponding to the first changed hit point exceeds the maximum height (second preset height) allowed for the virtual flying object to fly, because the virtual flying object cannot fly to the height of the first changed hit point, the first changed hit point cannot become a key point of the path finding path. This embodiment provides a solution for the situation where the height value corresponding to the first changed hit point exceeds the maximum height (second preset height) allowed for the virtual flying object to fly. In an optional implementation, the method provided in this embodiment may also include the following steps S31 to S32:

[0103] Step S31, in response to the height value corresponding to the first changed hit point being greater than the second preset height, the height value corresponding to the first changed hit point is changed to the second preset height to form a first height changed hit point corresponding to the first changed hit point.

[0104] Step S32, determining the first height change hit point as the key point of the path finding path.

[0105] The height value corresponding to the first changed hit point is greater than the second preset height, and the height value of the position information corresponding to the first changed hit point can be replaced with the second preset height to form new position information. The point corresponding to the new position information is lower than the first changed hit point. In this embodiment, the point corresponding to the new position information is defined as the first height changed hit point. Exemplarily, the position information corresponding to the first changed hit point M is (a, b, c), where b is the height value corresponding to the first changed hit point M. Assuming that b is greater than the second preset height l, the height value b of the position information (a, b, c) corresponding to the first changed hit point M is replaced with the second preset height l to form new position information (a, l, c). The point corresponding to the new position information (a, l, c) is the first height changed hit point N corresponding to the first changed hit point M. In the game scene, the first height changed hit point N is lower than the first changed hit point M.

[0106] Since the height value corresponding to the first height change hit point is the second preset height, which is the height at which the virtual flying object is allowed to fly, the first height change hit point can be used instead of the first change hit point as the key point of the path finding so that the virtual flying object can fly to the first height change hit point.

[0107] In this embodiment, the first height change hit point is determined, that is, the highest point on the starting point side that the virtual flying object is allowed to fly is determined. After further determining the highest point on the ending point side that the virtual flying object is allowed to fly, the area where the path finding scheme needs to be switched can be determined.

[0108] Based on this, in an optional implementation, the method provided in this embodiment may further include the following steps S41 to S42:

[0109] Step S41, judging whether the height value corresponding to the end point is greater than a second preset height according to the position information corresponding to the end point.

[0110] Step S42, in response to the altitude value corresponding to the termination point being greater than the second preset altitude, determining the key point between the first altitude change hit point and the termination point based on the pre-generated flight path map.

[0111] After determining the highest point on the side of the starting point that the virtual flying object is allowed to fly (i.e., the first height change hit point), if the height of the end point itself has exceeded the maximum height allowed for the virtual flying object to fly (i.e., the second preset height), then the area between the first height change hit point and the end point is an area where the pathfinding scheme of the pathfinding map needs to be switched. Therefore, key points will be determined based on the pathfinding map between the first height change hit point and the end point. It should be noted that the pathfinding map in this embodiment is a two-dimensional pathfinding map, and is a flight pathfinding map pre-generated based on a traditional two-dimensional pathfinding map to ensure that the flight path will not be close to the ground and will not conform to the flight trajectory of the real flying object.

[0112] Based on this, when it is determined that the height value corresponding to the end point is greater than the second preset height, the key points of the path between the first height change hit point and the end point will be determined based on the flight path map. Path finding methods based on path finding maps are relatively common, such as A* algorithm, Dijkstra algorithm, JPS (Jump Point Search) algorithm, etc. The specific path finding methods based on path finding maps are not limited or described in detail here.

[0113] The path-finding method provided in this embodiment is illustrated below with specific examples. Figure 5 It is a schematic diagram of another path-finding method in a game provided by this embodiment.

[0114] like Figure 5As shown, the starting point preset by the player is point A in the game scene, and the ending point is point B in the game scene. There is an obstacle 50 between point A and point B. Pathfinding based on the pathfinding method in the game provided in this embodiment may include the following steps:

[0115] Step S501 , emitting a first ray 511 from point A to point B. Since the first ray 511 collides with the obstacle 50 and cannot reach point B, point C corresponding to the collision position of the first ray 511 and the obstacle 50 is used as the first hit point.

[0116] Step S502, add the first preset height L1 to the height value corresponding to point C to form point C', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point C' is less than the second preset height L2, point C' is determined as the key point of the path finding.

[0117] Step S503, taking point C' as a new starting point, emitting a first ray 512 from point C' to point B. Since the first ray 512 collides with the obstacle 50 and cannot reach point B, point D corresponding to the collision position of the first ray 512 and the obstacle 50 is taken as the first hit point.

[0118] Step S504, add the first preset height L1 to the height value corresponding to point D to form point D', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point D' is less than the second preset height L2, point D' is determined as the key point of the path finding.

[0119] Step S505, taking point D' as a new starting point, emitting a first ray 513 from point D' to point B. Since the first ray 513 collides with the obstacle 50 and cannot reach point B, point E corresponding to the collision position of the first ray 513 and the obstacle 50 is taken as the first hit point.

[0120] Step S506, add the first preset height L1 to the height value corresponding to point E to form point E', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point E' is greater than the second preset height L2, the height value corresponding to point E' is replaced with the second preset height L2 to form point E", which is the first height changed hit point corresponding to the first changed hit point. Point E" is determined as the key point of the path finding path.

[0121] Step S307, determine whether the altitude value corresponding to point B is greater than the second preset altitude value L2. In this diagram, since the altitude value corresponding to point B is greater than the second preset altitude value L2, a key point is determined between point E" and point B based on the flight path map.

[0122] In an optional implementation, when it is determined that the height value corresponding to the end point is not greater than the second preset height, the path map cannot be used for the entire area between the first height change hit point and the end point, but it is necessary to determine the highest point on the side of the end point that allows the virtual flying object to fly, so as to perform path map path finding between the two highest points. Based on this, the method provided in this embodiment can also include the following steps S51 to S58:

[0123] Step S51, in response to the height value corresponding to the end point being less than or equal to the second preset height, emitting a third ray from the end point to the first height change hit point or start point.

[0124] Step S52, determining a third hit point of the third ray, and obtaining position information corresponding to the third hit point, where the third hit point is used to represent a point in the game scene corresponding to a collision position of the third ray with the obstacle.

[0125] Step S53, adjusting the first preset height based on the height value of the position information corresponding to the third hitting point to form a third changed hitting point corresponding to the third hitting point.

[0126] Step S54, judging whether the height value corresponding to the third changed hitting point is greater than the second preset height according to the position information corresponding to the third changed hitting point.

[0127] Step S55, in response to the height value corresponding to the third changed hit point being less than or equal to the second preset height, the third changed hit point is determined as a key point of the path finding path.

[0128] Step S56, in response to the height value corresponding to the third changed hit point being greater than the second preset height, the height value corresponding to the third changed hit point is changed to the second preset height to form a third height changed hit point corresponding to the third changed hit point.

[0129] Step S57, determining the third height change hit point as the key point of the path finding path.

[0130] Step S58, determining the key point between the first altitude change hit point and the third altitude change hit point based on the flight path map.

[0131] When the height value corresponding to the end point is not greater than the second preset height, a ray will be emitted from the end point to the starting point or the first height change hit point. In this embodiment, the ray emitted from the end point to the starting point or the first height change hit point is defined as the third ray. It should be noted that after the first height change hit point is determined on the side of the starting point, the first height change hit point will be determined as the key point of the path finding path, and the first height change hit point will become the new starting point. Therefore, in this step, whether the third ray is emitted from the end point to the starting point or from the end point to the first height change hit point, the purpose of finding the highest point on the side of the end point can be achieved.

[0132] A third ray is emitted from the end point to the start point or the first height-changed hit point. The point in the game scene corresponding to the collision position of the third ray with the obstacle is the hit point corresponding to the third ray. In this embodiment, the hit point corresponding to the third ray is defined as the third hit point. The position information corresponding to the third hit point is obtained, and the first preset height is added to the height value of the position information corresponding to the third hit point to form new position information. The point corresponding to the new position information is higher than the third hit point. In this embodiment, the point corresponding to the new position information is defined as the third changed hit point.

[0133] After determining the third change hit point, it is necessary to determine whether the height value corresponding to the third change hit point is greater than the second preset height. If the height value corresponding to the third change hit point is not greater than the second preset height, it means that the third change hit point is a point that the virtual flying object can fly to, and the third change hit point can be determined as the key point of the path finding path. Further, the third change hit point is used as the new end point, and the path finding is repeated until the third change hit point with a height value greater than the second preset height is found. If the height value corresponding to the third change hit point is greater than the second preset height, it means that the third change hit point is a point that the virtual flying object cannot fly to, and the height value corresponding to the third change hit point can be reduced. Specifically, the height value corresponding to the third change hit point is replaced with the second preset height to form new position information. The point corresponding to the new position information is lower than the third change hit point. In this embodiment, the point corresponding to the new position information is defined as the third height change hit point. The third height change hit point is the highest point on one side of the end point, and the point is determined as the key point of the path finding path. At this point, the highest point on the starting point side (i.e., the first height change hit point) and the highest point on the end point side (i.e., the third height change hit point) have been found. Then, path finding can be performed between the first height change hit point and the third height change hit point.

[0134] It should be noted that the above process can also be understood as exchanging the end point with the start point, and continuing to execute the process of emitting the first ray from the start point to the end point and the subsequent operation steps.

[0135] The path-finding method provided in this embodiment is illustrated below with specific examples. Figure 6 It is a schematic diagram of another path-finding method in a game provided by this embodiment.

[0136] like Figure 6 As shown, the starting point preset by the player is point A in the game scene, and the ending point is point B in the game scene. There is an obstacle 60 between point A and point B. Pathfinding based on the pathfinding method in the game provided in this embodiment may include the following steps:

[0137] Step S601 , emitting a first ray 611 from point A to point B. Since the first ray 611 collides with the obstacle 60 and cannot reach point B, point C corresponding to the collision position of the first ray 611 and the obstacle 60 is used as the first hit point.

[0138] Step S602, add the first preset height L1 to the height value corresponding to point C to form point C', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point C' is less than the second preset height L2, point C' is determined as the key point of the path finding.

[0139] Step S603, taking point C' as a new starting point, emitting a first ray 612 from point C' to point B. Since the first ray 612 collides with the obstacle 60 and cannot reach point B, point D corresponding to the collision position of the first ray 612 and the obstacle 60 is taken as the first hit point.

[0140] Step S604, add the first preset height L1 to the height value corresponding to point D to form point D', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point D' is less than the second preset height L2, point D' is determined as the key point of the path finding.

[0141] Step S605, taking point D' as a new starting point, emitting a first ray 613 from point D' to point B. Since the first ray 613 collides with the obstacle 60 and cannot reach point B, point E corresponding to the collision position of the first ray 613 and the obstacle 60 is taken as the first hit point.

[0142] Step S606, add the first preset height L1 to the height value corresponding to point E to form point E', which is the first changed hit point corresponding to the first hit point. Since the height value corresponding to point E' is greater than the second preset height L2, the height value corresponding to point E' is replaced with the second preset height L2 to form point E", which is the first height changed hit point corresponding to the first changed hit point, that is, the highest point on the side of the starting point. Point E" is determined as the key point of the path finding path.

[0143] Step S607, determine whether the height value corresponding to point B is greater than the second preset height value L2. In this diagram, the height value corresponding to point B is less than the second preset height value L2.

[0144] Step S608, the third ray 631 is emitted from point B to point E". Since the third ray 631 collides with the obstacle 60 and cannot reach point E", point F corresponding to the collision position of the third ray 631 and the obstacle 60 is used as the third hit point.

[0145] Step S609, add the first preset height L1 to the height value corresponding to point F to form point F', which is the third changed hit point corresponding to the third hit point. Since the height value corresponding to point F' is less than the second preset height L2, point F' is determined as the key point of the path finding.

[0146] Step S610, taking point F' as the new end point, emitting the third ray 632 from point F' to point E". Since the third ray 632 collides with the obstacle 60 and cannot reach point E", point G corresponding to the collision position between the third ray 632 and the obstacle 60 is taken as the third hit point.

[0147] Step S611, add the first preset height L1 to the height value corresponding to point G to form point G', which is the third changed hit point corresponding to the third hit point. Since the height value corresponding to point G' is greater than the second preset height L2, the height value corresponding to point G' is replaced with the second preset height L2 to form point G", which is the first height changed hit point corresponding to the first changed hit point, that is, the highest point on one side of the end point. Point G" is determined as the key point of the path finding path.

[0148] Step S614, determine the key point between point E" and point G" based on the flight path finding graph.

[0149] As described above, in this embodiment, the flight path map is switched to perform path finding for areas where the terrain is too high. Based on this, in an optional implementation, the method provided in this embodiment may further include the following steps S61 to S65:

[0150] Step S61, obtaining a two-dimensional path-finding map pre-built for the game scene, the two-dimensional path-finding map includes multiple path-finding points, and the path-finding points at least record the height values ​​of points on the ground representing the game scene in the game scene.

[0151] Step S62, traverse each path-finding point of the two-dimensional path-finding graph.

[0152] Step S63, in response to the altitude value corresponding to the wayfinding point being greater than the second preset altitude, marking the wayfinding point as an unreachable area.

[0153] Step S64, in response to the altitude value corresponding to the wayfinding point being less than or equal to the second preset altitude, the altitude value corresponding to the wayfinding point is changed to the second preset altitude.

[0154] Step S65, generating a flight path-finding graph corresponding to the two-dimensional path-finding graph.

[0155] A two-dimensional pathfinding map can be understood as an information map generated based on the terrain of the game scene, which records the location information corresponding to points on the ground. The location information at least includes a height value that represents the height of the point on the ground. Each pathfinding point on the two-dimensional pathfinding map corresponds to a point on the ground of the game scene, which is usually a key point that can represent changes in the terrain of the game scene.

[0156] In the present embodiment, the flight pathfinding map is generated based on a pre-constructed two-dimensional pathfinding map. Specifically, each pathfinding point of the two-dimensional pathfinding map is traversed to determine the height value corresponding to each pathfinding point. When the height value is greater than the second preset height, it means that the pathfinding point is a point that the virtual flying object cannot fly to, and the pathfinding point can be marked as unreachable. When the height value is not greater than the second preset height, it means that the pathfinding point is a point that the virtual flying object can fly to. In order to prevent the virtual flying object from flying close to the ground at the pathfinding point, in the present embodiment, the height value corresponding to the pathfinding point is replaced with the second preset height so that the virtual flying object flies at the second preset height at the pathfinding point. It can be understood that the pathfinding is based on the flight pathfinding map between the first altitude change hit point and the third altitude change hit point, and the altitude values ​​corresponding to the first altitude change hit point and the third altitude change hit point are both the second preset altitude. Therefore, replacing the altitude value corresponding to the pathfinding point with the second preset altitude can ensure that the flight altitude of the virtual flying object is consistent between the first altitude change hit point and the third altitude change hit point, which is more in line with the flight trajectory of a real flying object when it encounters an obstacle that is too high.

[0157] After traversing each pathfinding point of the two-dimensional pathfinding graph based on the above method, a flight pathfinding graph corresponding to the two-dimensional pathfinding graph can be generated. In the flight pathfinding graph, except for the points marked as unreachable, the height values ​​corresponding to other pathfinding points are all the second preset heights.

[0158] In an optional implementation provided by this embodiment, after the pathfinding path is determined based on the pathfinding method provided by this embodiment, the virtual flying object in the game scene can be controlled to fly from the starting point to the end point along the key points of the pathfinding path. Exemplarily, the generated pathfinding path is point A→point E'→point F'→point G'→point H'→point B, that is, the virtual flying object will be controlled to start from point A, pass through point E', point F', point G', point H' in sequence, and arrive at point B. In this way, the automatic navigation flight of the virtual flying object in the game scene is realized.

[0159] The following are several optional implementations of the path-finding method in the game provided by this embodiment.

[0160] Figure 7 It is a flowchart of a path-finding method in a game provided by this embodiment.

[0161] like Figure 7 As shown, the path finding method provided in this embodiment may include the following steps S701 to S709:

[0162] Step S701, determine the starting point and the ending point.

[0163] Step S702, emitting a ray from the starting point to the ending point.

[0164] Step S703, determining whether the ray can reach the end point.

[0165] Step S704, in response to the ray being able to reach the end point, generating a pathfinding path and returning.

[0166] Step S705, in response to the ray being unable to reach the end point, increasing the height value corresponding to the hit point by a first preset height to form a changed hit point corresponding to the hit point.

[0167] Step S706, emitting a ray from the starting point to the changed hit point.

[0168] Step S707, determining whether the ray can reach the changed hit point.

[0169] Step S708, in response to the ray being unreachable, change the hit point, and return to step S705.

[0170] Step S709, in response to the ray being able to reach the changed hit point, determine the changed hit point as a key point of the path finding path and use it as a new starting point, and return to step S701.

[0171] Figure 8 It is a flowchart of another path-finding method in a game provided by this embodiment.

[0172] like Figure 8 As shown, the path finding method provided in this embodiment may include the following steps S801 to S811:

[0173] Step S801, determine the starting point and the ending point.

[0174] Step S802, emitting a ray from the starting point to the ending point.

[0175] Step S803, determining whether the ray can reach the end point.

[0176] Step S804, in response to the ray being able to reach the end point, generating a pathfinding path and returning.

[0177] Step S805, in response to the ray being unable to reach the end point, increasing the height value corresponding to the hit point by a first preset height to form a changed hit point corresponding to the hit point.

[0178] Step S806, determining whether the height value corresponding to the changed hitting point exceeds the second preset height.

[0179] Step S807, in response to the fact that the height value corresponding to the changed hit point does not exceed the second preset height, the changed hit point is determined as a key point of the path finding path and used as a new starting point, and then returns to step S801.

[0180] Step S808, in response to the height value corresponding to the changed hit point exceeding the second preset height, determining whether the height value corresponding to the end point exceeds the second preset height.

[0181] Step S809, in response to the altitude value corresponding to the end point exceeding the second preset altitude, switching the path finding graph to path finding.

[0182] Step S810, adding the key points determined based on the path-finding graph to the path-finding path and returning.

[0183] Step S811, in response to the altitude value corresponding to the end point not exceeding the second preset altitude, the start point and the end point are exchanged, and the process returns to step S801.

[0184] Fig. 9 It is a schematic diagram of the flow of generating a flight path finding map provided in this embodiment.

[0185] like Fig. 9 As shown, the method for generating a flight path finding graph provided in this embodiment may include the following steps S901 to S907:

[0186] Step S901, obtaining the height value corresponding to the pathfinding point in the pathfinding map.

[0187] Step S902, determine whether the altitude value corresponding to the waypoint exceeds the second preset altitude.

[0188] Step S903, in response to the altitude value corresponding to the wayfinding point exceeding the second preset altitude, marking the wayfinding point as unreachable.

[0189] Step S904, in response to the altitude value corresponding to the wayfinding point not exceeding the second preset altitude, the altitude value corresponding to the wayfinding point is updated using the second preset altitude.

[0190] Step S905, determine whether all the waypoints have been traversed.

[0191] Step S906, in response to not all the waypoints being traversed, jump to the next waypoint and return to step S901.

[0192] Step S907, in response to all the wayfinding points having been traversed, generating a flight wayfinding graph corresponding to the wayfinding graph.

[0193] The first embodiment above provides an optional pathfinding method in the game, which is a pathfinding method that can make the path of the automatic navigation flight of the flying object closer to the flight trajectory of the real flying object without increasing or increasing the amount of data and memory consumption. First, the method does not involve the advance preset of the path trajectory, and the starting point and the end point can be any two points in the game scene, making the automatic navigation flight of the flying object in the game scene more flexible; second, the method is not based on a two-dimensional pathfinding map, and there is no situation where the flight path is close to the ground. The method determines the key points in the pathfinding path based on physical rays, which is more in line with the player's perception of autonomous control. In addition, the key points determined based on the method show a high and low change trend, which is more in line with the flight trajectory of the real flying object, and can bring a real game experience to the player; third, the method determines the key points in the pathfinding path based on the existing physical rays of the game system, and does not add additional game data. Compared with the pathfinding solution based on the three-dimensional pathfinding map, the memory occupancy and consumption of the key points determined based on physical rays are smaller, and the pathfinding speed is faster.

[0194] It should be noted that the examples in the first embodiment are only for explaining the method described in this application and are not intended to be limiting for actual use. The path-finding method in the game provided in this application includes but is not limited to the method described in the first embodiment.

[0195] The second embodiment of the present application provides a path-finding device in a game. Fig.10 It is a schematic diagram of the structure of the path-finding device in the game provided by this embodiment.

[0196] like Fig.10 As shown, the path-finding device in the game provided by this embodiment includes: a ray emitting unit 1001, a hit point determining unit 1002, a hit point changing unit 1003, and a key point determining unit 1004.

[0197] The ray emitting unit 1001 is used to obtain position information corresponding to a starting point and an ending point, and emit a first ray from the starting point to the ending point, wherein the starting point and the ending point are any two points in the game scene, and the position information at least includes a height value representing the point in the game scene in the game scene.

[0198] The hit point determination unit 1002 is used to determine a first hit point of the first ray in response to the first ray failing to reach the end point due to colliding with an obstacle in the game scene, and obtain position information corresponding to the first hit point, wherein the first hit point is used to represent a point in the game scene corresponding to a collision position of the first ray with the obstacle.

[0199] The hitting point changing unit 1003 is used to adjust a first preset height based on the height value of the position information corresponding to the first hitting point to form a first changed hitting point corresponding to the first hitting point.

[0200] The key point determination unit 1004 is used to determine the first changed hit point as a key point of the path finding path.

[0201] Optionally, also used for:

[0202] In response to the first ray reaching the end point, pathfinding is terminated, and a pathfinding path is formed by the start point and the end point.

[0203] Optionally, the device further comprises: a starting point resetting unit;

[0204] The starting point resetting unit is used to use the first changed hit point as a new starting point and repeat path finding until the first ray reaches the end point, and the path finding path is composed of the starting point, the key point, and the end point.

[0205] Optionally, the device further comprises: a second ray sending unit;

[0206] The second ray sending unit is used to, before the step of determining the first changed hit point as the key point of the path finding path: emit a second ray from the starting point to the first changed hit point, and determine whether the second ray fails to reach the first changed hit point due to colliding with an obstacle.

[0207] The step of determining the first changed hit point as a key point of the path finding path includes:

[0208] In response to the second ray reaching the first changed hit point due to not colliding with the obstacle, the first changed hit point is determined as a key point of the path finding path.

[0209] Optionally, the second ray sending unit is further used to:

[0210] In response to the second ray not reaching the first changed hit point due to collision with the obstacle, determining a second hit point of the second ray, and acquiring position information corresponding to the second hit point, the second hit point being used to represent a point in the game scene corresponding to a collision position of the second ray with the obstacle;

[0211] Adjusting the first preset height based on the height value of the position information corresponding to the second hit point to form a second changed hit point corresponding to the second hit point;

[0212] emitting the second ray from the starting point to the second changed hit point, and determining whether the second ray fails to reach the second changed hit point due to collision with an obstacle;

[0213] In response to the second ray reaching the second changed hit point due to not colliding with the obstacle, the second changed hit point is determined as a key point of the path finding path.

[0214] Optionally, the starting point resetting unit is also used to use the second changed hit point as a new starting point and repeat the pathfinding until the first ray reaches the end point, and the pathfinding path is composed of the starting point, the key point, and the end point.

[0215] Optionally, the device further comprises: a path-finding mode switching unit;

[0216] The path-finding mode switching unit is used to, before the step of determining the first changed hit point as a key point of the path-finding path: determine, based on the position information corresponding to the first changed hit point, whether the height value corresponding to the first changed hit point is greater than a second preset height;

[0217] The step of determining the first changed hit point as a key point of the path finding path includes:

[0218] In response to the fact that the height value corresponding to the first changed hit point is less than or equal to the second preset height, the first changed hit point is determined as a key point of the path finding path.

[0219] Optionally, the path-finding mode switching unit is further used to:

[0220] In response to the height value corresponding to the first changed hit point being greater than the second preset height, changing the height value corresponding to the first changed hit point to the second preset height to form a first height changed hit point corresponding to the first changed hit point;

[0221] The first height change hit point is determined as the key point of the path finding path.

[0222] Optionally, the path-finding mode switching unit is further used to:

[0223] According to the position information corresponding to the end point, determining whether the height value corresponding to the end point is greater than the second preset height;

[0224] In response to the altitude value corresponding to the termination point being greater than the second preset altitude, a key point between the first altitude change hit point and the termination point is determined based on a pre-generated flight path finding graph.

[0225] Optionally, the path-finding mode switching unit is further used to:

[0226] In response to the height value corresponding to the end point being less than or equal to the second preset height, emitting a third ray from the end point to the first height change hit point or the start point;

[0227] Determine a third hit point of the third ray, and obtain position information corresponding to the third hit point, wherein the third hit point is used to represent a point in the game scene corresponding to a collision position of the third ray with an obstacle;

[0228] Adding the first preset height to the height value of the position information corresponding to the third hit point to form a third changed hit point corresponding to the third hit point;

[0229] According to the position information corresponding to the third changed hit point, determining whether the height value corresponding to the third changed hit point is greater than the second preset height;

[0230] In response to the height value corresponding to the third changed hit point being less than or equal to the second preset height, the third changed hit point is determined as a key point of the path finding path.

[0231] Optionally, the path-finding mode switching unit is further used to:

[0232] In response to the height value corresponding to the third changed hit point being greater than the second preset height, the height value corresponding to the third changed hit point is changed to the second preset height to form a third height changed hit point corresponding to the third changed hit point;

[0233] Determine the third height change hit point as a key point of the path finding path;

[0234] Based on the flight path finding graph, determine the key points between the first altitude change hit point and the third altitude change hit point.

[0235] Optionally, the device further comprises: a flight path-finding map generating unit;

[0236] The flight path-finding graph generating unit is used for:

[0237] Obtaining a two-dimensional pathfinding map pre-constructed for the game scene, the two-dimensional pathfinding map comprising a plurality of pathfinding points, the pathfinding points at least recording a height value of a point on the ground representing the game scene in the game scene;

[0238] Traversing each pathfinding point of the two-dimensional pathfinding graph;

[0239] In response to the altitude value corresponding to the wayfinding point being greater than the second preset altitude, marking the wayfinding point as an unreachable area;

[0240] In response to the altitude value corresponding to the wayfinding point being less than or equal to the second preset altitude, changing the altitude value corresponding to the wayfinding point to the second preset altitude;

[0241] Generate the flight pathfinding graph corresponding to the two-dimensional pathfinding graph.

[0242] Optionally, the device further comprises: a virtual flying object control unit;

[0243] The virtual flying object control unit is used to control the virtual flying object in the game scene to fly from the starting point to the ending point along the key points of the path finding path.

[0244] A third embodiment of the present application provides an electronic device, Fig.11 It is a schematic diagram of the structure of the electronic device provided in this embodiment.

[0245] like Fig.11 As shown, the electronic device provided in this embodiment includes: a memory 1101 and a processor 1102;

[0246] The memory 1101 is used to store computer instructions for executing the path-finding method in the game;

[0247] The processor 1102 is configured to execute computer instructions stored in the memory 1101 to perform the following operations:

[0248] Acquire position information corresponding to a starting point and an ending point, and emit a first ray from the starting point to the ending point, wherein the starting point and the ending point are any two points in the game scene, and the position information at least includes a height value representing the point in the game scene in the game scene;

[0249] In response to the first ray not reaching the end point due to collision with an obstacle in the game scene, determining a first hit point of the first ray, and acquiring position information corresponding to the first hit point, wherein the first hit point is used to represent a point in the game scene corresponding to a collision position of the first ray with the obstacle;

[0250] Adjusting a first preset height based on the height value of the position information corresponding to the first hit point to form a first changed hit point corresponding to the first hit point;

[0251] The first changed hit point is determined as a key point of the path finding path.

[0252] Optionally, also execute:

[0253] In response to the first ray reaching the end point, pathfinding is terminated, and a pathfinding path is formed by the start point and the end point.

[0254] Optionally, also execute:

[0255] The first changed hit point is used as a new starting point, and path finding is repeated until the first ray reaches the end point, and the starting point, the key point, and the end point constitute a path finding path.

[0256] Optionally, before the step of determining the first changed hit point as a key point of the pathfinding path, the following steps are further performed:

[0257] emitting a second ray from the starting point to the first changed hit point, and determining whether the second ray fails to reach the first changed hit point due to collision with an obstacle;

[0258] The step of determining the first changed hit point as a key point of the path finding path includes:

[0259] In response to the second ray reaching the first changed hit point due to not colliding with the obstacle, the first changed hit point is determined as a key point of the path finding path.

[0260] Optionally, also execute:

[0261] In response to the second ray not reaching the first changed hit point due to collision with the obstacle, determining a second hit point of the second ray, and acquiring position information corresponding to the second hit point, the second hit point being used to represent a point in the game scene corresponding to a collision position of the second ray with the obstacle;

[0262] Adjusting the first preset height based on the height value of the position information corresponding to the second hit point to form a second changed hit point corresponding to the second hit point;

[0263] emitting the second ray from the starting point to the second changed hit point, and determining whether the second ray fails to reach the second changed hit point due to collision with an obstacle;

[0264] In response to the second ray reaching the second changed hit point due to not colliding with the obstacle, the second changed hit point is determined as a key point of the path finding path.

[0265] Optionally, also execute:

[0266] The second changed hit point is used as a new starting point, and path finding is repeated until the first ray reaches the end point, and the path finding path is composed of the starting point, the key point, and the end point.

[0267] Optionally, before the step of determining the first changed hit point as a key point of the pathfinding path, the following steps are further performed:

[0268] Determining, based on the position information corresponding to the first changed hit point, whether the height value corresponding to the first changed hit point is greater than a second preset height;

[0269] The step of determining the first changed hit point as a key point of the path finding path includes:

[0270] In response to the fact that the height value corresponding to the first changed hit point is less than or equal to the second preset height, the first changed hit point is determined as a key point of the path finding path.

[0271] Optionally, also execute:

[0272] In response to the height value corresponding to the first changed hit point being greater than the second preset height, changing the height value corresponding to the first changed hit point to the second preset height to form a first height changed hit point corresponding to the first changed hit point;

[0273] The first height change hit point is determined as the key point of the path finding path.

[0274] Optionally, also execute:

[0275] According to the position information corresponding to the end point, determining whether the height value corresponding to the end point is greater than the second preset height;

[0276] In response to the altitude value corresponding to the termination point being greater than the second preset altitude, a key point between the first altitude change hit point and the termination point is determined based on a pre-generated flight path finding graph.

[0277] Optionally, also execute:

[0278] In response to the height value corresponding to the end point being less than or equal to the second preset height, emitting a third ray from the end point to the first height change hit point or the start point;

[0279] Determine a third hit point of the third ray, and obtain position information corresponding to the third hit point, wherein the third hit point is used to represent a point in the game scene corresponding to a collision position of the third ray with an obstacle;

[0280] Adding the first preset height to the height value of the position information corresponding to the third hit point to form a third changed hit point corresponding to the third hit point;

[0281] According to the position information corresponding to the third changed hit point, determining whether the height value corresponding to the third changed hit point is greater than the second preset height;

[0282] In response to the height value corresponding to the third changed hit point being less than or equal to the second preset height, the third changed hit point is determined as a key point of the path finding path.

[0283] Optionally, also execute:

[0284] In response to the height value corresponding to the third changed hit point being greater than the second preset height, the height value corresponding to the third changed hit point is changed to the second preset height to form a third height changed hit point corresponding to the third changed hit point;

[0285] Determine the third height change hit point as a key point of the path finding path;

[0286] Based on the flight path finding graph, determine the key points between the first altitude change hit point and the third altitude change hit point.

[0287] Optionally, also execute:

[0288] Obtaining a two-dimensional pathfinding map pre-constructed for the game scene, the two-dimensional pathfinding map comprising a plurality of pathfinding points, the pathfinding points at least recording a height value of a point on the ground representing the game scene in the game scene;

[0289] Traversing each pathfinding point of the two-dimensional pathfinding graph;

[0290] In response to the altitude value corresponding to the wayfinding point being greater than the second preset altitude, marking the wayfinding point as an unreachable area;

[0291] In response to the altitude value corresponding to the wayfinding point being less than or equal to the second preset altitude, changing the altitude value corresponding to the wayfinding point to the second preset altitude;

[0292] Generate the flight pathfinding graph corresponding to the two-dimensional pathfinding graph.

[0293] Optionally, also execute:

[0294] The virtual flying object in the game scene is controlled to fly from the starting point to the ending point along the key points of the path finding path.

[0295] A fourth embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium includes computer instructions. When the computer instructions are executed by a processor, they are used to implement the methods described in the embodiments of the present application.

[0296] It should be noted that the relational terms such as "first" and "second" in this article are only used to distinguish one entity or operation from another entity or operation, and do not require or imply any actual relationship or order between these entities or operations. In addition, the words "include", "have", "include" and "includes" and other similar forms are the same in meaning, and the end of any one or more items after any of the above words is open-ended, and any of the above nouns does not mean that the one or more items have been exhaustively listed or are limited to the one or more items listed.

[0297] As used herein, unless expressly stated otherwise, the term "or" includes all possible combinations, except those that are not feasible. For example, if it is expressed that a database may include A or B, then unless otherwise specifically stated or not feasible, it may include database A, or B, or A and B. As a second example, if it is expressed that a database may include A, B, or C, then unless otherwise specifically stated or not feasible, the database may include database A, or B, or C, or A and B, or A and C, or B and C, or A, B, and C.

[0298] It is worth noting that the above embodiments can be implemented by hardware or software (program code), or a combination of hardware and software. If implemented by software, it can be stored in the above-mentioned computer-readable medium. When the software is executed by a processor, it can execute the above-mentioned disclosed method. The computing unit and other functional units described in the present disclosure can be implemented by hardware or software, or a combination of hardware and software. Those of ordinary skill in the art will also understand that the above-mentioned multiple modules / units can be combined into one module / unit, and each of the above-mentioned modules / units can be further divided into multiple sub-modules / sub-units.

[0299] In the above detailed description, the embodiments have been described with reference to many specific details, which may vary from implementation to implementation. Certain adaptations and modifications may be made to the embodiments. For those skilled in the art, other embodiments may be readily apparent from the specific embodiments disclosed in the present application. This specification and examples are for exemplary purposes only, and the true scope and essence of the present application are described by the claims. The sequence of steps shown in the diagrams is also for the purpose of explanation only and is not intended to be limited to any particular steps or sequence. Therefore, those skilled in the art will appreciate that these steps may be performed in different orders when implementing the same method.

[0300] In the drawings and detailed description of the present application, exemplary embodiments are disclosed. However, many variations and modifications may be made to these embodiments. Accordingly, although specific terms are used, these terms are only general and descriptive and not for the purpose of limitation.

Claims

1. A path-finding method in a game, characterized in that: The method comprises: Acquire position information corresponding to a starting point and an ending point, and emit a first ray from the starting point to the ending point, wherein the starting point and the ending point are any two points in the game scene, and the position information at least includes a height value representing the point in the game scene in the game scene; In response to the first ray not reaching the end point due to collision with an obstacle in the game scene, determining a first hit point of the first ray, and acquiring position information corresponding to the first hit point, wherein the first hit point is used to represent a point in the game scene corresponding to a collision position of the first ray with the obstacle; Adjusting a first preset height based on the height value of the position information corresponding to the first hit point to form a first changed hit point corresponding to the first hit point; The first changed hit point is determined as a key point of the path finding path.

2. The method according to claim 1, characterized in that The method further comprises: In response to the first ray reaching the end point, pathfinding is terminated, and a pathfinding path is formed by the start point and the end point.

3. The method according to claim 1, characterized in that The method further comprises: The first changed hit point is used as a new starting point, and path finding is repeated until the first ray reaches the end point, and the starting point, the key point, and the end point constitute a path finding path.

4. The method according to claim 1, characterized in that: Before the step of determining the first changed hit point as a key point of the path finding path, the method further includes: emitting a second ray from the starting point to the first changed hit point, and determining whether the second ray fails to reach the first changed hit point due to collision with an obstacle; The step of determining the first changed hit point as a key point of the path finding path includes: In response to the second ray reaching the first changed hit point due to not colliding with the obstacle, the first changed hit point is determined as a key point of the path finding path.

5. The method according to claim 4, characterized in that The method further comprises: In response to the second ray not reaching the first changed hit point due to collision with the obstacle, determining a second hit point of the second ray, and acquiring position information corresponding to the second hit point, the second hit point being used to represent a point in the game scene corresponding to a collision position of the second ray with the obstacle; Adjusting the first preset height based on the height value of the position information corresponding to the second hit point to form a second changed hit point corresponding to the second hit point; emitting the second ray from the starting point to the second changed hit point, and determining whether the second ray fails to reach the second changed hit point due to collision with an obstacle; In response to the second ray reaching the second changed hit point due to not colliding with the obstacle, the second changed hit point is determined as a key point of the path finding path.

6. The method according to claim 5, characterized in that The method further comprises: The second changed hit point is used as a new starting point, and path finding is repeated until the first ray reaches the end point, and the path finding path is composed of the starting point, the key point, and the end point.

7. The method according to claim 1, characterized in that Before the step of determining the first changed hit point as a key point of the path finding path, the method further includes: Determining, based on the position information corresponding to the first changed hit point, whether the height value corresponding to the first changed hit point is greater than a second preset height; The step of determining the first changed hit point as a key point of the path finding path includes: In response to the fact that the height value corresponding to the first changed hit point is less than or equal to the second preset height, the first changed hit point is determined as a key point of the path finding path.

8. The method according to claim 7, characterized in that The method further comprises: In response to the height value corresponding to the first changed hit point being greater than the second preset height, changing the height value corresponding to the first changed hit point to the second preset height to form a first height changed hit point corresponding to the first changed hit point; The first height change hit point is determined as the key point of the path finding path.

9. The method according to claim 8, characterized in that The method further comprises: According to the position information corresponding to the end point, determining whether the height value corresponding to the end point is greater than the second preset height; In response to the altitude value corresponding to the termination point being greater than the second preset altitude, a key point between the first altitude change hit point and the termination point is determined based on a pre-generated flight path finding graph.

10. The method according to claim 9, characterized in that The method further comprises: In response to the height value corresponding to the end point being less than or equal to the second preset height, emitting a third ray from the end point to the first height change hit point or the start point; Determine a third hit point of the third ray, and obtain position information corresponding to the third hit point, wherein the third hit point is used to represent a point in the game scene corresponding to a collision position of the third ray with an obstacle; Adding the first preset height to the height value of the position information corresponding to the third hit point to form a third changed hit point corresponding to the third hit point; According to the position information corresponding to the third changed hit point, determining whether the height value corresponding to the third changed hit point is greater than the second preset height; In response to the height value corresponding to the third changed hit point being less than or equal to the second preset height, the third changed hit point is determined as a key point of the path finding path.

11. The method according to claim 10, characterized in that The method further comprises: In response to the height value corresponding to the third changed hit point being greater than the second preset height, the height value corresponding to the third changed hit point is changed to the second preset height to form a third height changed hit point corresponding to the third changed hit point; Determine the third height change hit point as a key point of the path finding path; Based on the flight path finding graph, determine the key points between the first altitude change hit point and the third altitude change hit point.

12. The method according to claim 7, characterized in that The method further comprises: Obtaining a two-dimensional pathfinding map pre-constructed for the game scene, the two-dimensional pathfinding map comprising a plurality of pathfinding points, the pathfinding points at least recording a height value of a point on the ground representing the game scene in the game scene; Traversing each pathfinding point of the two-dimensional pathfinding graph; In response to the altitude value corresponding to the wayfinding point being greater than the second preset altitude, marking the wayfinding point as an unreachable area; In response to the altitude value corresponding to the wayfinding point being less than or equal to the second preset altitude, changing the altitude value corresponding to the wayfinding point to the second preset altitude; Generate the flight pathfinding graph corresponding to the two-dimensional pathfinding graph.

13. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: The virtual flying object in the game scene is controlled to fly from the starting point to the ending point along the key points of the path finding path.

14. A path-finding device in a game, characterized in that: The device comprises: a ray emitting unit, a hitting point determining unit, a hitting point changing unit, and a key point determining unit; The ray emitting unit is used to obtain position information corresponding to a starting point and an ending point, and emit a first ray from the starting point to the ending point, wherein the starting point and the ending point are any two points in the game scene, and the position information at least includes a height value representing the point in the game scene in the game scene; The hit point determination unit is used to determine a first hit point of the first ray in response to the first ray not reaching the end point due to collision with an obstacle in the game scene, and obtain position information corresponding to the first hit point, wherein the first hit point is used to represent a point in the game scene corresponding to a collision position of the first ray with the obstacle; The hitting point changing unit is used to adjust a first preset height based on the height value of the position information corresponding to the first hitting point to form a first changed hitting point corresponding to the first hitting point; The key point determination unit is used to determine the first changed hit point as a key point of the path finding path.

15. An electronic device, characterized in that: include: Memory, processor; The memory is used to store one or more computer instructions; The processor is used to execute the one or more computer instructions to implement the method according to any one of claims 1-13.

16. A computer-readable storage medium having one or more computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the method according to any one of claims 1 to 13 is performed.

Citation Information

Patent Citations

  • Planning method and device of 3D scene vertical space flight path

    CN107970610A

  • Method and device for path finding of non-player character, storage medium and computer device

    CN112044074A

  • Way-finding control method and device for game, processing equipment and storage medium

    CN113101663A

  • Fast path finding method, device and equipment based on bounding box and medium

    CN115845381A

  • Pathfinding Method, Device for a Game Object, and Computer-Readable Storage Medium

    US20220370909A1