Route searching method and device, electronic equipment and readable storage medium

By employing the B-Star algorithm and region partitioning method in 3D scenes, aerial target routes are generated, solving the problem of aerial object interaction pathfinding that cannot be achieved by existing aerial pathfinding solutions, and improving pathfinding performance.

CN115920401BActive Publication Date: 2026-02-17BEIJING PIXEL SOFTWARE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211642990.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2026-02-17
Estimated Expiration
2042-12-20

AI Technical Summary

Technical Problem

Existing pathfinding solutions are unable to perform interactive pathfinding for aerial objects in 3D scenes, resulting in insufficient pathfinding performance.

Method used

The B-Star algorithm is used to generate aerial target routes. By dividing the aerial part of the game scene into multiple areas, parallel pathfinding is performed. By combining obstacle information and avoidance strategies, aerial paths are generated quickly.

Benefits of technology

Improved the pathfinding performance of the pathfinding system in 3D scenes, enabling fast pathfinding of aerial objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115920401B_ABST
    Figure CN115920401B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a route searching method and device, electronic equipment and readable storage medium, relating to the technical field of computer. The method comprises: obtaining a route searching task, wherein the route searching task comprises a start point position and an end point position; determining whether the route searching task is an aerial route searching task; when the route searching task is an aerial route searching task, generating a first target route in the air based on the B-star algorithm according to the start point position and the end point position. In this way, the aerial route searching can be quickly completed, and the route searching performance of the route searching system in the 3D scene is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a pathfinding method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] In online games, pathfinding within map environments is paramount, with most gameplay mechanics requiring navigation and pathfinding technology; its importance is self-evident. Compared to pathfinding in 2D scenes, the complexity of pathfinding in 3D scenes increases exponentially. Ensuring the accuracy, stability, responsiveness, and efficient utilization of server performance in 3D scene pathfinding is a crucial design consideration. Current pathfinding solutions generally only work on the ground surface and cannot handle pathfinding between aerial objects. Summary of the Invention

[0003] This application provides a pathfinding method, apparatus, electronic device, and readable storage medium, which can quickly complete aerial pathfinding and improve the pathfinding performance of pathfinding systems in 3D scenes.

[0004] The embodiments of this application can be implemented as follows:

[0005] Firstly, this application provides a pathfinding method, the method comprising:

[0006] Obtain a pathfinding task, wherein the pathfinding task includes a starting position and an ending position;

[0007] Determine whether the pathfinding task is an aerial pathfinding task;

[0008] When the pathfinding task is an aerial pathfinding task, a first target route in the air is generated based on the B-Star algorithm according to the starting position and the ending position.

[0009] Secondly, this application provides a pathfinding device, the device comprising:

[0010] The task acquisition module is used to acquire a pathfinding task, wherein the pathfinding task includes a starting position and an ending position;

[0011] The judgment module is used to determine whether the pathfinding task is an aerial pathfinding task;

[0012] The planning module is used to generate a first target route in the air based on the starting position and the ending position when the pathfinding task is an aerial pathfinding task.

[0013] Thirdly, this application provides an electronic device including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the pathfinding method described in any of the foregoing embodiments.

[0014] Fourthly, this application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the pathfinding method as described in any of the foregoing embodiments.

[0015] The pathfinding method, apparatus, electronic device, and readable storage medium provided in this application, when the obtained pathfinding task is an aerial pathfinding task, generate a first target route in the air based on the B-Star algorithm according to the starting and ending positions in the pathfinding task. This allows for rapid aerial pathfinding and improves the pathfinding performance of pathfinding systems in 3D scenes. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A block diagram illustrating an electronic device provided in an embodiment of this application;

[0018] Figure 2 One of the flowcharts of the pathfinding method provided in the embodiments of this application;

[0019] Figure 3 for Figure 2 A flowchart illustrating the sub-steps included in step S130;

[0020] Figure 4 A second schematic flowchart illustrating the pathfinding method provided in this application embodiment;

[0021] Figure 5 The third schematic flowchart of the pathfinding method provided in the embodiments of this application;

[0022] Figure 6 One of the block diagrams of the pathfinding device provided in the embodiments of this application;

[0023] Figure 7 This is a second block diagram of the pathfinding device provided in the embodiments of this application.

[0024] Icons: 100 - Electronic device; 110 - Memory; 120 - Processor; 130 - Communication unit; 200 - Pathfinding device; 201 - Preprocessing module; 210 - Task acquisition module; 220 - Judgment module; 230 - Planning module. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0026] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0027] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0028] Recast Navigation (RNV) is a powerful pathfinding system solution widely used in major game engines (Unreal, Unity, etc.). Building upon the concept of voxels, RNV further refines it, ultimately using the concept of NavMesh to represent 3D scenes. RNV employs a combination of the A* algorithm and NavMesh to ensure pathfinding reachability within 3D scenes. However, all operations in RNV are based on the ground surface, making it unable to perform pathfinding for aerial object interactions.

[0029] This application provides a pathfinding method, apparatus, electronic device, and readable storage medium, which can quickly complete aerial pathfinding to meet the needs of aerial interaction and improve the pathfinding performance of the pathfinding system in 3D scenes.

[0030] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0031] Please refer to Figure 1 , Figure 1 This is a block diagram of an electronic device 100 provided in an embodiment of this application. The electronic device 100 may be, but is not limited to, a server, etc. The electronic device 100 includes a memory 110, a processor 120, and a communication unit 130. The memory 110, processor 120, and communication unit 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0032] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0033] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the memory 110 stores a pathfinding device 200, which includes at least one software functional module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running the software programs and modules stored in the memory 110, such as the pathfinding device 200 in the embodiments of this application, thereby implementing the pathfinding method in the embodiments of this application.

[0034] The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through the network, and to send and receive data through the network.

[0035] It should be understood that, Figure 1 The structure shown is only a schematic diagram of the electronic device 100. The electronic device 100 may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.

[0036] Please refer to Figure 2 , Figure 2 This is one of the flowcharts illustrating the routing method provided in this application embodiment. The method can be applied to the aforementioned electronic device 100. The specific flow of the routing method is described in detail below. In this embodiment, the method may include steps S110 to S130.

[0037] The step is 110, which leads to the pathfinding quest.

[0038] In this embodiment, the pathfinding task is used to find a path for a target object in the game to reach another location from one location. The specific method of obtaining the pathfinding task is not limited here and can be set according to actual circumstances. The pathfinding task may include a starting location and an ending location.

[0039] Step S120: Determine whether the pathfinding task is an aerial pathfinding task.

[0040] Based on the starting and ending positions, it can be determined whether the pathfinding task is an aerial pathfinding task or a ground pathfinding task (i.e., a surface pathfinding task). The specific determination method can be set according to actual needs. For example, if at least one of the starting and ending positions is in the air, the pathfinding task can be determined to be an aerial pathfinding task; otherwise, it can be determined to be a ground pathfinding task.

[0041] When the pathfinding task is an aerial pathfinding task, step S130 is executed.

[0042] Step S130: Based on the B-star algorithm, generate the first target route in the air according to the starting position and the ending position.

[0043] The B-Star algorithm employs a greedy strategy, searching for the closest position to the destination at each step. Therefore, it can quickly obtain the first target route based on the starting and ending positions. This allows for rapid aerial pathfinding, improving the pathfinding performance of 3D scene navigation systems.

[0044] As one possible implementation method, it can be achieved through Figure 3 The method shown allows for the rapid acquisition of the first target route. Please refer to... Figure 3 , Figure 3 for Figure 2A flowchart illustrating the sub-steps included in step S130. In this embodiment, step S130 may include sub-steps S131 to S132.

[0045] Sub-step S131: Based on the pre-divided altitude range corresponding to each air region, the starting position and the ending position, determine the target air region through which the first target route passes.

[0046] In this embodiment, the aerial portion of the game scene is pre-divided into multiple aerial regions, each with a different height range. For example, 0-9 meters constitutes one aerial region, 9-18 meters constitutes another, and the control area is located above the aerial region with a height range of 0-9 meters, and so on. A waypoint is set between adjacent aerial regions. This waypoint is used for pathfinding; moving from one aerial region to another requires passing through this waypoint.

[0047] The air regions traversed by the first target route can be determined based on the corresponding altitude range of each air region and the starting and ending positions in the pathfinding task, and the determined air regions can be used as target air regions. For example, assuming that 0-9 meters is air region A and 9-18 meters is air region B, if the altitude of the starting position is 3 meters and the altitude of the ending position is 11 meters, then air regions A and B can be determined as the target air regions traversed by the first target route.

[0048] Sub-step S132: For each target air region, the B-Star algorithm is used in parallel to perform pathfinding based on the starting point and ending point of the target air region to obtain the target path segment corresponding to the target space region.

[0049] Once the target airspace region is determined, the B-Star algorithm can be used to perform pathfinding in parallel using multiple threads, each targeting a specific target airspace region, and obtain the target path segments corresponding to each target airspace region. The target paths corresponding to all target airspace regions constitute the first target route, and the overlapping points of the target path segments corresponding to adjacent target airspace regions are the waypoints set between the adjacent target airspace regions. This speeds up pathfinding, allowing for rapid acquisition of the first target route.

[0050] For example, assuming target air regions A and B are determined, one thread can be used to perform pathfinding in target air region A to obtain target path segment 1; simultaneously, another thread can perform pathfinding in target air region B to obtain target path segment 2. Target path segment 1 and target path segment 2 have one endpoint that overlaps; the overlapping position is the waypoint between target air regions A and B. Target path segment 1 and target path segment 2 constitute the first target route. Because pathfinding is performed in parallel, the speed of obtaining the first target route can be accelerated.

[0051] In this context, it can be understood that when navigating within any target air region, the starting and ending points of that target air region can be determined by considering whether it is the location of the starting or ending point, and the waypoints between it and adjacent air regions. For example, continuing the previous example, for target air region A, its starting point is the aforementioned starting point location, and its ending point is the waypoint between target air regions A and B. Similarly, for target air region B, its starting point is the waypoint between target air regions A and B, and its ending point is the aforementioned ending point location. Furthermore, for a target air region that does not include the aforementioned starting and ending points, the starting and ending points of that target control region are the waypoints between that target air region and the two adjacent air regions.

[0052] The starting and ending points corresponding to a target air region are the starting and ending points used when navigating to that target air region.

[0053] To ensure pathfinding accessibility, obstacle information for each aerial region can be pre-determined based on the game scene and the height of each divided aerial region. The obstacle information for an aerial region indicates whether there are obstacles in that region. If obstacles exist, the obstacle information can also include attributes such as the size and position of the obstacles for use during obstacle avoidance.

[0054] When performing pathfinding for any target air region, if it is determined from the obstacle information of the target air region that there are no obstacles between the starting point and the ending point of the target air region, the B-Star algorithm can be used directly to generate the target path segment corresponding to the target air region based on the starting point and the ending point of the target air region.

[0055] The specific method for determining whether there are obstacles between the starting point and the ending point of a target airspace can be set according to actual needs. For example, starting from the starting point and drawing a ray towards the ending point, if the ray intersects with an obstacle, then an obstacle is determined to exist; otherwise, no obstacle is determined to exist.

[0056] If the obstacle information corresponding to the target air area indicates that there are obstacles between the starting point and the ending point of the target air area, determine whether the position of the existing obstacle is fixed and whether there is a traversable area inside the existing obstacle relative to the target object corresponding to the pathfinding task.

[0057] An obstacle in the air is considered to be in a fixed position, meaning it floats in the air and remains relatively stationary compared to the ground surface. The presence of a traversable area within the obstacle relative to the target object in the pathfinding task indicates that the target object can pass through the obstacle. For example, if the obstacle is a space station, the interior space of the space station allows the target object to pass through.

[0058] If the location of an obstacle remains fixed and there is a traversable area within it relative to the target object of the pathfinding task, then the relative ground surface of the obstacle can be determined. In the 3D world, the ground surface refers to the earth. Figure 3 In Model D, the horizontal reference unit is the relative ground surface, which refers to a horizontal reference unit that is a certain height above the ground surface. For example, the upper surface of an island in the air is the relative ground surface. When an obstacle has a surface, that surface can be directly used as the obstacle's relative ground surface; when it does not exist, a virtual relative ground surface can be created based on the obstacle. For example, if a space station has no surface, a virtual relative ground surface can be created.

[0059] After determining the relative ground surface of the obstacle, Recast Navigation can be used to generate a first target sub-path segment corresponding to the obstacle based on this relative ground surface. Then, based on the existing obstacle, the starting point and ending point of the target air region, the B-Star algorithm is used to generate a second target sub-path segment corresponding to the area of ​​the target air region excluding the sub-region where the obstacle is located, thus obtaining the target path segment corresponding to the target air region. The target path segment includes the first target sub-path segment and the second target sub-path segment.

[0060] It is worth noting that the number of the first and second target sub-path segments mentioned above may both be more than one, and the specific generation order can be determined based on the actual situation. For example, if the starting point of the target air region is M(a1,b1,c1) and the ending point is N(a2,b2,c2), firstly, a ray is drawn with point M as the starting point and point B as a point in the ray. Then, the path is moved along the direction of the ray. If there are no obstacles in the path, the destination is reached smoothly. If an obstacle is encountered during the movement, the first target sub-path segment corresponding to the obstacle is generated. Then, the movement continues towards B to complete the pathfinding within the target air region. The target path segment obtained in the above way is equivalent to the path segment obtained by replacing the sub-path segment corresponding to the obstacle in the initial path segment generated directly using the B-Star algorithm based on the starting and ending points with the first target sub-path segment corresponding to the obstacle.

[0061] The following is a brief explanation of the pathfinding process using Recast Navigation.

[0062] The first part is Recast. First, a voxel model is mathematically constructed based on 3D scene resources. Then, locations where characters cannot move are clipped. For example, dead-end areas and areas that do not meet the entry conditions for characters are clipped. Areas that do not meet the entry conditions for characters refer to areas where the entry conditions for all characters in the game scene do not match the area, and no character can enter. Clipping means discarding the area. After clipping, the walkable behavior described by the voxel model is converted into simple 2D regions. In the generated 2D regions, the boundaries can be tracked and simplified to remove the navigation polygons from the regions. Finally, the polygons are converted into convex polygons to obtain a mathematical model that facilitates pathfinding. Simplification methods include removing the intervals between connected regions. For example, if square A and square B share a side, this common side is removed to form a new rectangle.

[0063] The second part is the Detour. The Detour part uses the A* algorithm to find the path between two coordinate points. The Detour consists of three steps: taking points A and B as an example, firstly, the BVH tree is used to find the convex polygons that are closest to the starting point A and the ending point B. After finding them, the A* algorithm is used to calculate the convex polygons that the path from point A to point B is traversed. Finally, the funnel algorithm is used to optimize the path to the final result.

[0064] If the location of an obstacle is not fixed or there is no navigable area within it relative to the target object, the obstacle avoidance method can be determined based on the attributes of the target object and / or the obstacle. That is, the avoidance strategy to be used can be determined based on the attributes of the target object and / or the obstacle. For example, when the obstacle is static, if the target object has a jump attribute, it can jump over the current obstacle; if it has a flight attribute, it can leap over the current obstacle; it can also choose to use the method of circumventing the obstacle's edge, as used when using the B-Star algorithm for surface pathfinding. When the obstacle is moving, it can also choose to wait for the obstacle to move. In this way, obstacles can be avoided through various avoidance strategies, ensuring path reachability. The attributes of the target object and / or the obstacle can be obtained from a configuration table.

[0065] Once the target avoidance method is determined, a third target sub-path segment corresponding to the obstacle can be determined based on the target avoidance method. For example, if the target avoidance method is to leap over the current obstacle, a third target sub-path segment can be generated to indicate leaping over the current obstacle; if the target avoidance method is to wait for the obstacle to move, a third target sub-path segment can be generated to indicate waiting for the obstacle to move, for example, this third target sub-path segment only has one point approaching the obstacle and a waiting time is set, etc.

[0066] Furthermore, the B-Star algorithm is used to generate a second target sub-path segment corresponding to the area of ​​the target air region other than the sub-region where the obstacle is located, so as to obtain the target path segment corresponding to the target air region. The target path segment includes the second target sub-path segment and the third target sub-path segment.

[0067] As another possible implementation, the B-Star algorithm can be used to directly plan the path based on the starting and ending positions. Optionally, during the planning process, if obstacles are encountered, the B-Star algorithm can be used to bypass them by following the detour method adopted when encountering obstacles on the ground surface; alternatively, the target avoidance method can be determined by combining the attributes of the target object and / or the attributes of the encountered obstacles, and then a detour sub-segment can be determined based on the target avoidance method, and then the B-Star algorithm can be used to continue pathfinding to obtain the first target route.

[0068] Optionally, in this embodiment, when the pathfinding task is a ground pathfinding task, RecastNavigation can be used to generate a second target route based on the starting point and ending point.

[0069] Please refer to Figure 4 , Figure 4 This is a second schematic flowchart illustrating the routing method provided in this application embodiment. In this embodiment, the method may further include steps S140 to S160. When the routing task is a ground routing task, step S140 is executed.

[0070] Step S140: Determine the current pathfinding scale.

[0071] Step S150: Determine whether the current pathfinding scale is greater than the preset value.

[0072] If the current pathfinding scale is greater than the preset value, execute step S160.

[0073] Step S160: Use the B-Star algorithm to generate a second target route based on the starting point and ending point.

[0074] The current pathfinding scale represents the total number of current pathfinding tasks. If the current pathfinding scale is greater than a preset value, it indicates that there are many current pathfinding tasks, and the equipment used for pathfinding is under heavy pressure. The B-Star algorithm uses a greedy strategy, searching for the closest position to the destination each time, unlike the A-Star algorithm which calculates weights. Therefore, its efficiency is 10 to 100 times higher than A-Star. To alleviate pathfinding pressure, when the pathfinding scale is large, the B-Star algorithm is used to generate a second target route based on the starting and ending positions.

[0075] Please refer to this again. Figure 4In this embodiment, the method may further include step S170. Step S170 is executed when the current pathfinding size is not greater than a preset value.

[0076] Step S170: Use Recast Navigation to generate a second target route based on the starting point and ending point.

[0077] The A* algorithm can accurately find the path between two points. When the current pathfinding pressure is not high, Recast Navigation can be used to generate a second target route based on the starting and ending points to ensure the pathfinding effect.

[0078] Please refer to Figure 5 , Figure 5 This is a third schematic flowchart illustrating the pathfinding method provided in this embodiment. In this embodiment, the method may further include steps S101 to S103.

[0079] Step S101: Generate a voxel model in advance based on the game scene.

[0080] Step S102: Generate a target two-dimensional map for surface pathfinding based on the voxel model.

[0081] Steps S101 and S102 are the same as the processing before pathfinding in Recast Navigation, and will not be described again here.

[0082] Step S103: The airspace of the game scene is divided into multiple airspace regions in advance, and obstacle information corresponding to each airspace region is generated based on the voxel model and the height range corresponding to each airspace region.

[0083] The voxel model simultaneously describes the distribution of aerial obstacles in the game scene. The airspace of the game scene can be divided into multiple aerial regions. That is, a physical height field is defined for the aerial portion. The height ranges of different aerial regions can be the same or different, depending on actual needs. For example, some aerial regions can be 9m high, some 10m high, or all aerial regions can be 9m high. Based on the obstacle distribution shown in the voxel model and the corresponding height ranges of each aerial region, obstacle information for each aerial region can be generated.

[0084] In this embodiment, the air segment is rationally divided into different physical altitude fields to facilitate pathfinding in each field, thereby improving pathfinding speed. Simultaneously, the concept of a relative ground surface is introduced, utilizing RecastNavigation for pathfinding on the relative ground surface and the B-Star algorithm for fuzzy pathfinding in the air. This addresses the shortcomings of the RNV scheme, meeting the needs of airborne interaction while reducing the workload on the pathfinding equipment. Furthermore, physical behavior is used to ensure pathfinding accessibility. Moreover, when pathfinding pressure is high, the B-Star algorithm is employed for both ground and airborne pathfinding tasks to reduce the equipment's pathfinding burden.

[0085] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of the path-finding device 200 is given below. Optionally, the path-finding device 200 can adopt the above-described... Figure 1 The device structure of the electronic device 100 shown. Further, please refer to... Figure 6 , Figure 6 This is one of the block diagrams of the pathfinding device 200 provided in this application embodiment. It should be noted that the pathfinding device 200 provided in this embodiment has the same basic principle and technical effects as the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The pathfinding device 200 may include: a task acquisition module 210, a judgment module 220, and a planning module 230.

[0086] The task acquisition module 210 is used to acquire a pathfinding task. The pathfinding task includes a starting point location and an ending point location.

[0087] The judgment module 220 is used to determine whether the pathfinding task is an aerial pathfinding task.

[0088] The planning module 230 is used to generate a first target route in the air based on the B-Star algorithm, according to the starting position and the ending position, when the pathfinding task is an aerial pathfinding task.

[0089] Optionally, in this embodiment, the planning module 230 is specifically used to: determine the target air regions traversed by the first target route based on the pre-divided height ranges corresponding to each air region, the starting position, and the ending position, wherein different air regions correspond to different height ranges, and a waypoint is set between adjacent air regions; for each target air region, pathfinding is performed in parallel based on the B-Star algorithm according to the starting and ending points corresponding to the target air region to obtain the target path segment corresponding to the target spatial region, wherein the first target route includes the target path segments corresponding to each target spatial region, and the overlapping points of the target path segments corresponding to adjacent target spatial regions are the waypoints set between the adjacent target spatial regions.

[0090] Optionally, in this embodiment, the planning module 230 is specifically used to: when the obstacle information corresponding to the target air region indicates that there are no obstacles between the starting point and the ending point of the target air region, generate a target path segment corresponding to the target air region using the B-Star algorithm based on the starting point and the ending point of the target air region; when the obstacle information corresponding to the target air region indicates that there are obstacles between the starting point and the ending point of the target air region, if the position of the existing obstacle is fixed and there is a navigable area inside relative to the target object corresponding to the pathfinding task, determine the relative ground surface of the obstacle, generate a first target sub-path segment corresponding to the obstacle based on the relative ground surface using Recast Navigation, and generate a second target sub-path segment corresponding to the area of ​​the target air region other than the sub-area where the obstacle is located using the B-Star algorithm based on the existing obstacle and the starting point and the ending point of the target air region, so as to obtain the target path segment corresponding to the target air region, wherein the target path segment includes the first target sub-path segment and the second target sub-path segment.

[0091] Optionally, in this embodiment, the planning module 230 is specifically used to: when the obstacle information corresponding to the target air region indicates that there are obstacles between the starting point and the ending point of the target air region, if the position of the existing obstacle is not fixed or there is no navigable area inside relative to the target object, then determine the target avoidance method according to the attributes of the target object and / or the attributes of the obstacle; determine the third target sub-path segment corresponding to the obstacle according to the target avoidance method, and use the B-Star algorithm to generate the second target sub-path segment corresponding to the area of ​​the target air region other than the sub-region where the obstacle is located, so as to obtain the target path segment corresponding to the target air region, wherein the target path segment includes the second target sub-path segment and the third target sub-path segment.

[0092] Optionally, in this embodiment, when the pathfinding task is a ground pathfinding task, the planning module 230 is further used to determine the current pathfinding scale, and when the current pathfinding scale is greater than a preset value, to generate a second target route based on the starting position and the ending position using the B-Star algorithm.

[0093] Optionally, in this embodiment, the planning module 230 is further configured to generate a second target route based on the starting point and ending point using Recast Navigation when the current pathfinding scale is not greater than a preset value.

[0094] Please refer to Figure 7 , Figure 7This is a second block diagram of the pathfinding device 200 provided in an embodiment of this application. In this embodiment, the pathfinding device 200 may further include a preprocessing module 201.

[0095] The preprocessing module 201 is used to: generate a voxel model in advance based on the game scene; generate a target two-dimensional map for ground surface pathfinding based on the voxel model; divide the airspace of the game scene into multiple airspace regions in advance, and generate obstacle information corresponding to each airspace region based on the voxel model and the height range corresponding to each airspace region.

[0096] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown is either stored in or embedded in the operating system (OS) of the electronic device 100, and can be used by... Figure 1 The processor 120 executes the program. Meanwhile, the data and program code required to execute the above modules can be stored in the memory 110.

[0097] This application also provides a readable storage medium storing a computer program thereon, which, when executed by a processor, implements the pathfinding method described above.

[0098] In summary, the embodiments of this application provide a pathfinding method, apparatus, electronic device, and readable storage medium. When the obtained pathfinding task is an aerial pathfinding task, a first target route in the air is generated based on the B-Star algorithm according to the starting and ending positions in the pathfinding task. This allows for rapid aerial pathfinding and improves the pathfinding performance of pathfinding systems in 3D scenes.

[0099] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0100] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0101] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0102] The above description is merely an optional embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method of wayfinding, characterized by, The method comprises: obtaining a routing task, wherein the routing task comprises a start position and an end position; determining whether the routing task is an aerial routing task; when the routing task is an aerial routing task, generating a first target route in the air based on the B-star algorithm according to the start position and the end position; wherein when the routing task is an aerial routing task, generating a first target route in the air based on the B-star algorithm according to the start position and the end position comprises: determining a target aerial region through which the first target route passes according to the height range corresponding to each aerial region, the start position and the end position, wherein the height range corresponding to different aerial regions is different, and a waypoint is arranged between adjacent aerial regions; for each target aerial region, performing routing based on the B-star algorithm according to the start point and the end point of the target aerial region in parallel to obtain a target path segment corresponding to the target aerial region, wherein the first target route comprises the target path segment corresponding to each target aerial region, and the intersection point of the target path segments corresponding to adjacent target aerial regions is the waypoint arranged between the adjacent target aerial regions; wherein for each target aerial region, performing routing based on the B-star algorithm according to the start point and the end point of the target aerial region in parallel to obtain a target path segment corresponding to the target aerial region comprises: when the obstacle information corresponding to the target aerial region indicates that there is no obstacle between the start point and the end point corresponding to the target aerial region, generating a target path segment corresponding to the target aerial region using the B-star algorithm according to the start point and the end point of the target aerial region; when the obstacle information corresponding to the target aerial region indicates that there is an obstacle between the start point and the end point corresponding to the target aerial region, if the position of the existing obstacle is fixed and there is a routable region inside the obstacle relative to the target object corresponding to the routing task, determining a relative ground surface of the obstacle, generating a first target sub-path segment corresponding to the obstacle based on the relative ground surface using Recast Navigation, and generating a second target sub-path segment corresponding to the region of the target aerial region excluding the sub-region where the obstacle is located using the B-star algorithm according to the existing obstacle, the start point and the end point of the target aerial region, to obtain a target path segment corresponding to the target aerial region, wherein the target path segment comprises the first target sub-path segment and the second target sub-path segment.

2. The method of claim 1, wherein, For each target aerial region, performing routing based on the B-star algorithm according to the start point and the end point of the target aerial region in parallel to obtain a target path segment corresponding to the target aerial region further comprises: when the obstacle information corresponding to the target aerial region indicates that there is an obstacle between the start point and the end point corresponding to the target aerial region, if the position of the existing obstacle is not fixed or there is no routable region inside the obstacle relative to the target object, determining a target avoidance mode according to the attributes of the target object and / or the attributes of the obstacle. The third target sub-path segment corresponding to the obstacle is determined according to the target avoidance mode, and a second target sub-path segment corresponding to a region of the target air region except a sub-region where the obstacle is located is generated by using a B-star algorithm, so as to obtain a target path segment corresponding to the target air region, wherein the target path segment includes the second target sub-path segment and the third target sub-path segment.

3. The method according to any one of claims 1-2, characterized in that, The method further includes: When the path finding task is a ground path finding task, determining a current path finding scale; When the current path finding scale is greater than a preset value, generating a second target route according to the start point position and the end point position by using a B-star algorithm.

4. The method of claim 3, wherein, The method further includes: When the current path finding scale is not greater than the preset value, generating a second target route according to the start point position and the end point position by using Recast Navigation.

5. The method of claim 4, wherein, The method further includes: A voxel model is generated in advance according to a game scene; A target two-dimensional map for ground surface path finding is generated according to the voxel model; The sky of the game scene is divided into a plurality of air regions in advance, and obstacle information corresponding to each air region is generated according to the voxel model and a height range corresponding to each air region.

6. A wayfinding device, characterized in that, The device includes: A task obtaining module configured to obtain a path finding task, wherein the path finding task includes a start point position and an end point position; A judging module configured to judge whether the path finding task is an air path finding task; A planning module configured to, when the path finding task is an air path finding task, generate a first target route in the air according to the start point position and the end point position based on a B-star algorithm. The planning module is specifically configured to: Determine a target air region through which the first target route passes according to a height range corresponding to each air region, the start point position and the end point position, wherein the height range corresponding to different air regions is different, and a waypoint is arranged between adjacent air regions; For each target air region, path finding is performed in parallel according to a start point and an end point corresponding to the target air region based on a B-star algorithm, to obtain a target path segment corresponding to the target air region, wherein the first target route includes the target path segment corresponding to each target air region, and a coincidence point of target path segments corresponding to adjacent target air regions is the waypoint arranged between the adjacent target air regions; The planning module obtains the target path segment in the following manner: When obstacle information corresponding to the target air region indicates that there is no obstacle between the start point and the end point corresponding to the target air region, a target path segment corresponding to the target air region is generated according to the start point and the end point corresponding to the target air region by using a B-star algorithm. In a case where the obstacle information corresponding to the target air region indicates that there is an obstacle between the start point and the end point corresponding to the target air region, if a position of the obstacle is fixed and there is a navigable region inside the obstacle relative to a target object corresponding to the pathfinding task, a relative ground surface of the obstacle is determined, a first target sub-path segment corresponding to the obstacle is generated based on the relative ground surface by using Recast Navigation, and a second target sub-path segment corresponding to a region of the target air region other than a sub-region where the obstacle is located is generated by using B-star algorithm according to the obstacle, the start point and the end point corresponding to the target air region, so as to obtain a target path segment corresponding to the target air region, wherein the target path segment includes the first target sub-path segment and the second target sub-path segment.

7. An electronic device, comprising: The processor and the memory are included, and the memory stores machine executable instructions capable of being executed by the processor, and the processor can execute the machine executable instructions to implement the pathfinding method in any one of claims 1-5.

8. A readable storage medium, having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the pathfinding method in any one of claims 1-5.

Citation Information

Patent Citations

  • Grid-based online game way-finding method and device

    CN111111187A

  • Way-finding method and device for three-dimensional space flight of game and medium

    CN112999658A