Pathfinding method, device and electronic device in a game

By firing rays into the game scene to determine the collision point of obstacles and adjusting the altitude to form key points, the problem of flexibility and realism in the automatic navigation of flying objects is solved, resulting in a more realistic gaming experience and faster pathfinding speed.

CN119633387BActive Publication Date: 2026-02-27NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411912008.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2026-02-27
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

In existing technologies, the automatic navigation of flying objects in games lacks flexibility, and the paths do not conform to the trajectories of real flying objects, resulting in problems such as large data volume and high memory consumption.

Method used

By emitting rays in the game scene, collision points of obstacles are determined and their heights are adjusted to form key points, thus creating a pathfinding path. This avoids pre-set paths and determines key points based on physical rays, which conforms to the flight trajectory of real flying objects.

Benefits of technology

It achieves a flight path that more closely resembles the trajectory of real flying objects without increasing data volume and memory consumption, thus improving the gaming experience and pathfinding speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119633387B_ABST
    Figure CN119633387B_ABST
Patent Text Reader

Abstract

The application discloses a path searching method and device in a game, electronic equipment and a computer readable storage medium. The method comprises the following steps: acquiring position information corresponding to a starting point and a terminal point, and emitting a first ray from the starting point to the terminal point, wherein the position information at least comprises a height value of a point in a game scene in the game scene; in response to the first ray not reaching the terminal point, determining a first shooting point of the first ray, and acquiring position information corresponding to the first shooting point, wherein the first shooting point is used for representing a point in the game scene corresponding to a collision position of the first ray and an obstacle; adjusting a first preset height on the height value of the position information corresponding to the first shooting point to form a first changed shooting point corresponding to the first shooting point; and determining the first changed shooting point as a key point of a path searching path. The method solves the technical problems of poor flexibility, non-compliance with the flight trajectory of a real flying object, large data volume and large memory consumption 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 technical field of computer, in particular to a path finding method and device in a game, an electronic device and a computer readable storage medium. BACKGROUND

[0002] The flying object is a common prop in a virtual game. In the game, in addition to flying by relying on the player's control, the function of automatic navigation flight is often involved.

[0003] Currently, the automatic navigation flight of the flying object in the game is realized by two ways of pre-determined trajectory and path finding map. For the pre-determined trajectory scheme, the path trajectory is pre-set, and the arbitrary point-to-point flight cannot be realized, lacking flexibility. For the path finding map scheme, the two-dimensional path finding map is generated according to the terrain of the game scene, so that the path finding path is close to the ground, which does not conform to the flight trajectory of the real flying object, and will bring the player an unreal game experience. The three-dimensional path finding map is relatively 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 which 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 with less increasing the data volume and memory consumption, so as to solve the technical problems of poor flexibility, not conforming to the flight trajectory of the real flying object, large data volume and large memory consumption existing in the prior art. SUMMARY

[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 poor flexibility, not conforming to the flight trajectory of the real flying object, large data volume and large memory consumption existing in the prior art.

[0006] In a first aspect, the embodiments of the present application provide a path finding method in a game, the method comprising: acquiring position information corresponding to a starting point and a terminal point, and emitting a first ray from the starting point to the terminal point, the starting point and the terminal point being any two points in a game scene, and the position information comprising at least a height value representing a point in the game scene; in response to the first ray not reaching the terminal point due to collision with an obstacle in the game scene, determining a first intersection point of the first ray, and acquiring position information corresponding to the first intersection point, the first intersection point representing a point in the game scene corresponding to the collision position of the first ray and the obstacle; adjusting a first preset height on the height value of the position information corresponding to the first intersection point to form a first changed intersection point corresponding to the first intersection point; and determining the first changed intersection point as a key point of a path finding path.

[0007] In a second aspect, the embodiments of the present application provide a pathfinding device in a game, the device comprising: a ray emitting unit, a hit point determining unit, a hit point changing unit, and a key point determining unit; the ray emitting unit is configured to obtain position information corresponding to a starting point and a terminal point, and emit a first ray from the starting point to the terminal point, the starting point and the terminal point being any two points in a game scene, and the position information comprising at least a height value of a point in the game scene; the hit point determining unit is configured to determine a first hit point of the first ray in response to the first ray failing to reach the terminal point due to collision with an obstacle in the game scene, and obtain position information corresponding to the first hit point, the first hit point being used to represent a point in the game scene corresponding to a collision position of the first ray and the obstacle; the hit point changing unit is configured 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; and the key point determining unit is configured to determine the first changed hit point as a key point of a pathfinding path.

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

[0009] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, having one or more computer instructions stored thereon, which, when executed by a processor, performs the above method.

[0010] Compared with the prior art, the path finding method in the game provided by the application comprises: acquiring position information corresponding to a starting point and a terminal point, and emitting a first ray from the starting point to the terminal point, the starting point and the terminal point being any two points in a game scene, and the position information comprising at least a height value of a point in the game scene; in response to the first ray failing to reach the terminal point due to collision with an obstacle in the game scene, determining a first intersection point of the first ray, and acquiring position information corresponding to the first intersection point, the first intersection point being used to represent a point in the game scene corresponding to a collision position of the first ray and the obstacle; adjusting a first preset height on the height value of the position information corresponding to the first intersection point to form a first changed intersection point corresponding to the first intersection point; and determining the first changed intersection point as a key point of a path finding path. First, the method does not involve pre-setting a path trajectory, and the starting point and the terminal point can be any two points in the game scene, so that the automatic navigation flight of the flying object in the game scene is more flexible; second, the method is not based on a two-dimensional path finding map, there is no case that the flight path is close to the ground, and the method determines the key point in the path finding path based on a physical ray, which is more consistent with the perception of the player's autonomous control, in addition, the key point determined based on the method presents a high-low change trend, which is more consistent 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 point in the path finding path based on the existing physical ray of the game system, and will not increase additional game data, and compared with the path finding scheme based on the three-dimensional path finding map, the memory occupation and consumption of determining the key point based on the physical ray are smaller, and the path finding speed is faster. In summary, the path finding method in the game provided by the application is a path finding method that can make the flight path of the flying object in the automatic navigation flight closer to the flight trajectory of the real flying object without increasing or with less increasing data amount and memory consumption, and solves the technical problems of poor flexibility, inconsistency with the flight trajectory of the real flying object, large data amount, and large memory consumption existing in the prior art. BRIEF DESCRIPTION OF DRAWINGS

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

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

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

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

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

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

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

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

[0019] Figure 9 is a flowchart of generating a flight path finding map provided by the first embodiment of the present application;

[0020] Figure 10 is a structural schematic diagram of a game path finding device provided by the second embodiment of the present application;

[0021] Figure 11 is a structural schematic diagram of an electronic device provided by the third embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following description, a lot of specific details are set forth in order to facilitate a thorough understanding of the present application. However, the present application can be practiced in many different ways beyond the specific details disclosed herein, and similar modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and therefore the present application is not limited to 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, and the focus of game developers is not only the richness of game plots and gameplay, but also the experience brought to players and the memory consumption of the game to the terminal device. More realistic game experience and lower memory consumption are the goals that game developers constantly pursue.

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

[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 player's set end point from the player's set starting point according to a certain method and path. In the game, reasonable planning of this method and path is conducive to improving the game experience of players.

[0026] Currently, the automatic navigation flight of the flying object in the game is realized in the following two ways. One is a pre-determined trajectory scheme. Specifically, the game developer sets a path from a starting point to an ending point in the game development stage, and the flying object automatically navigates along the set path in the game. The other is a pathfinding graph pathfinding scheme. Specifically, a two-dimensional or three-dimensional pathfinding graph is generated in advance in a game editor. The pathfinding graph generally contains a plurality of key points and connection relationships between the key points. In the game, according to the pathfinding graph, the key points that need to be passed through from the starting point to the ending point are found based on a shortest path planning algorithm, so that the flying object automatically navigates through the key points one by one. Figure 1 For the pre-determined trajectory scheme, since the path trajectory is pre-set, the flying object cannot fly from an arbitrary point to another point, which makes the automatic navigation flight of the flying object in the game lack flexibility. For the pathfinding graph pathfinding scheme, first, since the two-dimensional pathfinding graph is generated according to the terrain of the game scene, the pathfinding path obtained based on the two-dimensional pathfinding graph is close to the ground, which does not conform to the flight trajectory of the real flying object and brings an unrealistic game experience to the player. Second, since the three-dimensional pathfinding graph itself is relatively complex and includes too many key points and connection information, the game data volume is multiplied, which undoubtedly increases the memory consumption of the terminal device in the application process.

[0027] Therefore, the existing automatic navigation flight of the flying object in the game has the technical problems of poor flexibility, non-conformity to the real flight trajectory, large data volume, and large memory consumption.

[0028] Therefore, the existing automatic navigation flight of the flying object in the game has the technical problems of poor flexibility, non-conformity to the real flight trajectory, large data volume, and large memory consumption.

[0029] The game pathfinding method, device, electronic equipment, and computer readable storage medium provided in the present application can make the automatic navigation flight path of the flying object closer to the flight trajectory of the real flying object without increasing or with less increasing data volume and memory consumption. First, the method does not involve pre-setting the path trajectory, and the starting point and the ending point can be any two points in the game scene, which makes 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 graph, and the flight path is not close to the ground. The method determines the key points in the pathfinding path based on physical rays, which is more consistent with the perception of the player's autonomous control. In addition, the key points determined based on the method show a high-low change trend, which is more consistent 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, without increasing additional game data. Compared with the pathfinding scheme based on the three-dimensional pathfinding graph, the memory occupation and consumption of determining the key points based on the physical rays are smaller, and the pathfinding speed is faster.

[0030] The game pathfinding method, device, electronic equipment, and computer readable storage medium provided in the present application can make the automatic navigation flight path of the flying object closer to the flight trajectory of the real flying object without increasing or with less increasing data volume and memory consumption. First, the method does not involve pre-setting the path trajectory, and the starting point and the ending point can be any two points in the game scene, which makes 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 graph, and the flight path is not close to the ground. The method determines the key points in the pathfinding path based on physical rays, which is more consistent with the perception of the player's autonomous control. In addition, the key points determined based on the method show a high-low change trend, which is more consistent 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, without increasing additional game data. Compared with the pathfinding scheme based on the three-dimensional pathfinding graph, the memory occupation and consumption of determining the key points based on the physical rays are smaller, and the pathfinding speed is faster.Figure 1 is an application system diagram of a path finding method in a game provided by an embodiment of the present application. As shown in Figure 1 (a), the system includes a user terminal 101 and a server 102. The user terminal 101 can be any device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant (PDA), etc. The server 102 can be a processing device electrically connected to the user terminal 101, or a server communicatively connected to a plurality of user terminals 101. The server 102 is deployed with the path finding method in a game provided by the present application, which can obtain a path that is more consistent with the flight trajectory of a real flying object based on the method after receiving a flight instruction issued by a player based on the user terminal 101. As shown in Figure 1 (b), the system includes a user terminal 103, which can be any device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant (PDA), etc. The path finding method in a game provided by the present application is deployed on the user terminal 103, which can obtain a path that is more consistent with the flight trajectory of a real flying object based on the method, thereby realizing automatic navigation flight of the flying object.

[0031] The first embodiment of the present application provides a path finding method in a game, which is deployed in Figure 2 the server 102 or the user terminal 103, for supporting automatic navigation flight of a virtual flying object in a game.

[0032] The automatic navigation flight can be understood as a process in which a virtual flying object automatically finds a path to fly from a specified starting point to a specified ending point. Of course, the user can also specify only the ending point, and take the current position of the virtual flying object as the starting point to perform automatic path finding flight.

[0033] In an optional implementation manner, the path finding method in a game provided by the present 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 player operations, such as a trigger operation of an automatic navigation flight control by the player, a selection operation of a starting point and an ending point by the player, etc. After receiving the automatic navigation flight instruction sent by the user terminal 101, the server 102 performs the method provided by the present embodiment to find key points for the virtual flying object to fly automatically according to the key points.

[0034] Figure 2 is a flowchart of the path finding method in a game provided by the present embodiment. The following will be described in combination with Figure 2The path searching method in the game provided in the embodiment will be described in detail. The embodiments described below are used to explain the technical solutions of the present application and are not used to limit the actual use.

[0035] As shown in Figure 3 The path searching method in the game provided in the embodiment includes the following steps S210 to S240:

[0036] In step S210, the position information corresponding to the starting point and the ending point is acquired, and a first ray is emitted 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 height of the point in the game scene.

[0037] The starting point in the embodiment can include a user-specified original starting point or a new starting point determined after the path searching operation. The ending point in the embodiment is a user-specified original ending point. In the embodiment, the point-to-point path trajectory is not preset in advance, and therefore, the user-specified original starting point and ending point can be any point in the game scene, and the new starting point determined after the path searching operation can also be any point in the game scene.

[0038] The position information can be understood as the coordinates of the point in the game scene in the game scene coordinate system. The game scene coordinate system can take the plane where the lowest terrain in the game scene is located as the XZ plane, and take 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 of the projection point of the point in the game scene on the XZ plane, and the Y-axis coordinate value of the point in the game scene. For example, the X-axis coordinate value of the projection point B of point A on the XZ plane is a, the Z-axis coordinate value is c, and the Y-axis coordinate value of point A is b. Therefore, the position information of point A is (a, b, c). Since the Y axis is perpendicular to the XZ plane, and the XZ plane is the plane where the lowest terrain in the game scene is located, the Y-axis coordinate value of 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 the embodiment, the position information at least includes the height value representing the height of the point in the game scene, and of course, it also includes the position value representing the position of the point in the game scene relative to the plane where the lowest terrain is located.

[0039] The ray is a self-owned tool in the game engine, which can be understood as a straight line extending infinitely in a direction from a point. In the game, the emission behavior of the ray can be controlled by calling the ray function interface provided by the game engine and specifying the emission starting point, ending point, direction, length, etc. of the ray. In the embodiment, the ray emitted from the starting point to the ending point is defined as the first ray.

[0040] In response to the first ray failing to reach the terminal point due to collision with the obstacle in the game scene, a first shooting point of the first ray is determined, and position information corresponding to the first shooting point is obtained, the first shooting point being used to represent a point in the game scene corresponding to the collision position of the first ray and the obstacle.

[0041] There are two results when the first ray is emitted from the starting point to the terminal point: one is that the first ray reaches the terminal point, and the other is that the first ray fails to reach the terminal point. It can be understood that when there is an obstacle between the starting point and the terminal point and the obstacle can block the first ray, the first ray cannot reach the terminal point; when there is no obstacle between the starting point and the terminal point, or there is an obstacle but the obstacle cannot block the first ray, the first ray can reach the terminal point. This is consistent with the flight principle of a real flying object. When there is an obstacle blocking the flight of the real flying object, the real flying object cannot directly reach the terminal point; when there is no obstacle or the obstacle is not sufficient to block the flight of the real flying object, the real flying object can directly reach the terminal point. Therefore, determining the path key point of the virtual flying object based on ray checking is more consistent with the flight principle of the real flying object.

[0042] In this embodiment, in the case that the first ray fails to reach the terminal point due to collision with the 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 pathfinding path.

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

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

[0045] In step S230, the first preset height is adjusted on the height value of the position information corresponding to the first shooting point, to form a first changed shooting point corresponding to the first shooting point.

[0046] It can be understood that when the obstacle blocks the flight of the real flying object, the real flying object will gradually increase the flight height, and fly above the obstacle. Or in some special cases, it will also gradually reduce the flight height, and fly below the obstacle. In the method provided in the embodiment, the flight principle of the real flying object is simulated, and the first hit point is raised or lowered to increase or decrease the flight height of the virtual flying object in the game scene.

[0047] Specifically, a first preset height is set, and the height value of the position information corresponding to the first hit point is increased or decreased by the first preset height to form new position information. The point corresponding to the new position information is higher or lower than the first hit point, which is defined as the first changed hit point in the embodiment. Specifically, whether the height value of the position information corresponding to the first hit point is increased by the first preset height or decreased by the first preset height can be adjusted according to the specific game setting, or automatically adjusted according to the position and volume ratio of the obstacle in the game scene during the game, and the specific implementation is not limited. In the subsequent examples, the first hit point is increased by the first preset height. For example, the first hit point K corresponds to the position information (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 height value b of the position information (a, b, c) corresponding to the first hit point K is added by the first preset height d, and the new position information (a, b+d, c) is formed. 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 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 set as the first preset height. It can be understood that if the first preset height is set too low, the number of loop cycles of path finding will be increased, the number of key points in the flight path will be increased, and the calculation amount and memory consumption will be increased. If the first preset height is set too high, the virtual flying object will be raised or lowered to an unnecessary height to fly, which will affect the authenticity of the flight path. Therefore, in actual application, the appropriate first preset height can be determined through multiple debugging.

[0049] In step S240, the first changed hit point is determined as a key point of the path finding path.

[0050] Once the first changed impact point is determined, it can be designated as a key point in the pathfinding path. Specifically, by adding the first changed impact point to the starting point, a pathfinding path is formed that includes at least the starting point and the first updated impact point, allowing the virtual flying object to fly from the starting point to the first changed impact point along the pathfinding path.

[0051] In this embodiment, after determining the first changed impact point as the key point of the pathfinding path, the method provided in this embodiment may further include: using the first changed impact point as a new starting point, repeating the pathfinding until the first ray reaches the termination point. That is, the pathfinding method provided in this embodiment is a cyclical iterative process. After determining a key point, it will be used as a new starting point, and the search for the next key point will continue based on the above steps S210 to S240 until the first ray reaches the termination point, ending the pathfinding. At this time, the pathfinding path will be composed of the starting point, the key point, and the termination point. In an optional implementation, a maximum number of executions will be set for the above repeated operation to prevent an infinite loop. Optionally, if the number of repeated operations has reached the maximum number of executions and the first ray still cannot reach the termination point, the pathfinding operation will be determined to have failed.

[0052] In this embodiment, if the first ray reaches the termination point, the pathfinding will end directly, and the starting point and the termination point will form a path, allowing the virtual flying object to fly directly from the starting point to the termination point along the path. Based on this, the method provided in this embodiment may further include the following steps S11 to S12:

[0053] Step S11: In response to the first ray reaching the termination point, the pathfinding ends.

[0054] Step S12: The pathfinding path is formed by the starting point and the ending point.

[0055] The following examples illustrate the pathfinding method provided in this embodiment. Figure 3 This is a schematic diagram of a pathfinding method in a game provided in this embodiment.

[0056] like Figure 4 As shown, the player's preset starting point is point A in the game scene, and the ending point is point B in the game scene. An obstacle 30 exists between points A and B. The pathfinding method provided in this embodiment can include the following steps:

[0057] Step S301: Obtain the position information corresponding to point A and point B, and fire 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, take point C, which is the collision point of the first ray 311 and the obstacle 30, as the first impact point and obtain the position information corresponding to point C.

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

[0059] Step S303, take the point C' as a new starting point, obtain the position information corresponding to the point C', and emit the first ray 312 from the point C' to the point B. Since the first ray 312 collides with the obstacle 30 and cannot reach the point B, take the point D corresponding to the collision position of the first ray 312 and the obstacle 30 as the first shooting point, and obtain the position information corresponding to the point D.

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

[0061] Step S305, take the point D' as a new starting point, obtain the position information corresponding to the point D', and emit the first ray 313 from the point D' to the point B. Since the first ray 313 collides with the obstacle 30 and cannot reach the point B, take the point E corresponding to the collision position of the first ray 313 and the obstacle 30 as the first shooting point, and obtain the position information corresponding to the point E.

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

[0063] Step S307, take the point E' as a new starting point, obtain the position information corresponding to the point E', and emit the first ray 314 from the point E' to the point B. Since the first ray 314 collides with the obstacle 30 and cannot reach the point B, take the point F corresponding to the collision position of the first ray 314 and the obstacle 30 as the first shooting point, and obtain the position information corresponding to the point F.

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

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

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

[0067] Since the first changed shooting point is a point formed by raising the first shooting point by the first preset height, the first ray can reach the first shooting point from the starting point. However, there is still a special case, that is, there is an obstacle between the starting point and the first changed shooting point. In this case, it is impossible to realize the flight of the virtual flying object from the starting point to the first changed shooting point by still taking the first changed shooting point as the path key point. Based on this, in an optional implementation manner provided in the embodiment, before the step of determining the first changed shooting point as the key point of the path finding path, it is further needed to further verify whether there is an obstacle that can block the flight of the virtual flying object between the starting point and the first changed shooting point based on the ray checking. Specifically, a ray is emitted from the starting point to the first changed shooting point, and it is judged whether the ray can reach the first changed shooting point. In the embodiment, the ray emitted from the starting point to the changed shooting point is defined as a second ray. Further, when the second ray can reach the first changed shooting point, the first changed shooting point can be determined as the key point. When the second ray cannot reach the first changed shooting point due to collision with the obstacle, the first changed shooting point cannot be the key point. Based on this, the first changed shooting point is determined as the key point of the path finding path, which can specifically include: in response to the second ray reaching the first changed shooting point without colliding with the obstacle, the first changed shooting point is determined as the key point of the path finding path.

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

[0069] Step S21, in response to the second ray not reaching the first changed shooting point due to collision with the obstacle, a second shooting point of the second ray is determined, and the position information corresponding to the second shooting point is obtained. The second shooting point is used to represent a 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 on the height value of the position information corresponding to the second shooting point to form a second changed shooting point corresponding to the second shooting point.

[0071] Step S23, a second ray is emitted from the start point to the second changed hitting point, and it is determined whether the second ray reaches the second changed hitting point due to collision with the obstacle.

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

[0073] In this embodiment, for the case that the second ray does not reach the first changed hitting point, subsequent operations are performed based on the collision position of the second ray and the obstacle to find the corresponding key point again.

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

[0075] In this embodiment, after the second hitting point is determined, the position information corresponding to the second hitting point needs to be obtained. The position information of the point in the game scene is known, so after the second hitting point is determined, the position information corresponding to the second hitting point can be directly obtained. Then, a new position information is formed by increasing or decreasing the first preset height from the height value of the position information corresponding to the second hitting point. The point corresponding to the new position information is higher or lower than the second hitting point, and in this embodiment, the point corresponding to the new position information is defined as the second changed hitting point. Alternatively, the second changed hitting point corresponding to the second hitting point is formed by increasing the first preset height from the height value of the position information corresponding to the second hitting point. For example, the position information corresponding to the second hitting point P is (a, b, c), where b is the height value corresponding to the second hitting point P, and the first preset height is d. By adding the first preset height d to the height value b of the position information (a, b, c) corresponding to the second hitting point P, a new position information (a, b+d, c) is formed. The point corresponding to the new position information (a, b+d, c) is the second changed hitting point Q corresponding to the second hitting point P. In the game scene, the second changed hitting point Q is higher than the second hitting point P.

[0076] After the second changed hitting point is determined, it also needs to be determined whether there is an obstacle blocking the flight of the virtual flying object between the start point and the second changed hitting point. Therefore, a second ray is emitted from the start point to the second changed hitting point, and it is determined whether the second ray reaches the second changed hitting point. Further, when the second ray can reach the second changed hitting point, the second changed hitting point is determined as the key point of the pathfinding path, and when the second ray cannot reach the second changed hitting point, the second changed hitting point cannot be the key point.

[0077] In the embodiment, for the case that the second ray can reach the second changed shooting point, after the second changed shooting point is determined as the key point of the pathfinding path, the pathfinding is repeated with the second changed shooting point as the new starting point until the first ray reaches the termination point, forming the pathfinding path composed of the starting point, the key point and the termination point. For the case that the second ray cannot reach the second changed shooting point, steps S21 to S23 are repeated until the second ray-reachable second changed shooting point is found. In an optional implementation, a maximum number of executions is set for the above repeated operation to prevent a dead loop, and optionally, when the number of repeated operations has reached the maximum number of executions and the second ray-reachable second changed shooting point is still not found, it is determined that the current pathfinding operation fails.

[0078] The pathfinding method provided by the embodiment is exemplified below with specific examples. Figure 4 is a schematic diagram of another game pathfinding method provided by the embodiment.

[0079] As shown in Figure 5 , the starting point preset by the player is A point in the game scene, and the termination point is B point in the game scene. There is an obstacle 40 between A point and B point. The pathfinding based on the game pathfinding method provided by the embodiment can include the following steps:

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

[0081] Step S402: Add a first preset height L to the height value of the position information corresponding to C point to form C' point, which is the first changed shooting point corresponding to the first shooting point.

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

[0083] Step S404: Add a first preset height L to the height value of the position information corresponding to D point to form D' point, which is the second changed shooting point corresponding to the second shooting point.

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

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

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

[0087] Step S408, the E' point is taken as a new starting point, the position information corresponding to the E' point is acquired, and the first ray 412 is emitted from the E' point to the B point. Since the first ray 412 collides with the obstacle 40 and cannot reach the B point, the F point corresponding to the collision position of the first ray 412 and the obstacle 40 is taken as the first shooting point, and the position information corresponding to the F point is acquired.

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

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

[0090] Step S411, the F' point is taken as a new starting point, the position information corresponding to the F' point is acquired, and the first ray 413 is emitted from the F' point to the B point. Since the first ray 413 collides with the obstacle 40 and cannot reach the B point, the G point corresponding to the collision position of the first ray 413 and the obstacle 40 is taken as the first shooting point, and the position information corresponding to the G point is acquired.

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

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

[0093] Step S414, taking G' point as a new starting point, obtaining the position information corresponding to G' point, and emitting a first ray 414 from G' point to B point. Since the first ray 414 collides with the obstacle 40 and cannot reach B point, taking H point corresponding to the collision position of the first ray 414 and the obstacle 40 as a first shooting midpoint, and obtaining the position information corresponding to H point.

[0094] Step S415, adding a first preset height L to the height value of the position information corresponding to H point to form H' point, and H' point is a first changed shooting midpoint corresponding to the first shooting midpoint.

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

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

[0097] Through the above steps, the pathfinding path from the starting point (A point) to the terminal point (B point) is generated, and the virtual flying object starts from A point along the pathfinding path, passes through E' point, F' point, G' point, and H' point in sequence, and reaches B point.

[0098] In some game scenes with large terrain undulations, the virtual flying object may be raised to a height that is too high, which does not conform to the real experience of the player. In view of this situation, in an optional implementation manner, the pathfinding method provided in this embodiment further includes switching the pathfinding scheme. Specifically, in the process of pathfinding by 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, higher than a preset height), the current pathfinding scheme can be switched to a pathfinding graph pathfinding scheme to realize detouring for the area that is too high, and such a flight path is more consistent with the flight trajectory of a real flying object.

[0099] Based on this, in an optional implementation manner, before the step of determining the first changed shooting midpoint as a key point of the pathfinding path, the method provided in this embodiment can further include: judging whether the height value corresponding to the first changed shooting midpoint is greater than a second preset height according to the position information corresponding to the first changed shooting midpoint. Further, whether the pathfinding scheme needs to be switched is determined based on the judgment result.

[0100] The second preset height is an adjustable value, which can be understood as a maximum height allowing the virtual flying object to fly, which can be set by a developer or a player. The developer can set the maximum height according to the terrain of a specific game scene, and the player can set the maximum height according to his / her own game preference, which is not limited in this embodiment.

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

[0102] In this embodiment, when the height value corresponding to the first changed shooting point exceeds the maximum height allowing the virtual flying object to fly (the second preset height), the virtual flying object cannot fly to the height of the first changed shooting point, so the first changed shooting point cannot be a key point of the pathfinding path. This embodiment provides a solution for the case where the height value corresponding to the first changed shooting point exceeds the maximum height allowing the virtual flying object to fly (the second preset height). In an optional implementation, the method provided by this embodiment can further include the following steps S31 to S32:

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

[0104] Step S32: the first height changed shooting point is determined as a key point of the pathfinding path.

[0105] When the height value corresponding to the first changed shooting point is greater than the second preset height, the height value of the position information corresponding to the first changed shooting point can be replaced by the second preset height to form new position information. The point corresponding to the new position information is lower than the first changed shooting point, which is defined as the first height changed shooting point in this embodiment. For example, the position information corresponding to the first changed shooting point M is (a, b, c), where b is the height value corresponding to the first changed shooting 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 shooting point M is replaced by 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 shooting point N corresponding to the first changed shooting point M. In a game scene, the first height changed shooting point N is lower than the first changed shooting point M.

[0106] Since the height value corresponding to the first height change shooting point is the second preset height, which is the height allowing the virtual flying object to fly, the first height change shooting point can be used to replace the first change shooting point as the key point of the pathfinding path, so that the virtual flying object can fly to the first height change shooting point.

[0107] In this embodiment, the first height change shooting point is determined, that is, the highest point on the side of the starting point allowing the virtual flying object to fly is determined, and after further determining the highest point on the side of the termination point allowing the virtual flying object to fly, the area requiring switching of the pathfinding scheme of the pathfinding map can be determined.

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

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

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

[0111] After the highest point on the side of the starting point allowing the virtual flying object to fly (that is, the first height change shooting point) is determined, if the height of the termination point itself has exceeded the maximum height allowing the virtual flying object to fly (that is, the second preset height), the area between the first height change shooting point and the termination point is an area requiring switching of the pathfinding scheme of the pathfinding map. Therefore, the key points between the first height change shooting point and the termination point are determined based on the pathfinding map. It should be noted that the pathfinding map in this embodiment is a two-dimensional pathfinding map, and is a pre-generated flight pathfinding map based on a traditional two-dimensional pathfinding map, so as to ensure that the flight path does not approach the ground and does 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 termination point is greater than the second preset height, the path key points between the first height change shooting point and the termination point are determined based on the flight pathfinding map. The pathfinding method based on the pathfinding map is relatively common, such as A* algorithm, Dijkstra algorithm, JPS (Jump Point Search) algorithm, etc., and the specific pathfinding method based on the pathfinding map is not limited and will not be described in detail herein.

[0113] The pathfinding method provided by the embodiment will be illustrated by a specific example. Figure 5 is a schematic diagram of another pathfinding method in a game provided by the embodiment.

[0114] As Figure 6As shown, the starting point preset by the player is A point in the game scene, and the ending point is B point in the game scene. There is an obstacle 50 between A point and B point. The path finding based on the path finding method in the game provided in this embodiment can include the following steps:

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

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

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

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

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

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

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

[0122] In an optional implementation, when it is judged that the height value corresponding to the termination point is not greater than the second preset height, the pathfinding map is not necessarily performed on all regions between the first height changed shooting point and the termination point, but the highest point on the side of the termination point allowed to be flown by the virtual flying object is determined, and the pathfinding map is performed between the two highest points. Based on this, the method provided by the embodiment can further include the following steps S51 to S58.

[0123] Step S51, in response to the height value corresponding to the termination point being less than or equal to the second preset height, a third shooting ray is emitted from the termination point to the first height changed shooting point or the starting point.

[0124] Step S52, a third shooting point of the third shooting ray is determined, and position information corresponding to the third shooting point is obtained, the third shooting point being used to represent a point in the game scene corresponding to the collision position of the third shooting ray and the obstacle.

[0125] Step S53, the first preset height is adjusted on the height value of the position information corresponding to the third shooting point to form a third height changed shooting point corresponding to the third shooting point.

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

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

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

[0129] Step S57, the third height changed shooting point is determined as a key point of the pathfinding path.

[0130] Step S58, based on the flight pathfinding map, key points between the first height changed shooting point and the third height changed shooting point are determined.

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

[0132] The third ray is emitted from the termination point to the starting point or the first height change impact point, and the point in the game scene corresponding to the collision position of the third ray and the obstacle is the impact point corresponding to the third ray. In this embodiment, the impact point corresponding to the third ray is defined as a third impact point. The position information corresponding to the third impact point is obtained, the first preset height is added to the height value of the position information corresponding to the third impact point, and a new position information is formed. The point corresponding to the new position information is higher than the third impact point, and in this embodiment, the point corresponding to the new position information is defined as a third change impact point.

[0133] After the third change impact point is determined, it needs to be judged whether the height value corresponding to the third change impact point is greater than the second preset height. If the height value corresponding to the third change impact point is not greater than the second preset height, it indicates that the third change impact point is a point where the virtual flying object can fly to, and the third change impact point can be determined as a key point of the pathfinding path. Further, the third change impact point is taken as a new termination point, and the pathfinding is repeated until a third change impact point with a height value greater than the second preset height is found. If the height value corresponding to the third change impact point is greater than the second preset height, it indicates that the third change impact point is a point where the virtual flying object cannot fly to, and the height value corresponding to the third change impact point can be reduced. Specifically, the height value corresponding to the third change impact point is replaced by the second preset height to form a new position information. The point corresponding to the new position information is lower than the third change impact point, and in this embodiment, the point corresponding to the new position information is defined as a third height change impact point. The third height change impact point is the highest point on the side of the termination point, and the point is determined as a key point of the pathfinding path. At this time, the highest point on the side of the starting point (i.e., the first height change impact point) and the highest point on the side of the termination point (i.e., the third height change impact point) are found, and then the pathfinding path can be found between the first height change impact point and the third height change impact point.

[0134] It should be noted that the above process can also be understood as interchanging the termination point and the starting point, and continuing to perform the process of emitting the first ray from the starting point to the termination point and the subsequent operation steps.

[0135] The following illustrates the path finding method provided by the embodiment with a specific example. Figure 6 FIG. 6 is a schematic diagram of another path finding method in a game provided by the embodiment.

[0136] As shown in FIG. 6, 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. The path finding based on the path finding method in a game provided by the embodiment can include the following steps. Figure 7 Step S601: A first ray 611 is emitted from point A to point B. Since the first ray 611 collides with the obstacle 60 and cannot reach point B, a point C corresponding to the collision position of the first ray 611 and the obstacle 60 is taken as a first shooting point.

[0137] Step S602: A first preset height L1 is added to the height value corresponding to point C to form a point C', which is a first changed shooting point corresponding to the first shooting point. Since the height value corresponding to point C' is less than a second preset height L2, point C' is determined as a key point of the path finding path.

[0138] Step S603: Point C' is taken as a new starting point, and a first ray 612 is emitted from point C' to point B. Since the first ray 612 collides with the obstacle 60 and cannot reach point B, a point D corresponding to the collision position of the first ray 612 and the obstacle 60 is taken as a first shooting point.

[0139] Step S604: A first preset height L1 is added to the height value corresponding to point D to form a point D', which is a first changed shooting point corresponding to the first shooting point. Since the height value corresponding to point D' is less than the second preset height L2, point D' is determined as a key point of the path finding path.

[0140] Step S605: Point D' is taken as a new starting point, and a first ray 613 is emitted from point D' to point B. Since the first ray 613 collides with the obstacle 60 and cannot reach point B, a point E corresponding to the collision position of the first ray 613 and the obstacle 60 is taken as a first shooting point.

[0141] Step S606: A first preset height L1 is added to the height value corresponding to point E to form a point E', which is a first changed shooting point corresponding to the first shooting 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 a point E'', which is a first height changed shooting point corresponding to the first changed shooting point, i.e., the highest point on the starting point side. Point E'' is determined as a key point of the path finding path.

[0142]

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

[0144] Step S608: emitting a third ray 631 from the point B to the point E", since the third ray 631 collides with the obstacle 60 and cannot reach the point E", taking a point F corresponding to the collision position of the third ray 631 with the obstacle 60 as a third shooting point.

[0145] Step S609: adding the first preset height L1 to the height value corresponding to the point F to form a point F', the point F' being a third changed shooting point corresponding to the third shooting point. Since the height value corresponding to the point F' is less than the second preset height L2, the point F' is determined as a key point of the pathfinding path.

[0146] Step S610: taking the point F' as a new termination point, emitting a third ray 632 from the point F' to the point E", since the third ray 632 collides with the obstacle 60 and cannot reach the point E", taking a point G corresponding to the collision position of the third ray 632 with the obstacle 60 as a third shooting point.

[0147] Step S611: adding the first preset height L1 to the height value corresponding to the point G to form a point G', the point G' being a third changed shooting point corresponding to the third shooting point. Since the height value corresponding to the point G' is greater than the second preset height L2, the second preset height L2 is used to replace the height value corresponding to the point G' to form a point G", the point G" being a first height changed shooting point corresponding to the first changed shooting point, i.e., the highest point on the termination point side. The point G" is determined as a key point of the pathfinding path.

[0148] Step S614: determining a key point between the point E" and the point G" based on the flight pathfinding map.

[0149] As described above, in the present embodiment, the flight pathfinding map is switched to pathfind for the region with too high terrain, and based on this, in an optional implementation manner, the method provided by the present embodiment can further include the following steps S61 to S65:

[0150] Step S61: acquiring a pre-constructed two-dimensional pathfinding map for the game scene, the two-dimensional pathfinding map including a plurality of pathfinding points, the pathfinding points recording at least height values of points on the ground of the game scene in the game scene.

[0151] Step S62: traversing each pathfinding point of the two-dimensional pathfinding map.

[0152] Step S63: in response to the height value corresponding to the pathfinding point being greater than the second preset height, marking the pathfinding point as an unreachable region.

[0153] In step S64, in response to the height value corresponding to the waypoint being less than or equal to the second preset height, the height value corresponding to the waypoint is changed to the second preset height.

[0154] In step S65, a flight waypoint map corresponding to the two-dimensional waypoint map is generated.

[0155] The two-dimensional waypoint map can be understood as an information map recording position information of points on the ground, which is generated based on the terrain of the game scene, and the position information at least includes a height value representing the height of the point on the ground. Each waypoint on the two-dimensional waypoint map corresponds to a point on the ground of the game scene, which is usually a key point representing the change of the terrain of the game scene.

[0156] In this embodiment, the flight waypoint map is generated based on the pre-constructed two-dimensional waypoint map. Specifically, the height value corresponding to each waypoint of the two-dimensional waypoint map is determined. When the height value is greater than the second preset height, it indicates that the waypoint is a point that the virtual flying object cannot fly to, and the waypoint can be marked as unreachable. When the height value is not greater than the second preset height, it indicates that the waypoint is a point that the virtual flying object can fly to. In order to avoid the virtual flying object flying close to the ground at the waypoint, in this embodiment, the height value corresponding to the waypoint is replaced by the second preset height, so that the virtual flying object flies at the second preset height at the waypoint. It can be understood that the flight path is searched based on the flight waypoint map between the first height change shooting point and the third height change shooting point, and the height values corresponding to the first height change shooting point and the third height change shooting point are both the second preset height. Therefore, replacing the height value corresponding to the waypoint with the second preset height can ensure that the flight height of the virtual flying object between the first height change shooting point and the third height change shooting point is consistent, which is more consistent with the flight trajectory of the real flying object when encountering a high obstacle.

[0157] After each waypoint of the two-dimensional waypoint map is traversed based on the above method, the flight waypoint map corresponding to the two-dimensional waypoint map can be generated. The height value corresponding to each waypoint in the flight waypoint map is the second preset height, except for the points marked as unreachable.

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

[0159] The following are several optional implementation manners of the waypoint searching method in the game provided in this embodiment.

[0160] Figure 7 is a flowchart of a pathfinding method in a game provided by the embodiment.

[0161] As shown in Figure 8 , the pathfinding method provided by the embodiment can include the following steps S701 to S709:

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

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

[0164] Step S703, determine whether the ray can reach the ending point.

[0165] Step S704, in response to the ray reaching the ending point, generate a pathfinding path and return.

[0166] Step S705, in response to the ray not reaching the ending point, increase 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, emit a ray from the starting point to the changed hit point.

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

[0169] Step S708, in response to the ray not reaching the changed hit point, return to step S705.

[0170] Step S709, in response to the ray reaching the changed hit point, determine the changed hit point as a key point of the pathfinding path and return to step S701 as a new starting point.

[0171] Figure 8 is a flowchart of another pathfinding method in a game provided by the embodiment.

[0172] As shown in Figure 9 , the pathfinding method provided by the embodiment can include the following steps S801 to S811:

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

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

[0175] Step S803, determine whether the ray can reach the ending point.

[0176] Step S804, in response to the ray reaching the ending point, generate a pathfinding path and return.

[0177] Step S805, in response to the ray unreachable termination 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 hit point exceeds a second preset height.

[0179] Step S807, in response to the height value corresponding to the changed hit point not exceeding the second preset height, determining the changed hit point as a key point of the pathfinding path and as a new starting point, and returning to step S801.

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

[0181] Step S809, in response to the height value corresponding to the termination point having exceeded the second preset height, switching the pathfinding graph pathfinding.

[0182] Step S810, adding the key point determined based on the pathfinding graph to the pathfinding path and returning.

[0183] Step S811, in response to the height value corresponding to the termination point not exceeding the second preset height, exchanging the starting point and the termination point, and returning to step S801.

[0184] Figure 9 is a flowchart of generating a flight pathfinding graph provided by the embodiment.

[0185] As shown in Figure 10 , the flight pathfinding graph generation method provided by the embodiment can include the following steps S901 to S907:

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

[0187] Step S902, determining whether the height value corresponding to the pathfinding point exceeds a second preset height.

[0188] Step S903, in response to the height value corresponding to the pathfinding point having exceeded the second preset height, marking the pathfinding point as unreachable.

[0189] Step S904, in response to the height value corresponding to the pathfinding point not exceeding the second preset height, updating the height value corresponding to the pathfinding point using the second preset height.

[0190] Step S905, determining whether the pathfinding point has been completely traversed.

[0191] Step S906, in response to the pathfinding point not being completely traversed, jumping to the next pathfinding point and returning to step S901.

[0192] Step S907: In response to the fact that all waypoints have been traversed, generate the flight wayfinding map corresponding to the wayfinding map.

[0193] The first embodiment described above provides an optional pathfinding method in a game. This method enables the automatic navigation of flying objects to more closely resemble the flight trajectory of real flying objects without increasing or minimizing data volume and memory consumption. First, this method does not involve pre-setting the path trajectory; the starting and ending points can be any two points in the game scene, making the automatic navigation of flying objects in the game scene more flexible. Second, this method is not based on a two-dimensional pathfinding map, so there is no situation where the flight path is close to the ground. Furthermore, this method determines 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 by this method show a trend of elevation change, which is more consistent with the flight trajectory of real flying objects, providing players with a realistic gaming experience. Third, this method determines key points in the pathfinding path based on the existing physical rays in the game system, without increasing additional game data. Compared with pathfinding schemes based on three-dimensional pathfinding maps, determining key points based on physical rays has less memory usage and consumption, and faster pathfinding speed.

[0194] It should be noted that the examples in the first embodiment are only for explaining the methods described in this application and are not intended to limit actual use. The pathfinding methods in the game provided by this application include, but are not limited to, the methods described in the first embodiment.

[0195] The second embodiment of this application provides a pathfinding device in a game. Figure 10 This is a schematic diagram of the pathfinding device in the game provided in this embodiment.

[0196] like Figure 11 As shown, the pathfinding device in the game provided in this embodiment includes: a ray emission unit 1001, a hit point determination unit 1002, a hit point modification unit 1003, and a key point determination unit 1004.

[0197] The ray emitting unit 1001 is used to acquire position information corresponding to the starting point and the ending point, and to 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 includes at least the height value of the point in the game scene.

[0198] The impact point determination unit 1002 is used to determine the first impact point of the first ray in response to the first ray failing to reach the termination point due to collision with an obstacle in the game scene, and to obtain the position information corresponding to the first impact point. The first impact point is used to characterize the point in the game scene corresponding to the collision position of the first ray with the obstacle.

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

[0200] The key point determination unit 1004 is configured to determine the first changed hitting point as a key point of a pathfinding path.

[0201] Optionally, the device further comprises:

[0202] In response to the first ray reaching the termination point, ending pathfinding, and forming a pathfinding path composed of the starting point and the termination point.

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

[0204] The starting point resetting unit is configured to repeat pathfinding with the first changed hitting point as a new starting point until the first ray reaches the termination point, and form a pathfinding path composed of the starting point, the key point, and the termination point.

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

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

[0207] The step of determining the first changed hitting point as a key point of a pathfinding path comprises:

[0208] In response to the second ray reaching the first changed hitting point due to not colliding with the obstacle, determining the first changed hitting point as a key point of a pathfinding path.

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

[0210] In response to the second ray failing to reach the first changed hitting point due to collision with the obstacle, determining a second hitting point of the second ray, and obtaining position information corresponding to the second hitting point, the second hitting point being used to represent a point in the game scene corresponding to a collision position of the second ray and the obstacle.

[0211] Adjusting the first preset height on a height value of position information corresponding to the second hitting point, so as to form a second changed hitting point corresponding to the second hitting point.

[0212] firing the second ray from the starting point to the second changed shooting point, judging whether the second ray fails to reach the second changed shooting point due to collision with an obstacle;

[0213] in response to the second ray reaching the second changed shooting point due to not colliding with the obstacle, determining the second changed shooting point as a key point of the pathfinding path.

[0214] Optionally, the starting point resetting unit is further configured to repeat pathfinding with the second changed shooting point as a new starting point until the first ray reaches the ending point, so as to form the pathfinding path with the starting point, the key point, and the ending point.

[0215] Optionally, the device further comprises a pathfinding mode switching unit.

[0216] The pathfinding mode switching unit is configured to, before the step of determining the first changed shooting point as a key point of the pathfinding path, judge, according to position information corresponding to the first changed shooting point, whether a height value corresponding to the first changed shooting point is greater than a second preset height.

[0217] The determining the first changed shooting point as a key point of the pathfinding path comprises:

[0218] in response to the height value corresponding to the first changed shooting point being less than or equal to the second preset height, determining the first changed shooting point as a key point of the pathfinding path.

[0219] Optionally, the pathfinding mode switching unit is further configured to:

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

[0221] determining the first height changed shooting point as a key point of the pathfinding path.

[0222] Optionally, the pathfinding mode switching unit is further configured to:

[0223] judging, according to position information corresponding to the ending point, whether a height value corresponding to the ending point is greater than the second preset height;

[0224] in response to the height value corresponding to the ending point being greater than the second preset height, determining a key point between the first height changed shooting point and the ending point based on a pre-generated flight pathfinding map.

[0225] Optionally, the pathfinding mode switching unit is further configured to:

[0226] in response to the height value corresponding to the termination point being less than or equal to the second preset height, emitting a third ray from the termination point to the first height change meeting point or the starting point;

[0227] determining a third meeting point of the third ray, and obtaining position information corresponding to the third meeting point, the third meeting point being used to represent a point in the game scene corresponding to a collision position of the third ray and the obstacle;

[0228] increasing the first preset height on a height value of the position information corresponding to the third meeting point to form a third height change meeting point corresponding to the third meeting point;

[0229] determining, according to the position information corresponding to the third height change meeting point, whether a height value corresponding to the third height change meeting point is greater than the second preset height;

[0230] in response to the height value corresponding to the third height change meeting point being less than or equal to the second preset height, determining the third height change meeting point as a key point of the pathfinding path.

[0231] Optionally, the pathfinding mode switching unit is further configured to:

[0232] in response to the height value corresponding to the third height change meeting point being greater than the second preset height, changing the height value corresponding to the third height change meeting point to the second preset height to form a third height change meeting point corresponding to the third height change meeting point;

[0233] determining the third height change meeting point as a key point of the pathfinding path;

[0234] determining a key point between the first height change meeting point and the third height change meeting point based on the flight pathfinding map.

[0235] Optionally, the device further comprises a flight pathfinding map generation unit.

[0236] The flight pathfinding map generation unit is configured to:

[0237] obtain 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 recording at least height values of points on the ground of the game scene in the game scene;

[0238] traversing each pathfinding point of the two-dimensional pathfinding map;

[0239] in response to a height value corresponding to the pathfinding point being greater than the second preset height, marking the pathfinding point as an unreachable area;

[0240] In response to the height value corresponding to the waypoint being less than or equal to the second preset height, the height value corresponding to the waypoint is changed to the second preset height.

[0241] The flight waypoint map corresponding to the two-dimensional waypoint map is generated.

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

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

[0244] The third embodiment of the present application provides an electronic device, Figure 11 is a structural schematic diagram of the electronic device provided by the embodiment.

[0245] As shown in ​ The electronic device provided by the embodiment includes a memory 1101 and a processor 1102.

[0246] The memory 1101 is configured to store computer instructions for performing a waypoint finding method in a game.

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

[0248] 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 a game scene, and the position information at least includes a height value of a point in the game scene.

[0249] In response to the first ray not reaching the ending point due to collision with an obstacle in the game scene, determine a first intersection point of the first ray, and obtain position information corresponding to the first intersection point, wherein the first intersection point is used to represent a point in the game scene corresponding to the collision position of the first ray and the obstacle.

[0250] Adjust a first preset height on the height value of the position information corresponding to the first intersection point to form a first changed intersection point corresponding to the first intersection point.

[0251] The first changed intersection point is determined as a key point of a waypoint path.

[0252] Optionally, the following operations are further performed:

[0253] In response to the first ray reaching the ending point, the waypoint finding is ended, and the waypoint path is constituted by the starting point and the ending point.

[0254] Optionally, the following steps are further performed:

[0255] repeating the pathfinding with the first changed shooting point as a new starting point 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.

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

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

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

[0259] in response to the second ray reaching the first changed shooting point without colliding with the obstacle, determining the first changed shooting point as a key point of the pathfinding path.

[0260] Optionally, the following steps are further performed:

[0261] in response to the second ray failing to reach the first changed shooting point due to collision with the obstacle, determining a second shooting point of the second ray, and obtaining position information corresponding to the second shooting point, the second shooting point being used to represent a point in the game scene corresponding to a collision position of the second ray and the obstacle;

[0262] adjusting the first preset height by a height value of the position information corresponding to the second shooting point to form a second changed shooting point corresponding to the second shooting point;

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

[0264] in response to the second ray reaching the second changed shooting point without colliding with the obstacle, determining the second changed shooting point as a key point of the pathfinding path.

[0265] Optionally, the following steps are further performed:

[0266] repeating the pathfinding with the second changed shooting point as a new starting point 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.

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

[0268] determining, according to the position information corresponding to the first changed shooting point, whether a height value corresponding to the first changed shooting point is greater than a second preset height;

[0269] The first changed shooting point is determined as a key point of the pathfinding path.

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

[0271] Optionally, the following is further performed:

[0272] In response to the height value corresponding to the first changed shooting point being greater than the second preset height, the height value corresponding to the first changed shooting point is changed to the second preset height, forming a first height changed shooting point corresponding to the first changed shooting point.

[0273] The first height changed shooting point is determined as a key point of the pathfinding path.

[0274] Optionally, the following is further performed:

[0275] According to the position information corresponding to the termination point, it is determined whether a height value corresponding to the termination point is greater than the second preset height.

[0276] In response to the height value corresponding to the termination point being greater than the second preset height, a key point between the first height changed shooting point and the termination point is determined based on a pre-generated flight pathfinding map.

[0277] Optionally, the following is further performed:

[0278] In response to the height value corresponding to the termination point being less than or equal to the second preset height, a third ray is emitted from the termination point to the first height changed shooting point or the starting point.

[0279] A third shooting point of the third ray is determined, and position information corresponding to the third shooting point is obtained, the third shooting point being used to represent a point in the game scene corresponding to a collision position of the third ray and an obstacle.

[0280] The first preset height is added to a height value of the position information corresponding to the third shooting point, forming a third changed shooting point corresponding to the third shooting point.

[0281] According to the position information corresponding to the third changed shooting point, it is determined whether a height value corresponding to the third changed shooting point is greater than the second preset height.

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

[0283] Optionally, the following is further performed:

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

[0285] The third height changed shooting point is determined as a key point of the pathfinding path.

[0286] Based on the flight pathfinding map, a key point between the first height changed shooting point and the third height changed shooting point is determined.

[0287] Optionally, the following is further performed:

[0288] A two-dimensional pathfinding map pre-constructed for the game scene is obtained, the two-dimensional pathfinding map including a plurality of pathfinding points, the pathfinding points recording at least height values of points on the ground of the game scene in the game scene;

[0289] Each pathfinding point of the two-dimensional pathfinding map is traversed;

[0290] In response to the height value corresponding to the pathfinding point being greater than the second preset height, the pathfinding point is marked as an unreachable area;

[0291] In response to the height value corresponding to the pathfinding point being less than or equal to the second preset height, the height value corresponding to the pathfinding point is changed to the second preset height;

[0292] The flight pathfinding map corresponding to the two-dimensional pathfinding map is generated.

[0293] Optionally, the following is further performed:

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

[0295] A computer readable storage medium is provided in a fourth embodiment of the present application, the computer readable storage medium including computer instructions, the computer instructions being used to implement the method described in the embodiments of the present application when executed by a processor.

[0296] It is to be noted that the terms "first", "second", and the like in this text are used only to distinguish one entity or action from another, do not require or imply any actual relationship or sequence between these entities or actions. In addition, "include", "have", "contain", and "comprise" and other similar forms of words are the same in meaning, and the end of any one or more items after any one of the above words is open, and any one of the above nouns does not mean that the one or more items have been listed exhaustively or are limited to these listed one or more items.

[0297] As used herein, the term "or" includes all possible combinations of the items linked by the term, unless otherwise explicitly stated. For example, if a database is expressed as possibly including A or B, unless otherwise specifically stated or not possible, the database can include A, or B, or A and B. The second example, if expressed as a database can include A, B or C, unless otherwise specifically stated or not possible, the database can include A, or B, or C, or A and B, or A and C, or B and C, or A and B and C.

[0298] It is worth noting that the above embodiments can be realized by hardware or software (program code), or a combination of hardware and software. If realized by software, it can be stored in the above computer readable medium. The software, when executed by the processor, can perform the above disclosed method. The computing units and other functional units described in the disclosure can be realized by hardware or software, or a combination of hardware and software. Those skilled in the art will also understand that the above modules / units can be combined into one module / unit, and each of the above 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 can vary from implementation to implementation. Certain adaptations and modifications of the described embodiments can be made. Other embodiments will become apparent from the disclosure of the specific embodiments disclosed herein. This specification and examples are only for illustrative purposes and the true scope and nature of the application are defined by the claims. The order of the steps shown in the drawings is also for illustrative purposes only and does not mean to be limited to any specific step, order. Therefore, those skilled in the art will realize that these steps can 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 changes and modifications can be made to these embodiments. Accordingly, although specific terms are used, these terms are only general and descriptive, and are not intended to be limiting in purpose.

Claims

1. A pathfinding method in a game, characterized in that, The method includes: 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. The position information includes at least the height value of the point in the game scene. In response to the first ray failing to reach the termination point due to collision with an obstacle in the game scene, a first impact point of the first ray is determined, and the position information corresponding to the first impact point is obtained. The first impact point is used to characterize the point in the game scene corresponding to the collision position of the first ray with the obstacle. Adjust the first preset height based on the height value of the position information corresponding to the first point of impact to form the first changed point of impact corresponding to the first point of impact. The first changed point of impact is determined as the key point of the pathfinding path; Prior to the step of determining the first changed point of impact as a key point in the pathfinding path, the method further includes: A second ray is emitted from the starting point toward the first changed point of impact, and it is determined whether the second ray fails to reach the first changed point of impact due to a collision with an obstacle; The step of determining the first changed point of impact as a key point in the pathfinding path includes: In response to the second ray reaching the first altered impact point without colliding with the obstacle, the first altered impact point is determined as a key point in the pathfinding path.

2. The method according to claim 1, characterized in that, The method further includes: In response to the first ray reaching the termination point, the pathfinding ends, and the pathfinding path is formed by the starting point and the termination point.

3. The method according to claim 1, characterized in that, The method further includes: Using the first changed point of impact as the new starting point, the pathfinding is repeated until the first ray reaches the termination point. The pathfinding path is formed by the starting point, the key point, and the termination point.

4. The method according to claim 3, characterized in that, The method further includes: In response to the second ray failing to reach the first changed impact point due to collision with the obstacle, a second impact point of the second ray is determined, and the position information corresponding to the second impact point is obtained. The second impact point is used to characterize the point in the game scene corresponding to the collision position of the second ray with the obstacle. Adjust the first preset height based on the height value of the position information corresponding to the second impact point to form a second changed impact point corresponding to the second impact point; The second ray is emitted from the starting point toward the second changed point of impact, and it is determined whether the second ray fails to reach the second changed point of impact due to a collision with an obstacle; In response to the second ray reaching the second changed impact point without colliding with the obstacle, the second changed impact point is determined as a key point of the pathfinding path.

5. The method according to claim 4, characterized in that, The method further includes: Using the second changed point of impact as the new starting point, the pathfinding is repeated until the first ray reaches the termination point. The pathfinding path is formed by the starting point, the key point, and the termination point.

6. The method according to claim 1, characterized in that, Prior to the step of determining the first changed point of impact as a key point in the pathfinding path, the method further includes: Based on the location information corresponding to the first changed firing point, determine whether the height value corresponding to the first changed firing point is greater than the second preset height; The step of determining the first changed point of impact as a key point in the pathfinding path includes: In response to the first changed firing point having an altitude value less than or equal to the second preset altitude, the first changed firing point is determined as a key point in the pathfinding path.

7. The method according to claim 6, characterized in that, The method further includes: In response to the fact that the height value corresponding to the first changed firing point is greater than the second preset height, the height value corresponding to the first changed firing point is changed to the second preset height, thus forming a first height changed firing point corresponding to the first changed firing point; The first altitude change point is determined as the key point of the pathfinding path.

8. The method according to claim 7, characterized in that, The method further includes: Based on the location information corresponding to the termination point, determine whether the height value corresponding to the termination 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, the key points between the first altitude change hit point and the termination point are determined based on the pre-generated flight path map.

9. The method according to claim 8, characterized in that, The method further includes: In response to the height value corresponding to the termination point being less than or equal to the second preset height, a third ray is emitted from the termination point to either the first height or the starting point; The third impact point of the third ray is determined, and the position information corresponding to the third impact point is obtained. The third impact point is used to characterize the point in the game scene corresponding to the collision position between the third ray and the obstacle. The first preset height is added to the height value of the position information corresponding to the third point of impact to form the third changed point of impact corresponding to the third point of impact. Based on the position information corresponding to the third changed firing point, determine whether the height value corresponding to the third changed firing point is greater than the second preset height; In response to the fact that the height value corresponding to the third changed firing point is less than or equal to the second preset height, the third changed firing point is determined as a key point of the pathfinding path.

10. The method according to claim 9, characterized in that, The method further includes: In response to the fact that the height value corresponding to the third changed firing point is greater than the second preset height, the height value corresponding to the third changed firing point is changed to the second preset height, thus forming the third height changed firing point corresponding to the third changed firing point; The third altitude change firing point is determined as the key point of the pathfinding path; Based on the flight path map, the key points between the first altitude change firing point and the third altitude change firing point are determined.

11. The method according to claim 6, characterized in that, The method further includes: Obtain a pre-constructed two-dimensional pathfinding map for the game scene. The two-dimensional pathfinding map includes multiple pathfinding points, and each pathfinding point records at least the height value of a point on the ground of the game scene within the game scene. Traverse each pathfinding point in the two-dimensional pathfinding graph; In response to the fact that the height value corresponding to the wayfinding point is greater than the second preset height, the wayfinding point is marked as an unreachable area; In response to the fact that the height value corresponding to the wayfinding point is less than or equal to the second preset height, the height value corresponding to the wayfinding point is changed to the second preset height; Generate the flight path map corresponding to the two-dimensional path map.

12. The method according to any one of claims 1-11, characterized in that, The method further includes: 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 pathfinding path.

13. A pathfinding device in a game, characterized in that, The device includes: a ray emitting unit, a hit point determination unit, a hit point modification unit, and a key point determination unit; The ray emission unit is used to acquire position information corresponding to the starting point and the ending point, and to 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. The position information includes at least the height value of the point in the game scene. The impact point determination unit is used to determine the first impact point of the first ray in response to the first ray failing to reach the termination point due to collision with an obstacle in the game scene, and to obtain the position information corresponding to the first impact point. The first impact point is used to characterize the point in the game scene corresponding to the collision position of the first ray with the obstacle. The firing point changing unit is used to adjust the first preset height based on the height value of the position information corresponding to the first firing point, thereby forming a first changed firing point corresponding to the first firing point; The key point determination unit is used to determine the first changed shooting point as a key point of the pathfinding path. Prior to the step of determining the first changed point of impact as a key point in the pathfinding path, the ray emitting unit is further configured to: A second ray is emitted from the starting point toward the first changed point of impact, and it is determined whether the second ray fails to reach the first changed point of impact due to a collision with an obstacle; The step of determining the first changed point of impact as a key point in the pathfinding path includes: In response to the second ray reaching the first altered impact point without colliding with the obstacle, the first altered impact point is determined as a key point in the pathfinding path.

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

15. A computer-readable storage medium storing one or more computer instructions thereon, characterized in that, When this instruction is executed by the processor, it performs the method as described in any one of claims 1-12.

Citation Information

Patent Citations

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

    CN112044074A

  • Drone control system and intelligent flight plan establishment method therefor

    WO2022255508A1