WO2023202188A1 - Method for generating pathfinding data, pathfinding method, and computer device - Google Patents

Method for generating pathfinding data, pathfinding method, and computer device Download PDF

Info

Publication number
WO2023202188A1
WO2023202188A1 PCT/CN2023/074974 CN2023074974W WO2023202188A1 WO 2023202188 A1 WO2023202188 A1 WO 2023202188A1 CN 2023074974 W CN2023074974 W CN 2023074974W WO 2023202188 A1 WO2023202188 A1 WO 2023202188A1
Authority
WO
WIPO (PCT)
Prior art keywords
dynamic
area
layer
data
pathfinding
Prior art date
Application number
PCT/CN2023/074974
Other languages
French (fr)
Chinese (zh)
Inventor
欧阳卓能
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2023202188A1 publication Critical patent/WO2023202188A1/en

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/53Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game
    • A63F13/537Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen
    • A63F13/5372Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen for tagging characters, objects or locations in the game scene, e.g. displaying a circle under the character controlled by the player
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/53Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game
    • A63F13/537Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen
    • A63F13/5378Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen for displaying an additional top view, e.g. radar screens or maps
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/30Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by output arrangements for receiving control signals generated by the game device
    • A63F2300/303Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by output arrangements for receiving control signals generated by the game device for displaying additional data, e.g. simulating a Head Up Display
    • A63F2300/306Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by output arrangements for receiving control signals generated by the game device for displaying additional data, e.g. simulating a Head Up Display for displaying a marker associated to an object or location in the game field

Definitions

  • the present application relates to the field of computer technology, and in particular to a method for generating path-finding data, a device for generating path-finding data, a path-finding method, a path-finding device, computer equipment, computer-readable storage media, and computer program products.
  • Pathfinding data is data that needs to be used in the pathfinding process, that is, pathfinding is performed based on pathfinding data.
  • Pathfinding data can be provided in different data dimensions, such as grid, waypoint, voxel, navigation mesh, etc. Taking the navigation grid as an example, there will be various dynamic objects that change dynamically during the game. For example, as the game progress changes, the game player's operations, or the game service provider updates the game content, there may be dynamically added objects on the map. Buildings, scene objects, constructions, etc.
  • the traditional pathfinding data generation method is to determine when dynamic objects are added during the game, and then combine the added dynamic objects to generate new pathfinding data in real time for pathfinding applications.
  • this way of generating pathfinding data requires a lot of memory, CPU and other resources, and will affect the real-time performance of the game's pathfinding process.
  • a pathfinding data generation method a pathfinding data generation device, a pathfinding method, a pathfinding device, a computer device, a computer-readable storage medium, and a computer program product are provided.
  • this application provides a method for generating pathfinding data, which is executed by a computer device.
  • the methods include:
  • pathfinding data of the target scene is generated.
  • determining the dynamic area layer in the target scene includes:
  • the dynamic area layer to which each dynamic area belongs is determined.
  • the method further includes: adding a dynamic area mark to the dynamic area.
  • adding a dynamic area mark to the dynamic area includes:
  • a corresponding shape mark is added to the dynamic area, and a corresponding shape mark identifier is assigned to the shape mark.
  • the basic map scene If it is necessary to block the basic map scene, divide the basic map scene into map blocks, generate corresponding block area pathfinding data for each map block, and determine the block area pathfinding data corresponding to each map block.
  • the basic area pathfinding data includes the block area pathfinding data and the block area connection relationship;
  • the method further includes: recording the first boundary information of the boundary between the basic area layer and the dynamic area;
  • Traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer includes: in the second boundary information, traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer;
  • Searching for a target base layer boundary line segment that matches a dynamic layer boundary line segment in the base area pathfinding data includes: searching for a target base layer boundary line segment that matches a dynamic layer boundary line segment in the first boundary information.
  • the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, it is determined that the projection condition is met, otherwise the projection condition is not met.
  • the first coordinate axis is determined to be the target coordinate axis.
  • the second coordinate axis is the target coordinate axis.
  • the first coordinate axis is determined to be the target coordinate axis.
  • the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is outside the predetermined slope range, determine the second coordinate axis as the target coordinate axis.
  • this application also provides a path-finding method, which is executed by a computer device.
  • Methods include:
  • the pathfinding data includes target pathfinding data
  • the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on;
  • pathfinding is performed in the target pathfinding data to obtain the pathfinding path.
  • the target pathfinding data also includes: splicing information of the basic area layer and the dynamic area layer.
  • the dynamic area pathfinding data of the dynamic area layer is the dynamic area pathfinding data of the dynamic area layer marked as turned on.
  • the dynamic area pathfinding data includes: in each dynamic area of the dynamic area layer, the data is marked as "on”. Pathfinding data for enabled dynamic areas.
  • pathfinding is performed in the target pathfinding data to obtain the pathfinding path, including:
  • Start pathfinding from the starting point polygon perform pathfinding in the target pathfinding data, and sequentially search for expanded adjacent polygons until the end point polygon is found, and obtain the pathfinding path.
  • this application also provides a device for generating pathfinding data.
  • Devices include:
  • a dynamic layer determination module used to determine the dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area
  • the basic data generation module is used to load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
  • the dynamic data generation module is used to load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
  • the splicing module is used to establish the splicing information of the dynamic regional layer and the basic regional layer;
  • Data determination module used to generate target fields based on basic area pathfinding data, dynamic area pathfinding data and splicing information Pathfinding data for the scene.
  • this application also provides a pathfinding device.
  • Devices include:
  • a loading module used to load pathfinding data.
  • the pathfinding data includes target pathfinding data.
  • the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on. ;
  • the starting point acquisition module is used to obtain starting point information and end point information
  • the pathfinding module based on the starting point information and the end point information, performs pathfinding in the target pathfinding data to obtain the pathfinding path.
  • this application also provides a computer device.
  • the computer device includes one or more memories and a processor.
  • the memory stores a computer program.
  • processors execute the computer program, the pathfinding data generation method or the pathfinding method provided by the embodiments of the present application is implemented.
  • this application also provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program.
  • the computer program is executed by one or more processors, the path-finding data generation method or path-finding method provided by the embodiments of the present application is implemented.
  • this application also provides a computer program product.
  • the computer program product includes a computer program that, when executed by one or more processors, implements the pathfinding data generation method or the pathfinding method provided by the embodiments of the present application.
  • the above pathfinding data generation method, pathfinding data generation device, pathfinding method, pathfinding device, computer equipment, computer readable storage medium and computer program product divide the target scene into a basic area layer and a dynamic scene layer, and the dynamic scene
  • the layer includes at least one dynamic area, and generates basic area pathfinding data corresponding to the basic area layer and dynamic area pathfinding data corresponding to the dynamic area layer, and establishes splicing information of the dynamic area layer and the basic area layer, thereby generating
  • the pathfinding data corresponds to the basic area layer, the dynamic area layer, and the splicing information between the basic area layer and the dynamic area layer.
  • the pathfinding data of the layer and the splicing information between the dynamic area layer and the basic area layer are enough. There is no need to generate new pathfinding data for all scene data every time, which reduces the consumption of resources such as memory and improves game search. efficiency of the road process.
  • Figure 1 is a diagram of a pathfinding data generation method and an application environment diagram of the pathfinding method in one embodiment
  • Figure 2 is a schematic flowchart of a method for generating pathfinding data in one embodiment
  • Figure 3 is a schematic flowchart of determining the dynamic area layer in the target scene in one embodiment
  • Figure 4 is a schematic flowchart of generating dynamic area pathfinding data in one embodiment
  • Figure 5 is a schematic flowchart of establishing splicing information of the dynamic area layer and the basic area layer in one embodiment
  • Figure 6 is a schematic flowchart of searching for target base layer boundary line segments that match dynamic layer boundary line segments in one embodiment
  • Figure 7 shows some examples of line segment relationships between dynamic layer boundary line segments and base layer boundary line segments
  • Figure 8 is a schematic flowchart of a method for generating pathfinding data in one embodiment
  • Figure 9 is a schematic flow chart of generating regional pathfinding data of a regional layer in a dynamic multi-layer and recording its boundary information in an application example
  • Figure 10 is a schematic flow chart of generating pathfinding data of a dynamic area in a dynamic multi-layer dynamic area layer and recording its boundary information in an application example;
  • Figure 11 is a schematic flowchart of generating pathfinding data in an application example
  • Figure 12 is a schematic diagram of pathfinding data of the basic area layer generated in one embodiment
  • Figure 13 is a schematic diagram of pathfinding data of a dynamic area layer generated in an embodiment
  • Figure 14 shows the pathfinding data of the basic area layer in Figure 12 and the pathfinding data of the dynamic area layer in Figure 13 spliced together. Schematic diagram of pathfinding data
  • Figure 15 is a schematic flowchart of a pathfinding method in one embodiment
  • Figure 16 is a schematic flowchart of a pathfinding method in a specific example
  • Figure 17 is a schematic diagram of the pathfinding path at the basic area layer in a specific example
  • Figure 18 is a schematic diagram of the pathfinding path when the dynamic area layer is turned on in a specific example
  • Figure 19 is an internal structure diagram of a computer device in one embodiment.
  • the pathfinding data generation method and pathfinding method provided by the embodiments of the present application can be applied in the application environment as shown in Figure 1.
  • the terminal 102 communicates with the server 104 through the network.
  • the data storage system may store data that server 104 needs to process.
  • the data storage system can be integrated on the server 104, or placed on the cloud or other servers.
  • the server 104 may be a game server, and the terminal 102 is a user terminal participating in the game.
  • the embodiments of this application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, etc.
  • the server 104 provides scene data. Taking the server 104 as a game server as an example, the server 104 provides game scenes, specifically including basic map scene data, dynamic objects existing in the map scene, etc., and the server 104 is based on these scenes. The data generates pathfinding data. These pathfinding data are the areas that can be walked in the game scene, and are the data that need to be used when pathfinding is required. When pathfinding data is provided from the navigation grid as a dimension, the pathfinding data is composed of many convex polygons. When the terminal 102 accesses the server 104 to play the game, the server 104 implements the processing of the game business logic and provides the game scene screen to the terminal 102 for display.
  • the server 104 generates pathfinding data.
  • the server 104 performs pathfinding based on the generated pathfinding data, and performs corresponding game operation processing based on the pathfinding path obtained by pathfinding, or provides the pathfinding path obtained by pathfinding to the terminal 102 for display.
  • the server 104 may generate pathfinding data in real time during the game, or may have generated pathfinding data before the game is released.
  • the server 104 imports the pathfinding data that has been generated, and then based on the pathfinding data when pathfinding is needed. Pathfinding data is used for pathfinding.
  • the terminal 102 can also obtain game-related data directly from the server 104, or obtain game-related data from the server 104 through a third-party device, thereby implementing offline game operation.
  • the terminal 102 runs the game offline, the terminal 102 implements game business logic processing based on the stored game scenes and game logic, and displays the game scene screen.
  • the terminal 102 can generate pathfinding data.
  • pathfinding is performed based on the generated pathfinding data.
  • the terminal 102 does not need to generate the path-finding data by itself, and can directly perform path-finding based on the path-finding data.
  • the terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, Internet of Things devices and portable wearable devices.
  • the Internet of Things devices can be smart TVs, smart air conditioners, smart vehicle-mounted devices, etc.
  • Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.
  • the server 104 can be implemented as an independent server or a server cluster composed of multiple servers.
  • a method for generating pathfinding data is provided, and this method is applied to Figure 1
  • the terminal 102 or the server 104 in is used as an example for illustration, including the following steps S202 to S210.
  • Step S202 Determine the dynamic area layer in the target scene, and the dynamic area layer includes at least one dynamic area.
  • the target scene refers to the scene where corresponding pathfinding data needs to be generated.
  • the target scene can be a specific game scene.
  • the dynamic area layer refers to the area layer where the dynamic objects in the target scene are located.
  • the dynamic objects refer to objects whose status changes in the game scene. Some possible objects whose status changes can be: for example: Objects that are newly added to the scene as the game progress changes or game operations change; objects whose shape, position, etc. change as the game progress changes or game operations change; due to updates to game content, it is necessary New objects added to the scene, etc.
  • the dynamic area refers to the area where the dynamic object is located, and a dynamic area layer includes at least one dynamic area.
  • each dynamic area may be regarded as a dynamic area layer, that is, a dynamic area layer only includes one dynamic area.
  • a dynamic area layer may also include more than two dynamic areas.
  • determining the dynamic area layer in the target scene may include the following steps S2022 to S2024.
  • Step S2022 Determine the dynamic area in the target scene.
  • the dynamic area refers to the area where dynamic objects are located.
  • the dynamic object can be identified by the developer and the dynamic area where the dynamic object is located can be determined.
  • the developer can manually determine the dynamic area through frame selection or other methods.
  • the solution of the embodiment of the present application can determine the dynamic area in the target scene based on user operations.
  • the location of the dynamic object is automatically determined in the dynamic area where the dynamic object is located. For example, by setting a dynamic area marker, the dynamic area marker automatically marks the dynamic area based on the dynamic building or dynamic level area.
  • the dynamic area in the target scene may also include: adding a dynamic area mark to the dynamic area. Therefore, by adding a dynamic area mark to the dynamic area, in subsequent processes, for example, when it is necessary to determine the splicing information of the dynamic area layer and the basic area layer, or during path finding, the dynamic area can be identified through the dynamic area mark.
  • adding a dynamic area mark to the dynamic area specifically includes:
  • a corresponding shape mark is added to the dynamic area, and a corresponding shape mark identifier is assigned to the shape mark.
  • the shape tag is used to mark the shape type of the dynamic area, such as rectangle, circle, cone, staircase, or other polygons.
  • the dynamic area can also be other customized polygons.
  • the added shape mark can be used to identify the shape of the dynamic area, and then in the process of generating pathfinding data, or in the process of pathfinding, the shape of the dynamic area can be combined to complete the generation of pathfinding data. process, or complete the pathfinding process.
  • the assigned shape mark identifier can be used to uniquely identify the dynamic area, that is, the shape mark identifier can be used to uniquely identify a dynamic area. Therefore, a dynamic region can be uniquely identified through the shape mark identification, and the shape of the dynamic region can be determined through the shape mark.
  • the shape mark may be included in the shape mark identifier, that is, a dynamic region can be uniquely identified through the shape mark identifier, and the shape of the dynamic region can be determined through the shape mark identifier.
  • Step S2024 Determine the dynamic area layer to which each dynamic area belongs based on the overlapping relationship of each dynamic area.
  • the overlapping relationship specifically refers to the relationship between whether each dynamic area appears at the same time, or the relationship between the order in which each dynamic area appears, such as the position area between each dynamic area, the order in which each dynamic area appears, etc., which will all affect the Whether dynamic areas can appear at the same time.
  • the dynamic object "house” needs to be changed into the dynamic object "house ruins” after a certain game operation. Then the dynamic object "house” and the dynamic object “house ruins” must not appear at the same time. They exist in sequence. order. Therefore, the dynamic area of the dynamic object "house” and the dynamic area of the dynamic object "house ruins” need to be in different dynamic area layers.
  • Step S204 Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data.
  • the basic scene data of the basic area layer refers to the scene data belonging to the basic area layer in the target scene. It is the scene data whose status will not change in the target scene, such as maps and buildings that will not change in the target scene. , objects, etc.
  • loading the basic scene data of the basic area layer of the target scene and generating the basic area pathfinding data of the basic area layer based on the basic scene data may include:
  • the basic map scene needs to be divided into blocks, divide the basic map scene into map blocks, generate corresponding block area pathfinding data for each map block, and determine the block area corresponding to each map block.
  • the basic area pathfinding data includes the pathfinding data of each block area and the block area connection relationship;
  • the corresponding basic area pathfinding data can be directly generated for the map scene.
  • generating corresponding block area pathfinding data for map blocks may include: performing 3D scene voxelization on the block map scene corresponding to the map block to obtain block map voxel data; Filter the non-walkable areas in the voxel data of the block map to obtain the voxel data of the walkable area of the block map; simplify the contour lines in the voxel data of the walkable area of the block map to obtain the walkable area of the dynamic map after the simplified contour lines Data; generate polygons based on traversable area data of the block map; generate detailed networks based on each polygon, and obtain block area pathfinding data based on the detail network.
  • Step S206 Load the dynamic area layer and generate dynamic area pathfinding data in the dynamic area of the dynamic area layer.
  • the dynamic area layer is loaded and dynamic area pathfinding data in the dynamic area of the dynamic area layer is generated, which specifically includes:
  • a dynamic area pathfinding data generation process is performed, and in the process of executing the dynamic area pathfinding data generation process, data that is not within the dynamic area of the dynamic area layer is filtered.
  • the generated dynamic area pathfinding data is limited to the dynamic area, thereby improving the accuracy of the generated pathfinding data. and improve the accuracy of the pathfinding path finally obtained based on the pathfinding data.
  • the above-mentioned dynamic area pathfinding data generation process specifically includes:
  • a detail network is generated based on each polygon, and dynamic area pathfinding data is obtained based on the detail network.
  • the process of filtering data that is not within the dynamic area of the dynamic area layer can be performed at different times during the above dynamic area pathfinding data generation process.
  • triangles that are not within the dynamic area of the dynamic area layer may be filtered before 3D scene voxelization of the dynamic map scene to filter data that are not within the dynamic area of the dynamic area layer.
  • voxels that are not in the dynamic area of the dynamic area layer can be filtered to filter voxels that are not in the dynamic area layer. dynamic area data within.
  • the above-mentioned generation of polygons based on the traversable area data of the dynamic map includes: generating polygons located only within the dynamic area of the dynamic area layer based on the traversable area data of the dynamic map.
  • data that is not within the dynamic area of the dynamic area layer can be filtered by generating polygons that are only located within the dynamic area of the dynamic area layer.
  • polygons that are not within the dynamic area of the dynamic area layer can be filtered out to filter out dynamic areas that are not in the dynamic area layer. data within.
  • step S206 in a specific example is the process of loading the dynamic area layer and generating the dynamic area pathfinding data in the dynamic area of the dynamic area layer, which may include the following. Step S2061 to step S2069.
  • Step S2061 Load the dynamic map scene of the dynamic area layer.
  • Step S2062 Filter triangles that are not within the dynamic area of the dynamic area layer.
  • Step S2063 Perform 3D scene voxelization on the triangle-filtered dynamic map scene to obtain dynamic map voxel data.
  • Step S2064 Filter voxels that are not in the dynamic area of the dynamic area layer.
  • Step S2065 Filter the unwalkable areas in the dynamic map voxel data (that is, the dynamic map voxel data after filtering the voxels that are not in the dynamic area of the dynamic area layer) to obtain the dynamic map walkable area voxel data.
  • Step S2066 Simplify the contour lines in the voxel data of the dynamic map traversable area, and obtain the dynamic map traversable area data after the simplified contour lines.
  • Step S2067 Generate polygons based on the traversable area data of the dynamic map; in this step, polygons located only within the dynamic area of the dynamic area layer may be generated based on the traversable area data of the dynamic map.
  • Step S2068 Filter out polygons that are not in the dynamic area of the dynamic area layer.
  • Step S2069 Generate a detail network based on each polygon, and obtain dynamic area pathfinding data based on the detail network.
  • Step S208 Establish splicing information of the dynamic area layer and the basic area layer.
  • the splicing information refers to the information about the adjacent boundary between the dynamic region layer and the base region layer.
  • the splicing information specifically indicates which side of which polygon in which dynamic region of the dynamic region layer is related to which polygon of the base region layer. Information about which edges can be spliced. For example, the K-th side of the first polygon of the first dynamic area of the dynamic area layer is connected to the Q-th side of the second polygon of the base area layer.
  • the recorded splicing information indicates that the line segment approximately overlaps with other areas.
  • the Kth edge of the first polygon of the first dynamic region of the dynamic region layer is connected to the Qth edge of the second polygon of the base region layer, which represents the Kth edge of the first dynamic region.
  • the Kth edge of a polygon approximately coincides with the Qth edge of the second polygon of the basic region layer, and their overlapping areas on the corresponding reference axes can be recorded.
  • establishing the splicing information of the dynamic area layer and the basic area layer in step S208 may include the following steps S2018 to S2038.
  • Step S2018 Traverse the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer.
  • the dynamic layer boundary includes each dynamic layer boundary line segment.
  • the dynamic layer boundary of the dynamic area pathfinding data that traverses the dynamic area layer refers to the boundaries of all polygons adjacent to the base area layer that traverse the dynamic area layer. For example, if the H-th edge of the first polygon and the J-th edge of the second polygon in the dynamic area layer are at the boundary of the dynamic area layer, then the dynamic layer boundary line segment obtained by traversing includes the first polygon. The Hth side of the polygon and the Jth side of the second polygon.
  • Step S2028 Find the target base layer boundary line segment in the base area pathfinding data that matches the dynamic layer boundary line segment.
  • the target base layer boundary line segment matching the dynamic layer boundary line segment refers to the base layer boundary line segment that is close to the dynamic layer boundary line segment and can reach the area where the target base layer boundary line segment is located from the dynamic layer boundary line segment.
  • Step S2038 If the target base layer boundary line segment matching the dynamic layer boundary line segment is found, establish a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment.
  • a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment can be established to indicate that the dynamic layer boundary line segment and the target base layer boundary line segment can be spliced.
  • the established line segment connection relationship can be stored in a list or in various other possible ways.
  • the splicing information of the dynamic area layer and the basic area layer includes the line segment connection relationship established above.
  • searching for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data may specifically include:
  • the base layer boundary includes each base layer boundary line segment
  • first projection overlapping area and the second projection overlapping area do not overlap, determine the base layer boundary line segment to be the matching target base layer boundary line segment, and the second projection overlapping area is to combine the found existing target base layer boundary line segment with the dynamic layer
  • the boundary segments are projected onto the overlapping area of the target coordinate axes.
  • the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, it can be determined that the projection condition is met, otherwise the projection condition is not met.
  • the determination of the target coordinate axis can be determined based on the positional relationship between the dynamic layer boundary line segment and the base layer boundary line segment and each coordinate axis.
  • the first coordinate axis may be determined to be the target coordinate axis.
  • the second coordinate axis may be determined to be the target coordinate axis.
  • the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is When the slope is within the predetermined range, the first coordinate axis is determined to be the target coordinate axis.
  • the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is When the slope is outside the predetermined slope range, the second coordinate axis is determined to be the target coordinate axis.
  • the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis. This may mean that the dynamic layer boundary line segment is neither parallel to the first coordinate axis nor parallel to the second coordinate axis. And the base layer boundary line segment is neither parallel to the first coordinate axis nor parallel to the second coordinate axis.
  • the above search for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data may also include:
  • first projection overlap area overlaps with the second projection overlap area, determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment;
  • base layer boundary line segment is better than the existing target base layer boundary line segment, delete the existing target base layer boundary line segment from the found target base layer boundary line segments, and determine the base layer boundary line segment as the matching target base layer boundary line segment;
  • the base layer boundary segment is not a matching target base layer boundary segment.
  • any possible method can be used. For example, in one embodiment, if the distance between the dynamic layer boundary line segment and the base layer boundary line segment is less than the distance between the dynamic layer boundary line segment and the existing target base layer boundary line segment, or the distance between the dynamic layer boundary line segment and the base layer boundary line segment is The angle is smaller than the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment. It is determined that the base layer boundary line segment is better than the existing target base layer boundary line segment. Mark the base layer boundary line segment, otherwise it is determined that the base layer boundary line segment is not better than the existing target base layer boundary line segment.
  • the method of calculating the distance between the dynamic layer boundary line segment and the base layer boundary line segment can be performed by any method of calculating line segment distance, for example, the distance between line segments is obtained by calculating the distance from a point to a line segment.
  • the method of calculating the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment can also be performed by any method of calculating the angle between the line segments, for example, by calculating the line segment vector of the dynamic layer boundary line segment and the existing target base layer boundary line segment. Dot product of line segment vectors to obtain the included angle.
  • searching for the target base layer boundary line segment that matches the dynamic layer boundary line segment in the base area pathfinding data may include:
  • Step S601 Determine the base layer boundary line segment.
  • the base layer boundary line segment refers to one of the boundary line segments of the base area layer to be matched.
  • Step S602 Determine whether the projection condition is met. If the projection condition is met, proceed to step S603. If the projection condition is not met, proceed directly to step S607.
  • the manner of determining whether the projection condition is met may be the same as in the above embodiment.
  • Step S603 Determine the first projection overlap area that projects the dynamic layer boundary line segment and the base layer boundary line segment to the target coordinate axis.
  • projecting the dynamic layer boundary line segment and the base layer boundary line segment to the first projection overlap area of the target coordinate axis means projecting the dynamic layer boundary line segment to the target coordinate axis to obtain the first projection line segment, and projecting the base layer boundary line segment to After the target coordinate axis obtains the second projection line segment, the mutually overlapping line segment area of the first projection line segment and the second projection line segment.
  • Step S604 Determine whether the first projection overlap area and the second projection overlap area overlap. If they overlap, proceed to step S605; otherwise, proceed to step S606.
  • the second projection overlapping area is an overlapping area where the found existing target base layer boundary line segment and the dynamic layer boundary line segment are projected onto the target coordinate axis.
  • the existing target base layer boundary line segments refer to previously found base layer boundary line segments that can be matched. For example, assume that the base layer boundary line segments include line segments L1, L2, L3.... If in the previous matching process, it is assumed that L1 does not match the dynamic layer boundary line segment, and line segment L2 matches the dynamic layer boundary line segment, then L2 is added to the found target base layer boundary line segment list or through other methods. After the method is recorded, the L2 can be used as the boundary line segment of the existing target base layer.
  • the second projection overlap area refers to projecting the dynamic layer boundary line segment to the target coordinate axis to obtain the first projection line segment, and projecting the existing target base layer boundary line segment to the target coordinate axis to obtain the third projection line segment. Overlapping line segment areas of three projected line segments.
  • Step S605 Determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment. If so, proceed to step S606; otherwise, proceed to step S607.
  • the first projection overlap area overlaps with the second projection overlap area, it means that the current base layer boundary line segment and the existing target base layer boundary line segment can be used as the target base layer boundary line segment to realize the connection between the base area layer and the dynamic area layer. splicing. However, a better line segment needs to be selected as the target base layer boundary line segment that is ultimately used for splicing. Therefore, it is necessary to analyze whether the base layer boundary line segment is better than the existing target base layer boundary line segment. The specific manner may be the same as that in the above embodiment.
  • Step S606 Determine the base layer boundary line segment as the matching target base layer boundary line segment.
  • step S604 directly proceeds to S606, that is, the first projection overlap area and the second projection overlap area do not overlap, the base layer boundary line segment can be directly determined.
  • the matching target base layer boundary line segment is added to the list of found target base layer boundary line segments. If step S605 is entered into step S606, that is, when the base layer boundary line segment is better than the existing target base layer boundary line segment, the existing target base layer boundary line segment can be first deleted from the list of found target base layer boundary line segments.
  • the target base layer boundary segment is deleted from the list of found target base layer boundary segments.
  • Step S607 Determine that the base layer boundary line segment is not a matching target base layer boundary line segment.
  • the base layer boundary line segment is better than the existing target base layer boundary line segment, for example, directly retain the existing target base layer boundary line segment.
  • Another example is to directly add the existing target base layer boundary line segment from the found target base layer boundary line segment. Delete it from the list, and then add the base layer boundary segment to the list of found target base layer boundary segments.
  • other methods may also be used to analyze whether the base layer boundary line segment is better than the existing target base layer boundary line segment.
  • the dotted line segment in Figure 7 is the dynamic layer boundary segment and the solid line segment is the base layer boundary segment.
  • the dotted line segment can also be the base layer boundary segment, and the solid line segment can be the dynamic layer boundary segment.
  • the dynamic layer boundary line segment intersects with the base layer boundary line segment (for example, the four points of the two line segments are approximately on a straight line, the intersection of the two line segments is an X shape, and the intersection of the two line segments is T-shaped, two line segments intersect to form a ⁇ shape (two points overlap), and the angle is less than the angle threshold (for example, 35 degrees), then the base layer boundary line segment must be the target base layer boundary line segment of the dynamic layer boundary line segment.
  • the base layer boundary line segment for example, the four points of the two line segments are approximately on a straight line, the intersection of the two line segments is an X shape, and the intersection of the two line segments is T-shaped, two line segments intersect to form a ⁇ shape (two points overlap), and the angle is less than the angle threshold (for example, 35 degrees)
  • the base layer boundary line segment must be the target base layer boundary line segment of the dynamic layer boundary line segment.
  • the angle between the dynamic layer boundary line segment and the base layer boundary line segment is too large, or there is no coverage area after projection of the dynamic layer boundary line segment and the base layer boundary line segment, then the base layer boundary line segment must not be The target base layer boundary segment for the dynamic layer boundary segment.
  • the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and there is a coverage area after projection of the dynamic layer boundary line segment and the base layer boundary line segment, so it is necessary to further combine the two Only by further analyzing the distance between the line segments can it be determined whether the base layer boundary line segment is the target base layer boundary line segment of the dynamic layer boundary line segment.
  • the following conditions should be met between the matching target base layer boundary line segment and the dynamic layer boundary line segment: the line segment between the target base layer boundary line segment and the dynamic layer boundary line segment
  • the distance is small enough (less than the predetermined distance threshold)
  • the angle between the target base layer boundary line segment and the dynamic layer boundary line segment is small enough (less than the angle threshold)
  • the main axis of the target base layer boundary line segment and the dynamic layer boundary line segment on the horizontal plane There is an overlapping portion on the above-mentioned first coordinate axis or second coordinate axis (that is, the above-mentioned first overlapping area is not empty)
  • the height of the target base layer boundary line segment and the dynamic layer boundary line segment is less than the height of the step that can be climbed (can be pre-configured).
  • the height of the line segment specifically refers to projecting the target base layer boundary line segment to the third coordinate axis to obtain projection line segment one, and projecting the dynamic layer boundary line segment to the third coordinate axis to obtain projection line segment two, and then projecting line segment one and The height difference of projected line segment two.
  • Step S210 Generate pathfinding data of the target scene based on basic area pathfinding data, dynamic area pathfinding data and splicing information.
  • basic area pathfinding data, dynamic area pathfinding data and splicing information can be summarized to generate pathfinding data of the target scene. That is, the generated pathfinding data of the target scene includes basic area pathfinding data, dynamic area pathfinding data and splicing information.
  • the generated pathfinding data of the target scene may also include one or more of a dynamic area layer identifier, a dynamic area mark, and an area shape identifier to respectively identify each dynamic area layer, dynamic area, and dynamic area. Area shape. It should be understood that in some specific examples, these dynamic area layer identifiers, dynamic area markers or area shape identifiers can also be directly included in the above-mentioned dynamic area pathfinding data.
  • the basic area pathfinding data may also include:
  • Step S205 Record the first boundary information of the boundary between the base area layer and the dynamic area.
  • the first boundary information of the boundary between the basic area layer and the dynamic area can be directly recorded, so that when the splicing information of the dynamic area layer and the basic area layer is subsequently established, there is no need to search for the basic area.
  • the splicing information can be established directly based on the first boundary information of the recorded basic area pathfinding data to improve the efficiency of establishing splicing information.
  • the recorded first boundary information of the boundary between the basic area layer and the dynamic area may be included in the basic area pathfinding data, or may be extracted from the basic area pathfinding data.
  • the recorded first boundary information may specifically be which polygon of the base area layer and which part of the polygon.
  • the edge is located at the boundary adjacent to the dynamic area layer, that is, the first boundary information recorded.
  • it may include the polygon identifier and the identifier of the polygon's side.
  • the polygon identifier and the identifier of the polygon's side may be included in the same information at the same time. , can also be represented by different information.
  • the dynamic area pathfinding data is generated in the above step S206, it may also include:
  • Step S207 Record the second boundary information of the boundary between the dynamic area and the basic area of the dynamic area layer.
  • the second boundary information of the dynamic area and the basic area boundary of the dynamic area layer can be directly recorded, so that when the splicing information of the dynamic area layer and the basic area layer is subsequently established, there is no need to target the dynamic area.
  • splicing information can be established directly based on the recorded second boundary information, thereby improving the efficiency of establishing splicing information.
  • the recorded second boundary information may be included in the dynamic area pathfinding data, or may be extracted from the dynamic area pathfinding data.
  • the recorded second boundary information may specifically be which polygon of the dynamic area of the dynamic area layer and which side of the polygon is located at the boundary adjacent to the base area layer, that is, the recorded second boundary information. Specifically, it may be Contains polygon identifiers and polygon side identifiers, where the polygon identifier and polygon side identifiers may be included in the same information at the same time, or may be represented by different information.
  • step S208 of establishing the splicing information of the dynamic area layer and the basic area layer may specifically include step S2081 as shown in FIG. 8 .
  • Step S2081 Establish splicing information of the dynamic region layer and the basic region layer based on the first boundary information and the second boundary information.
  • traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer in the above step S2018 may specifically include: traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer in the second boundary information.
  • searching for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data in the above step S2028 may specifically include: in the first boundary information, searching for the target base layer boundary line segment that matches the dynamic layer boundary line segment.
  • the target base layer boundary segment to which the line segment matches may specifically include: in the first boundary information, searching for the target base layer boundary line segment that matches the dynamic layer boundary line segment.
  • the first boundary information of the basic area pathfinding data is recorded
  • the dynamic area pathfinding data is generated
  • the second boundary information of the dynamic area pathfinding data is recorded, so that when it is necessary to establish
  • Their respective boundaries improve the efficiency of establishing the splicing information of the dynamic area layer and the basic area layer, and at the same time improve the efficiency of generating pathfinding data.
  • the first boundary information of the basic area pathfinding data may be recorded only after the basic area pathfinding data is generated in the above step S204, or the first boundary information of the basic area pathfinding data may be recorded only after the dynamic area pathfinding data is generated in the above step S206.
  • the second boundary information of the dynamic area path finding data is recorded.
  • the process of recording the first boundary information of the basic area path finding data, and after generating the dynamic area path finding data recording the second boundary of the dynamic area path finding data.
  • the information process can be performed simultaneously, that is, both the first boundary information and the second boundary information are recorded.
  • the method of generating area pathfinding data of a regional layer in a dynamic multi-layer and recording its boundary information may include the following steps S901 to S911.
  • the regional layer may be a static regional layer or a dynamic regional layer.
  • Step S901 Input the scene data of the regional layer.
  • the scene data of the regional layer includes: a map scene.
  • Step S902 Determine whether block processing is required. If not, go to step S903; if yes, go to step S905.
  • whether block processing is needed can be determined based on various possible rules. For example, whether block processing is needed can be determined based on the set block size and the size of the map scene.
  • the set block size can be Pre-configured in the configuration file. Taking the judgment of whether block processing is required based on the set block size as an example, if the map size of the map scene is larger than the set block size, it is determined that block processing is required; otherwise, it is determined that block processing is not required. Block processing.
  • Step S903 Divide the entire map scene into one map block.
  • Step S904 Generate regional pathfinding data for map blocks, and enter step S909.
  • the method of generating regional pathfinding data for map tiles may be the same as the method mentioned in the above embodiment.
  • Step S905 Divide the map scene into multiple map blocks.
  • any possible method can be used to divide the map scene into blocks.
  • the map scene is divided into multiple map tiles according to the preconfigured tile size, that is, the map scene is divided into map tiles whose size is the preconfigured tile size.
  • Step S906 Generate block area pathfinding data for map blocks.
  • the method of generating block area pathfinding data for map blocks may be the same as the method mentioned in the above embodiment.
  • Step S907 Determine whether there are still unprocessed map blocks. If so, return to step S906 for the next unprocessed map block. If not, proceed to step S908.
  • Step S908 Establish a connection relationship between the pathfinding data of each block area corresponding to each map block, and enter step S909.
  • the specific way to establish a connection relationship can be any available connection establishment method, for example, it can be based on the splicing relationship of each map block provided by the open source navmesh (a pathfinding data generated by an open source pathfinding library) library.
  • Step S909 Obtain the regional pathfinding data of the regional layer.
  • the obtained regional pathfinding data includes the regional pathfinding data generated directly from the map block. If the map scene is divided into blocks, the obtained area pathfinding data includes: the block area pathfinding data corresponding to each map block and the connection relationship between the block area pathfinding data.
  • the area layer may be a basic area layer or a dynamic area layer. If the area layer is a basic area layer, the obtained area pathfinding data is basic area pathfinding data. If the area layer is a dynamic area layer, the obtained area pathfinding data is the dynamic area pathfinding data of the dynamic area layer.
  • Step S910 Determine whether there is a target area layer. If so, proceed to step S911. If not, end the pathfinding data generation process for the area layer.
  • the target area layer refers to the dynamic area layer with dynamic changes in objects.
  • the target area layer there are dynamic area layers C1, C2, C3, and C4. Then when generating the navmesh of this layer, it can be considered that there is a target area layer.
  • the determination method of the target area layer can be set based on actual technical needs.
  • the pathfinding data generation method in the embodiment of the present application when the pathfinding data generation method in the embodiment of the present application is applied to the scenario of generating pathfinding data offline, it can be directly determined whether there is a dynamic area layer, that is, whether there is a target area layer, Specifically, it can be determined whether a dynamic area layer exists. If a dynamic area layer exists, it can be directly determined that there is a target area layer, without caring about whether the dynamic area layer is turned on when the area layer is a dynamic area layer. Therefore, by generating regional pathfinding data for all regional layers in advance and recording the corresponding boundary information, it is beneficial to directly use the generated data during offline operation.
  • the method for generating pathfinding data in the embodiment of the present application is applied to a scenario where pathfinding data is generated online in a real-time online game, it can be determined whether there is a dynamic area layer and the dynamic area layer. Whether the dynamic area of is turned on, that is, the above judgment indicates that there is a target area layer. Specifically, it can be judged whether there is a dynamic area layer with the dynamic area turned on. If there is a dynamic area layer with the dynamic area layer turned on, it is determined that the target area layer exists, and the The enabled dynamic area layer is determined as the target area layer. Among them, the dynamic area layer is turned on, which means that the dynamic area layer is enabled. It can be specifically set by the developer, taking the game scene as an example, or it can automatically trigger the opening of the corresponding dynamic area layer based on changes in the game scene and game progress.
  • Step S911 Record the boundary information of the regional pathfinding data of the regional layer, then end the generation process of the pathfinding data of the regional layer, and at the same time, enter the generation process of the pathfinding data of the next regional layer.
  • the area layer is a basic area layer
  • the recorded boundary information is the first boundary information as mentioned above
  • the area layer is a dynamic area layer
  • the recorded boundary information is the second boundary information as mentioned above. Boundary information.
  • the specific way of recording boundary information is the same as that mentioned in the above embodiment. and in the same way.
  • the pathfinding data generation process can be performed separately for each dynamic area layer.
  • dynamic region pathfinding data is generated for the dynamic region and its boundary information is recorded.
  • the method can be to target the map scene of the dynamic area in the dynamic area layer. First, determine whether the map area needs to be divided into blocks according to the above method. If block processing is not required, then the dynamic area of the dynamic area layer will be processed into blocks. The entire map scene is divided into one map tile. If block processing is required, block processing is performed on the entire map scene of the dynamic area layer to obtain each map block. Then the following steps S1001 to S1014 are executed.
  • Step S1001 Load a dynamic map scene of a map block in the dynamic area layer. It can be understood that, in the above case where the blocking process is not performed, the loaded dynamic map scene of the map block is the entire map scene of the dynamic area layer. In the case of the block processing, the loaded map scene A tiled dynamic map scene is a map scene of one of the map tiles.
  • Step S1002 Filter triangles that are not in the dynamic area.
  • the specific filtering method can be carried out by using the existing method of filtering triangles in the dynamic area.
  • Step S1003 Perform 3D scene voxelization on the triangle-filtered dynamic map scene to obtain dynamic map voxel data.
  • the specific 3D scene voxelization method can be performed using the existing 3D scene voxelization method.
  • Step S1004 Filter voxels that are not in the dynamic area.
  • the specific filtering method can be carried out by using the existing voxel filtering method.
  • Step S1005 Filter the unwalkable areas in the dynamic map voxel data (that is, the map voxel data of the dynamic layer after filtering the voxels that are not in the dynamic area) to obtain the dynamic map walkable area voxel data.
  • existing methods can be used to filter unwalkable areas.
  • Step S1006 Simplify the contour lines in the voxel data of the dynamic map traversable area, and obtain the dynamic map traversable area data after the simplified contour lines.
  • the method of simplifying the contour lines can be carried out by using the existing method of simplifying the contour lines.
  • Step S1007 Generate polygons based on the dynamic map walkable area data; in this step, if the above step S1002 or S1004 is executed, or step S1008 will be executed subsequently, then the dynamic map walkable area data can be directly targeted at this time To generate polygons, you can also generate polygons that are only located in the dynamic area of the dynamic area layer based on the traversable area data of the dynamic map. If none of the above steps S1002, S1004, and S1008 are executed, then it is necessary to generate polygons that are only located in the dynamic area of the dynamic area layer based on the dynamic map walkable area data. That is to say, only the polygons in the dynamic area of the dynamic area layer and at least one of S1002, S1004, and S1008 need to be executed.
  • Step S1008 Filter out polygons that are not in the dynamic area of the dynamic area layer.
  • Step S1009 Generate a detail network based on each polygon, and obtain block area pathfinding data of the map block based on the detail network.
  • the method of generating a detail network based on polygons can be carried out in an existing manner, and is not specifically limited in the embodiments of this application.
  • Step S1010 Determine whether there are still unprocessed map tiles. If so, return to step S1001 for the next unprocessed map tile. If not, proceed to step S1011.
  • Step S1011 Establish a connection relationship between the pathfinding data of each block area corresponding to each map block, and enter step S1012.
  • Step S1012 Obtain dynamic area pathfinding data.
  • the obtained dynamic area pathfinding data includes pathfinding data directly generated for the dynamic area map scene. If the map scene of the dynamic area is divided into blocks, the obtained dynamic area pathfinding data includes: the block area pathfinding data corresponding to each map block and the connection relationship of the block area pathfinding data.
  • Step S1013 Record the boundary information of the dynamic area pathfinding data.
  • the method of recording boundary information is the same as the method mentioned in the above embodiment.
  • Step S1014 Establish the splicing information of the dynamic area layer and the basic area layer, and then end the processing of the dynamic area layer. The generation process of pathfinding data.
  • the method of establishing the splicing information of the dynamic area layer and the basic area layer is the same as the method mentioned in the above embodiment.
  • the process of generating pathfinding data in a specific application example includes the following steps S1101 to S1108.
  • Step S1101 Determine the dynamic areas in the target scene, add dynamic area tags to each dynamic area, and determine the dynamic area layer to which each dynamic area belongs.
  • Step S1102 Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data.
  • Step S1103 Record the first boundary information of the basic area pathfinding data.
  • Step S1104 Determine whether there are other dynamic area layers, that is, whether there are dynamic area layers for which pathfinding data has not been generated. If so, proceed to step S1105; otherwise, proceed to step S1108.
  • Step S1105 Load the data of the next dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer.
  • Step S1106 Record the second boundary information of the dynamic area pathfinding data.
  • Step S1107 Based on the first boundary information and the second boundary information, establish the splicing information of the dynamic area layer and the basic area layer, and return to the above step S1104.
  • Step S1108 Derive basic area pathfinding data, dynamic area pathfinding data, and splicing information to obtain pathfinding data of the target scene.
  • the dynamic area pathfinding data includes dynamic area pathfinding data of dynamic areas of each dynamic area layer, and the splicing information includes splicing information of each dynamic area layer and the basic area layer respectively.
  • FIG 12. a schematic diagram of generating pathfinding data of the basic area layer in a specific example is shown in Figure 12.
  • the generated pathfinding data of a dynamic area layer is shown in Figure 13.
  • the pathfinding data of the basic area layer is The pathfinding data obtained after splicing and merging the pathfinding data of the path data and the pathfinding data of the dynamic area layer is shown in Figure 14.
  • the black line segments represent the area boundaries
  • the dotted line segments represent the line segments of the polygons generated in the generated pathfinding data.
  • the The edge may be the boundary line segment of each area (object, static area and dynamic area), or it may be the line segment determined in the process of dividing the polygon.
  • the area enclosed by the dotted line segment in Figure 12 is a dynamic area of the dynamic area layer.
  • the boundary of the dynamic area is used to assist in determining the boundary line segment of the static area layer.
  • each polygon is obtained using the above method only for the walkable area in the dynamic area.
  • the two-way arrows in Figure 14 indicate that the polygons of the corresponding static area layer are adjacent to the polygons of the dynamic area.
  • a pathfinding method is provided. This method is explained by taking the method applied to the terminal 102 or the server 104 in Figure 1 as an example, including the following steps S1501 to S1503.
  • Step S1501 Load pathfinding data.
  • the pathfinding data includes target pathfinding data.
  • the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on.
  • the target pathfinding data is the pathfinding data that needs to be used in the pathfinding process, and is a resource used to support the pathfinding process.
  • the pathfinding data generation process can be as mentioned in the above embodiments.
  • the pathfinding data generated according to the above pathfinding data generation method may need to use all the pathfinding data in the specific pathfinding process, or only part of the pathfinding data may need to be used.
  • This application implements In this example, the pathfinding data that needs to be used in this pathfinding process is called target pathfinding data.
  • the target pathfinding data must include the basic area pathfinding data of the basic area layer, and also include the dynamic area pathfinding data of the dynamic area layer marked as turned on.
  • dynamic area layer A where the dynamic object a is located will be marked as turned on, so that The dynamic area pathfinding data of the dynamic area layer A is available.
  • dynamic object a changes to dynamic object b through a state change, or dynamic object a disappears and dynamic object b appears
  • the dynamic area layer A where dynamic object a is located will be marked as not open
  • the dynamic area layer A where dynamic object b is located will be marked as not open.
  • Dynamic area layer B will be marked as turned on, so that the dynamic area pathfinding data of dynamic area layer A is in an unavailable state, and the dynamic area pathfinding data of dynamic area layer B is in an available state.
  • the dynamic area pathfinding data of the dynamic area layer is the dynamic area pathfinding data of the dynamic area layer marked as enabled.
  • the dynamic area pathfinding data includes: in each dynamic area of the dynamic area layer, the dynamic area pathfinding data of the dynamic area layer is marked as enabled. Pathfinding data for dynamic areas.
  • the dynamic area pathfinding data in the target pathfinding data includes the dynamic areas marked as enabled in each dynamic area of the dynamic area layer.
  • Pathfinding data That is, the dynamic area pathfinding data of the dynamic area layer marked as disabled will not be included in the target pathfinding data, and in the dynamic area layer marked as enabled, the dynamic area pathfinding data of the dynamic area marked as disabled will not be included in the target pathfinding data. It will also not be included in target pathfinding data to save memory resources.
  • Dynamic area layer C contains two dynamic areas: dynamic area c1 and dynamic area c2. If the mark of dynamic area layer C is turned on, the mark of dynamic area c1 is On, dynamic area c2 is marked as not open, and dynamic area layer D is marked as not on, then the target pathfinding data includes the dynamic area pathfinding data of dynamic area c1 of dynamic area layer C, but does not include the unopened dynamic area layer. The dynamic area pathfinding data of the dynamic area c2 of C, and the dynamic area pathfinding data of the dynamic area layer D.
  • the method before loading the target pathfinding data, the method further includes:
  • the target pathfinding data also includes: splicing information of the basic area layer and the dynamic area layer. Therefore, in the subsequent path-finding process, there is no need to spend additional resources and time to find the boundaries of the dynamic area layer and the boundaries of the basic area layer, which is beneficial to saving resources and improving path-finding efficiency.
  • the above-mentioned loaded pathfinding data may also include: non-target pathfinding data, where the non-target pathfinding data includes dynamic area pathfinding data marked as an unopened dynamic area layer.
  • the non-target pathfinding data is pathfinding data that does not need to be used in this pathfinding process.
  • the pathfinding data generation process can be as mentioned in the above embodiments. Therefore, by loading the target pathfinding data and non-target pathfinding data when loading the pathfinding data, that is, the base area pathfinding data of the base area layer, and all dynamic area layers (including those marked as turned on and those marked as unavailable).
  • the dynamic area pathfinding data is loaded), so that after the non-target pathfinding data is subsequently enabled (that is, the corresponding dynamic area layer flag is changed to on), there is no need to reload, and you can directly adjust the pathfinding data according to whether the flag is turned on or not.
  • Corresponding pathfinding data is used for pathfinding to improve pathfinding efficiency.
  • Step S1502 Obtain starting point information and end point information.
  • the starting point information refers to the starting point for path finding, usually the starting point for path finding, which indicates the starting position for path finding.
  • the endpoint information refers to the endpoint where pathfinding is to be performed, usually the endpoint where pathfinding is to be performed, and it indicates the end position of pathfinding.
  • the starting point information and the ending point information may be specified by the game user.
  • the location of the game character (game player or NPC character) can be used as the starting point information, and the target location indicated by the game user (for example, The clicked target position) or the position that the NPC character wants to reach is used as the target position.
  • the target position for example, The clicked target position
  • other methods may be used to determine the starting point information and the end point information.
  • Step S1503 Based on the starting point information and the end point information, perform path finding in the target path finding data to obtain the path finding path.
  • pathfinding is performed in the target pathfinding data based on the starting point information and the endpoint information, and the pathfinding path is obtained
  • any possible method can be used. Taking the pathfinding data divided based on the navigation grid as an example, in a specific example, based on the starting point information and the end point information, pathfinding is performed in the target pathfinding data to obtain the pathfinding path, which may include:
  • Start pathfinding from the starting point polygon perform pathfinding in the target pathfinding data, and sequentially search for expanded adjacent polygons until the end point polygon is found, and obtain the pathfinding path.
  • the adjacent polygon determines the adjacent polygon as an extended adjacent polygon
  • the adjacent polygons corresponding to the dynamic area layer are determined as extended adjacent polygons
  • the dynamic area is not turned on or the dynamic area layer is not turned on, find the next adjacent adjacent polygon and return to the step of determining the area to which the adjacent polygon belongs, where the next adjacent adjacent polygon is located where the current expanded polygon is located.
  • the area layer, or the next adjacent adjacent polygon is located in the area layer above the area layer where the current expanded polygon is located, or the next adjacent adjacent polygon is located in the base area layer.
  • FIG 16 shows a schematic flowchart of finding extended adjacent polygons in a specific example, which may specifically include the following steps S1601 to step S1608.
  • Step S1601 Determine adjacent polygons adjacent to the currently expanded polygon.
  • the currently expanded polygon refers to the polygon that has been found and added to the pathfinding path. Taking the path-finding process at the beginning as an example, the currently expanded polygon may refer to the polygon where the above starting point information is located. If it is in the pathfinding process, the currently expanded polygon can be a polygon that has been added to the pathfinding path, such as a polygon that has just been added to the pathfinding path, or a polygon that has been added to the pathfinding path at some other time.
  • Step S1602 Determine the area to which adjacent polygons belong. If the adjacent polygon belongs to the dynamic area, step S1603 is entered. If the adjacent polygon belongs to the basic area layer, proceed to step S1605.
  • Step S1603 Determine whether the dynamic area to which the adjacent polygon belongs is turned on. If it is turned on, go to step S1604. If it is not turned on, go to step S1607.
  • Step S1604 Determine whether the dynamic area layer to which the dynamic area belongs is enabled. If it is turned on, go to step S1605; if it is not turned on, go to step S1607.
  • Step S1605 Determine adjacent polygons as extended adjacent polygons.
  • Step S1606 Determine whether path finding is completed. If the path finding is completed, proceed directly to S1608; if the path finding is not completed, proceed to step S1607.
  • various possible ways can be used to analyze and determine whether path finding is completed. For example, if the adjacent polygon found is the polygon where the end point information is located, it can be directly determined that the path finding is completed. If the adjacent polygon found is not the polygon where the end point information is located, it is determined that the path finding is not completed. In some embodiments, other methods may also be used to determine whether path finding is completed, for example, after finding the adjacent polygon, determining whether adding the adjacent polygon to the path finding path is better than the found path finding path. If not, it is determined that the path finding has been completed.
  • step S1601 first determine whether the path finding is completed, that is, determine whether the adjacent polygon adjacent to the current expanded polygon is the polygon where the end point information is located. If so , then it can be directly determined that the path finding is completed. If not, then enter step S1602 of determining the area to which the adjacent polygon belongs. And after determining the adjacent polygon as an extended adjacent polygon in step S1605, the process directly returns to step S1601 to determine the next adjacent polygon.
  • Step S1607 Expand to the next adjacent polygon, and return to the step of determining the area to which the adjacent polygon belongs in step S1601.
  • the next adjacent adjacent polygon is located in the area layer where the currently expanded polygon is located, or, next An adjacent polygon is located in the area layer immediately above the area layer where the current expanded polygon is located, or in the base area layer.
  • the currently expanded polygon may have different situations, and the next adjacent adjacent polygon to be expanded may also have different situations.
  • the polygon adjacent to the currently expanded polygon belongs to an enabled dynamic area. If so, expand the dynamic area with the highest priority that has been enabled in the dynamic area. polygons in the layer. Otherwise extend adjacent polygons in the base region layer.
  • Specific expansion rules can be set in different ways, such as setting the area where the polygon where the end point information is located is located. For example, if the polygon where the end point information is located is located in the dynamic area layer, the polygon in the dynamic area layer can be used as the next adjacent polygon. It should be understood that in other embodiments, other methods may be used to select whether the polygons of the basic region layer or the polygons of the dynamic region layer are used as the next adjacent polygon.
  • the dynamic area layer is the dynamic area layer F1
  • next adjacent adjacent polygon can also be searched for in the base area layer, the dynamic area layer where the current expanded polygon is located, and other dynamic area layers at the same time. If there are adjacent polygons in the dynamic area layer and other dynamic area layers, one polygon can be determined as the next adjacent polygon according to a certain priority or analysis rules.
  • the specific priority setting method or the analysis rule setting method can be the same as the above method.
  • Step S1608 Return the path finding result and end the path finding process.
  • the pathfinding result refers to the pathfinding path finally found.
  • the preparation time of the path finding data is When comparing based on the same test case, when the map block size is 16*16 and the number of polygons is 1, the preparation of pathfinding data of the traditional pathfinding solution takes 12 to 15 milliseconds, while the solution of the embodiment of the present application It is much less than 1 millisecond and can be ignored.
  • the traditional pathfinding solution takes 17 to 21 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond. Can be ignored.
  • the map tile size is 48*48 and the number of polygons is 1
  • the traditional pathfinding solution takes 48 to 50 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond. Can be ignored.
  • the map block size is 48*48 and the number of polygons is 122
  • the traditional pathfinding solution takes 57 to 68 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond.
  • the memory occupied by the traditional pathfinding solution reaches 1262MB, while the memory occupied by the solution in the embodiment of this application is only 318MB, which is much smaller than the memory occupied by the traditional pathfinding solution.
  • the server hosts 200 game instances and the total number of maps is 17, the memory occupied by the traditional pathfinding solution reaches 252400MB, while the memory occupied by the solution in the embodiment of this application is only 5406MB, which is much smaller than the traditional pathfinding solution. memory occupied.
  • embodiments of the present application also provide a pathfinding data generation device for implementing the above-mentioned pathfinding data generation method.
  • the solution to the problem provided by this device is similar to the solution recorded in the above method. Therefore, for the specific limitations in the embodiments of the device for generating one or more pathfinding data provided below, please refer to the pathfinding data mentioned above. The limitations of the generation method will not be repeated here.
  • a pathfinding data generation device including: a dynamic layer determination module, a basic data generation module, a dynamic data generation module, a splicing module and a data determination module, wherein:
  • a dynamic layer determination module used to determine the dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area
  • the basic data generation module is used to load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
  • the dynamic data generation module is used to load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
  • the splicing module is used to establish the splicing information of the dynamic regional layer and the basic regional layer;
  • the data determination module is used to generate pathfinding data of the target scene based on basic area pathfinding data, dynamic area pathfinding data and splicing information.
  • the device further includes: a first boundary recording module and a second boundary recording module;
  • a first boundary recording module configured to record the first boundary information of the boundary between the basic area layer and the dynamic area
  • a second boundary recording module configured to record the second boundary information of the boundary between the dynamic area and the basic area of the dynamic area layer
  • the splicing module is used to establish splicing information of the dynamic region layer and the basic region layer based on the first boundary information and the second boundary information.
  • the dynamic data generation module is used to determine dynamic areas in the target scene; and determine the dynamic area layer to which each dynamic area belongs based on the overlapping relationship of each dynamic area.
  • the dynamic data generation module is used to execute the dynamic area pathfinding data generation process, and in the process of executing the dynamic area pathfinding data generation process, filter data that is not within the dynamic area of the dynamic area layer; wherein, dynamic The regional pathfinding data generation process includes: loading the dynamic map scene of the dynamic regional layer; performing 3D scene rendering on the dynamic map scene.
  • Voxelize to obtain the dynamic map voxel data; filter the non-walkable areas in the dynamic map voxel data to obtain the dynamic map walkable area voxel data; simplify the contour lines in the dynamic map walkable area voxel data to obtain simplified contour lines
  • the final dynamic map traversable area data is generated; polygons are generated based on the dynamic map traversable area data; a detail network is generated based on each polygon, and dynamic area pathfinding data is obtained based on the detail network.
  • the dynamic data generation module is used to filter triangles that are not within the dynamic area of the dynamic area layer before performing 3D scene voxelization on the dynamic map scene.
  • the dynamic data generation module is configured to filter voxels that are not within the dynamic area of the dynamic area layer after obtaining the dynamic map voxel data and before filtering the unwalkable areas in the dynamic map voxel data.
  • the dynamic data generation module is used to generate polygons located only within the dynamic area of the dynamic area layer based on the dynamic map walkable area data when generating polygons based on the dynamic map walkable area data.
  • the dynamic data generation module is used to filter out polygons that are not within the dynamic area of the dynamic area layer after generating polygons based on the traversable area data of the dynamic map and before generating detailed networks based on each polygon.
  • the splicing module is used to traverse the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer.
  • the dynamic layer boundary includes each dynamic layer boundary line segment; search for targets in the basic area pathfinding data that match the dynamic layer boundary line segment.
  • Base layer boundary line segment if the target base layer boundary line segment matching the dynamic layer boundary line segment is found, establish a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment; the splicing information of the dynamic area layer and the base area layer, including line segments connection relationship.
  • the splicing module is used to traverse the base layer boundary to obtain the base area pathfinding data.
  • the base layer boundary includes each base layer boundary line segment; if the projection conditions are met, it is determined to project the dynamic layer boundary line segment and the base layer boundary line segment to The first projection overlap area of the target coordinate axis; if the first projection overlap area and the second projection overlap area do not overlap, determine the base layer boundary line segment to be the matching target base layer boundary line segment, and the second projection overlap area is the found
  • the existing target base layer boundary line segment and the dynamic layer boundary line segment are projected to the overlapping area of the target coordinate axis.
  • the splicing module is used to determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment when the first projection overlapping area overlaps with the second projection overlapping area; when the base layer boundary line segment is better than the existing target base layer boundary line segment, When selecting a target base layer boundary line segment, delete the existing target base layer boundary line segment from the found target base layer boundary line segment list, and determine the base layer boundary line segment as a matching target base layer boundary line segment and add it to the found target base layer boundary line segment. in the target base layer boundary line segment list; and when the base layer boundary line segment is not better than the existing target base layer boundary line segment, it is determined that the base layer boundary line segment is not a matching target base layer boundary line segment.
  • the splicing module is used when the distance between the dynamic layer boundary line segment and the base layer boundary line segment is less than the distance between the dynamic layer boundary line segment and the existing target base layer boundary line segment, or the dynamic layer boundary line segment and the base layer boundary line segment are smaller than the distance between the dynamic layer boundary line segment and the base layer boundary line segment. is smaller than the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment, it is determined that the base layer boundary line segment is better than the existing target base layer boundary line segment.
  • a path-finding device includes: a loading module, a starting point acquisition module, and a path-finding module. in:
  • a loading module used to load pathfinding data.
  • the pathfinding data includes target pathfinding data.
  • the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on. ;
  • the starting point acquisition module is used to obtain starting point information and end point information
  • the pathfinding module based on the starting point information and the end point information, performs pathfinding in the target pathfinding data to obtain the pathfinding path.
  • the pathfinding data loaded by the loading module also includes non-target pathfinding data, and the non-target pathfinding data includes dynamic area pathfinding data marked as unopened dynamic area layer.
  • the pathfinding module is used to determine the starting point polygon to which the starting point information belongs and the end point polygon to which the end point information belongs; starting path finding from the starting point polygon, performing path finding in the target path finding data, and sequentially searching for extended adjacent polygons until Find the end point polygon and obtain the pathfinding path; among them, searching for expanded adjacent polygons includes: determining the adjacent polygons adjacent to the current expanded polygon; determining the area to which the adjacent polygon belongs; if the area to which the adjacent polygon belongs is based district For areas in the domain layer, the adjacent polygons are determined as extended adjacent polygons; if the area to which the adjacent polygons belong is a dynamic area, the dynamic area is turned on, and the dynamic area layer to which the dynamic area belongs is turned on, the adjacent polygons are first determined as Extended adjacent polygons; if the dynamic area is not turned on or the dynamic area layer is not turned on, find the next adjacent adjacent polygon and return to the step of determining the area to which the adjacent polygon and the
  • the pathfinding device further includes: a data generation module,
  • the data generation module is used to obtain the enabled dynamic area layer and the enabled dynamic area; for the enabled dynamic area in the enabled dynamic area layer, generate the dynamic area pathfinding data of the enabled dynamic area layer, and Generate the splicing information of the basic area layer and the dynamic area layer.
  • each module in the pathfinding device may be implemented in whole or in part by software, hardware, or combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in Figure 19.
  • the computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O), and a communication interface.
  • the processor, memory and input/output interface are connected through the system bus, and the communication interface is connected to the system bus through the input/output interface.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes non-volatile storage media and internal memory.
  • the non-volatile storage medium stores operating systems, computer programs and databases. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media.
  • the computer device's database is used to store target scene data and generated pathfinding data.
  • the input/output interface of the computer device is used to exchange information between the processor and external devices.
  • the communication interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program implements a pathfinding data generation method or a pathfinding method when executed by the processor.
  • a computer device which may be a terminal.
  • the computer device includes a processor, memory, input/output interface, communication interface, display unit and input device.
  • the processor, memory and input/output interface are connected through the system bus, and the communication interface, display unit and input device are connected to the system bus through the input/output interface.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes non-volatile storage media and internal memory.
  • the non-volatile storage medium stores operating systems and computer programs. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media.
  • the input/output interface of the computer device is used to exchange information between the processor and external devices.
  • the communication interface of the computer device is used for wired or wireless communication with external terminals.
  • the wireless mode can be implemented through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies.
  • the computer program implements a pathfinding data generation method or a pathfinding method when executed by the processor.
  • the display unit of the computer device is used to form a visually visible picture and can be a display screen, a projection device or a virtual reality imaging device.
  • the display screen can be a liquid crystal display screen or an electronic ink display screen.
  • the input device of the computer device can be a display screen.
  • the touch layer covered above can also be buttons, trackballs or touch pads provided on the computer equipment shell, or it can also be an external keyboard, touch pad or mouse, etc.
  • Figure 19 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied.
  • the specific computer equipment may May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
  • a computer device including a memory and a processor.
  • a computer program is stored in the memory.
  • the processor executes the computer program, it implements the steps in the above method embodiments.
  • a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the steps in the above method embodiments are implemented.
  • a computer program product comprising a computer program, the computer program being During execution, the steps in each of the above method embodiments are implemented.
  • the user information including but not limited to user equipment information, user personal information, etc.
  • data including but not limited to data used for analysis, stored data, displayed data, etc.
  • the computer program can be stored in a non-volatile computer-readable storage medium. , when executed, the computer program may include the processes of the above method embodiments. Any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory.
  • Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory (MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc.
  • Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, etc.
  • RAM Random Access Memory
  • RAM Random Access Memory
  • RAM random access memory
  • RAM Random Access Memory
  • the databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database.
  • Non-relational databases may include blockchain-based distributed databases, etc., but are not limited thereto.
  • the processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to this.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Physics & Mathematics (AREA)
  • Optics & Photonics (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present application relates to a method and apparatus for generating pathfinding data, a pathfinding method and apparatus, a computer device, a storage medium, and a computer program product, applicable in the field of maps. A method of an embodiment comprises: determining a dynamic region layer in a target scene, the dynamic region layer comprising at least one dynamic region (S202); loading basic scene data of a basic region layer of the target scene, and generating basic region pathfinding data of the basic region layer on the basis of the basic scene data (S204); loading the dynamic region layer, and generating dynamic region pathfinding data in the dynamic region of the dynamic region layer (S206); establishing splicing information of the dynamic region layer and the basic region layer (S208); and generating pathfinding data for the target scene on the basis of the basic region pathfinding data, the dynamic region pathfinding data, and the splicing information (S210).

Description

寻路数据的生成方法、寻路方法以及计算机设备Pathfinding data generation method, pathfinding method and computer equipment
相关申请的交叉引用Cross-references to related applications
本申请要求于2022年4月18日提交中国专利局,申请号为2022104053892,申请名称为“寻路数据的生成方法、寻路方法以及计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requests the priority of the Chinese patent application submitted to the China Patent Office on April 18, 2022, with the application number 2022104053892, and the application name is "Method for generating pathfinding data, pathfinding method and computer equipment", and its entire content is approved by This reference is incorporated into this application.
技术领域Technical field
本申请涉及计算机技术领域,特别是涉及一种寻路数据的生成方法、寻路数据的生成装置、寻路方法、寻路装置、计算机设备、计算机可读存储介质和计算机程序产品。The present application relates to the field of computer technology, and in particular to a method for generating path-finding data, a device for generating path-finding data, a path-finding method, a path-finding device, computer equipment, computer-readable storage media, and computer program products.
背景技术Background technique
随着计算机技术的发展,出现了各种需要进行寻路的应用,例如在游戏场景中,游戏的玩家或者游戏中的NPC(Non-Player Character,非玩家角色,游戏中不受玩家控制的角色)通常会需要寻路。为了支持寻路的处理,需要提供寻路数据,寻路数据是在寻路过程中需要使用到的数据,即基于寻路数据来进行寻路。寻路数据可以以不同的数据维度提供,例如格子(Grid)、路点(Waypoint)、体素(Voxel)、导航网格(Navmesh)等。以导航网格为例,游戏过程中会存在各种动态变化的动态物体,例如随着游戏进度的变化、游戏玩家的操作或者游戏服务商对游戏内容的更新,地图上可能会存在动态添加的建筑、场景物件、建造物等。With the development of computer technology, various applications that require path finding have emerged, such as in game scenarios, game players or NPCs (Non-Player Characters) in the game, characters in the game that are not controlled by the player. ) will usually require pathfinding. In order to support pathfinding processing, pathfinding data needs to be provided. Pathfinding data is data that needs to be used in the pathfinding process, that is, pathfinding is performed based on pathfinding data. Pathfinding data can be provided in different data dimensions, such as grid, waypoint, voxel, navigation mesh, etc. Taking the navigation grid as an example, there will be various dynamic objects that change dynamically during the game. For example, as the game progress changes, the game player's operations, or the game service provider updates the game content, there may be dynamically added objects on the map. Buildings, scene objects, constructions, etc.
传统的寻路数据的生成方式,都是在游戏过程中确定添加了动态物体时,再结合添加的动态物体实时生成新的寻路数据,以供进行寻路的应用。然而,这种生成寻路数据的生成方式,需要占用较多的内存、CPU等资源,且会影响游戏寻路过程的实时性。The traditional pathfinding data generation method is to determine when dynamic objects are added during the game, and then combine the added dynamic objects to generate new pathfinding data in real time for pathfinding applications. However, this way of generating pathfinding data requires a lot of memory, CPU and other resources, and will affect the real-time performance of the game's pathfinding process.
发明内容Contents of the invention
根据本申请的各种实施例,提供一种寻路数据的生成方法、寻路数据的生成装置、寻路方法、寻路装置、计算机设备、计算机可读存储介质和计算机程序产品。According to various embodiments of the present application, a pathfinding data generation method, a pathfinding data generation device, a pathfinding method, a pathfinding device, a computer device, a computer-readable storage medium, and a computer program product are provided.
第一方面,本申请提供了一种寻路数据的生成方法,由计算机设备执行。所述方法包括:In a first aspect, this application provides a method for generating pathfinding data, which is executed by a computer device. The methods include:
确定目标场景中的动态区域层,动态区域层中包括至少一个动态区域;Determine the dynamic area layer in the target scene, and the dynamic area layer includes at least one dynamic area;
加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据;Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据;Load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
建立动态区域层和基础区域层的拼接信息;Establish the splicing information of the dynamic area layer and the basic area layer;
基于基础区域寻路数据、动态区域寻路数据和拼接信息,生成目标场景的寻路数据。Based on basic area pathfinding data, dynamic area pathfinding data and splicing information, pathfinding data of the target scene is generated.
在其中一个实施例中,确定目标场景中的动态区域层,包括:In one embodiment, determining the dynamic area layer in the target scene includes:
确定目标场景中的动态区域;Determine dynamic areas in the target scene;
根据各动态区域的重叠关系,确定各动态区域所属的动态区域层。According to the overlapping relationship of each dynamic area, the dynamic area layer to which each dynamic area belongs is determined.
在其中一个实施例中,确定目标场景中的动态区域后,还包括:为动态区域添加动态区域标记。In one embodiment, after determining the dynamic area in the target scene, the method further includes: adding a dynamic area mark to the dynamic area.
在其中一个实施例中,为动态区域添加动态区域标记,包括:In one embodiment, adding a dynamic area mark to the dynamic area includes:
根据动态区域的形状,为动态区域添加对应的形状标记,并为形状标记分配对应的形状标记标识。According to the shape of the dynamic area, a corresponding shape mark is added to the dynamic area, and a corresponding shape mark identifier is assigned to the shape mark.
加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据,包括:Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data, including:
加载目标场景的基础地图场景;Load the base map scene of the target scene;
若需要对基础地图场景进行分块处理,将基础地图场景划分为各地图分块后,针对各地图分块生成对应的分块区域寻路数据,并确定各地图分块对应的分块区域寻路数据之间的分块区域连接关系,基础区域寻路数据包括各分块区域寻路数据以及分块区域连接关系; If it is necessary to block the basic map scene, divide the basic map scene into map blocks, generate corresponding block area pathfinding data for each map block, and determine the block area pathfinding data corresponding to each map block. The block area connection relationship between the road data. The basic area pathfinding data includes the block area pathfinding data and the block area connection relationship;
否则,直接对地图场景,生成对应的基础区域寻路数据。Otherwise, directly generate the corresponding basic area pathfinding data for the map scene.
在其中一个实施例中,基于基础场景数据生成基础区域层的基础区域寻路数据之后,还包括:记录所述基础区域层与动态区域的边界的第一边界信息;In one embodiment, after generating the basic area pathfinding data of the basic area layer based on the basic scene data, the method further includes: recording the first boundary information of the boundary between the basic area layer and the dynamic area;
生成动态区域层的动态区域内的动态区域寻路数据之后,还包括:记录所述动态区域层的所述动态区域与基础区域边界的第二边界信息;After generating the dynamic area pathfinding data within the dynamic area of the dynamic area layer, it further includes: recording second boundary information of the boundary between the dynamic area of the dynamic area layer and the basic area;
遍历动态区域层的动态区域寻路数据的动态层边界,包括:在第二边界信息中,遍历动态区域层的动态区域寻路数据的动态层边界;Traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer includes: in the second boundary information, traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer;
查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段,包括:在第一边界信息中,查找与动态层边界线段匹配的目标基础层边界线段。Searching for a target base layer boundary line segment that matches a dynamic layer boundary line segment in the base area pathfinding data includes: searching for a target base layer boundary line segment that matches a dynamic layer boundary line segment in the first boundary information.
在其中一个实施例中,若动态层边界线段与基础层边界线段的夹角小于夹角阈值,确定满足投影条件,否则不满足投影条件。In one embodiment, if the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, it is determined that the projection condition is met, otherwise the projection condition is not met.
在其中一个实施例中,若动态层边界线段、基础层边界线段均与第一坐标轴平行,确定第一坐标轴为目标坐标轴。In one embodiment, if the dynamic layer boundary line segment and the base layer boundary line segment are both parallel to the first coordinate axis, the first coordinate axis is determined to be the target coordinate axis.
在其中一个实施例中,若动态层边界线段、基础层边界线段均与第二坐标轴平行,第二坐标轴为目标坐标轴。In one embodiment, if the dynamic layer boundary line segment and the base layer boundary line segment are both parallel to the second coordinate axis, the second coordinate axis is the target coordinate axis.
在其中一个实施例中,若动态层边界线段与基础层边界线段与各坐标轴均不平行,动态层边界线段与基础层边界线段的夹角小于夹角阈值,且动态层边界线段的斜率在预定斜率范围内,确定第一坐标轴为目标坐标轴。In one embodiment, if the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is Within the predetermined slope range, the first coordinate axis is determined to be the target coordinate axis.
在其中一个实施例中,若动态层边界线段与基础层边界线段与各坐标轴均不平行,动态层边界线段与基础层边界线段的夹角小于夹角阈值,且动态层边界线段的斜率在预定斜率范围之外,确定第二坐标轴为目标坐标轴。In one embodiment, if the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is outside the predetermined slope range, determine the second coordinate axis as the target coordinate axis.
第二方面,本申请还提供了一种寻路方法,由计算机设备执行。方法包括:In a second aspect, this application also provides a path-finding method, which is executed by a computer device. Methods include:
加载寻路数据,所述寻路数据包括目标寻路数据,目标寻路数据包括:基础区域层的基础区域寻路数据,标记为开启的动态区域层的动态区域寻路数据;Load pathfinding data, the pathfinding data includes target pathfinding data, and the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on;
获得起点信息和终点信息;Obtain starting point information and end point information;
基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径。Based on the starting point information and end point information, pathfinding is performed in the target pathfinding data to obtain the pathfinding path.
在其中一个实施例中,目标寻路数据还包括:基础区域层与动态区域层的拼接信息。In one embodiment, the target pathfinding data also includes: splicing information of the basic area layer and the dynamic area layer.
在其中一个实施例中,动态区域层的动态区域寻路数据,为标记为开启的动态区域层的动态区域寻路数据,动态区域寻路数据包括:动态区域层的各动态区域中,标记为开启的动态区域的寻路数据。In one embodiment, the dynamic area pathfinding data of the dynamic area layer is the dynamic area pathfinding data of the dynamic area layer marked as turned on. The dynamic area pathfinding data includes: in each dynamic area of the dynamic area layer, the data is marked as "on". Pathfinding data for enabled dynamic areas.
在其中一个实施例中,基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径,包括:In one embodiment, based on the starting point information and the end point information, pathfinding is performed in the target pathfinding data to obtain the pathfinding path, including:
确定起点信息所属的起点多边形,终点信息所属的终点多边形;Determine the starting point polygon to which the starting point information belongs and the end point polygon to which the end point information belongs;
自起点多边形开始寻路,在目标寻路数据中进行寻路,依次寻找扩展的邻接多边形,直至寻找到终点多边形,获得寻路路径。Start pathfinding from the starting point polygon, perform pathfinding in the target pathfinding data, and sequentially search for expanded adjacent polygons until the end point polygon is found, and obtain the pathfinding path.
第三方面,本申请还提供了一种寻路数据的生成装置。装置包括:In a third aspect, this application also provides a device for generating pathfinding data. Devices include:
动态层确定模块,用于确定目标场景中的动态区域层,动态区域层中包括至少一个动态区域;a dynamic layer determination module, used to determine the dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area;
基础数据生成模块,用于加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据;The basic data generation module is used to load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
动态数据生成模块,用于加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据;The dynamic data generation module is used to load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
拼接模块,用于建立动态区域层和基础区域层的拼接信息;The splicing module is used to establish the splicing information of the dynamic regional layer and the basic regional layer;
数据确定模块,用于基于基础区域寻路数据、动态区域寻路数据和拼接信息,生成目标场 景的寻路数据。Data determination module, used to generate target fields based on basic area pathfinding data, dynamic area pathfinding data and splicing information Pathfinding data for the scene.
第四方面,本申请还提供了一种寻路装置。装置包括:In a fourth aspect, this application also provides a pathfinding device. Devices include:
加载模块,用于加载寻路数据,所述寻路数据包括目标寻路数据,目标寻路数据包括:基础区域层的基础区域寻路数据,标记为开启的动态区域层的动态区域寻路数据;A loading module, used to load pathfinding data. The pathfinding data includes target pathfinding data. The target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on. ;
起始点获取模块,用于获得起点信息和终点信息;The starting point acquisition module is used to obtain starting point information and end point information;
寻路模块,基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径。The pathfinding module, based on the starting point information and the end point information, performs pathfinding in the target pathfinding data to obtain the pathfinding path.
第五方面,本申请还提供了一种计算机设备。计算机设备包括一个或多个存储器和处理器,存储器存储有计算机程序,一个或多个处理器执行计算机程序时实现本申请实施例提供的寻路数据的生成方法或者寻路方法。In a fifth aspect, this application also provides a computer device. The computer device includes one or more memories and a processor. The memory stores a computer program. When one or more processors execute the computer program, the pathfinding data generation method or the pathfinding method provided by the embodiments of the present application is implemented.
第六方面,本申请还提供了一种计算机可读存储介质。计算机可读存储介质存储有计算机程序,计算机程序被一个或多个处理器执行时实现本申请实施例提供的寻路数据的生成方法或者寻路方法。In a sixth aspect, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by one or more processors, the path-finding data generation method or path-finding method provided by the embodiments of the present application is implemented.
第七方面,本申请还提供了一种计算机程序产品。计算机程序产品包括计算机程序,该计算机程序被一个或多个处理器执行时实现本申请实施例提供的寻路数据的生成方法或者寻路方法。In a seventh aspect, this application also provides a computer program product. The computer program product includes a computer program that, when executed by one or more processors, implements the pathfinding data generation method or the pathfinding method provided by the embodiments of the present application.
上述寻路数据的生成方法、寻路数据的生成装置、寻路方法、寻路装置、计算机设备、计算机可读存储介质和计算机程序产品,为目标场景划分基础区域层和动态场景层,动态场景层中包括至少一个动态区域,并且分别生成基础区域层对应的基础区域寻路数据,以及动态区域层对应的动态区域寻路数据,并建立动态区域层和基础区域层的拼接信息,从而生成的寻路数据是分别对应于基础区域层、动态区域层以及基础区域层和动态区域层之间的拼接信息,在游戏过程中涉及到动态区域的变化时,可以只需再额外提供对应的动态区域层的寻路数据以及该动态区域层和基础区域层之间的拼接信息即可,无需每次都针对所有场景数据生成新的寻路数据,减少了内存等资源的消耗,且提高了游戏寻路过程的效率。The above pathfinding data generation method, pathfinding data generation device, pathfinding method, pathfinding device, computer equipment, computer readable storage medium and computer program product divide the target scene into a basic area layer and a dynamic scene layer, and the dynamic scene The layer includes at least one dynamic area, and generates basic area pathfinding data corresponding to the basic area layer and dynamic area pathfinding data corresponding to the dynamic area layer, and establishes splicing information of the dynamic area layer and the basic area layer, thereby generating The pathfinding data corresponds to the basic area layer, the dynamic area layer, and the splicing information between the basic area layer and the dynamic area layer. When the dynamic area changes during the game, you only need to provide the corresponding dynamic area. The pathfinding data of the layer and the splicing information between the dynamic area layer and the basic area layer are enough. There is no need to generate new pathfinding data for all scene data every time, which reduces the consumption of resources such as memory and improves game search. efficiency of the road process.
附图说明Description of the drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present application or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without exerting creative efforts.
图1为一个实施例中的寻路数据的生成方法和寻路方法的应用环境图;Figure 1 is a diagram of a pathfinding data generation method and an application environment diagram of the pathfinding method in one embodiment;
图2为一个实施例中寻路数据的生成方法的流程示意图;Figure 2 is a schematic flowchart of a method for generating pathfinding data in one embodiment;
图3为一个实施例中确定目标场景中的动态区域层的流程示意图;Figure 3 is a schematic flowchart of determining the dynamic area layer in the target scene in one embodiment;
图4为一个实施例中生成动态区域寻路数据的流程示意图;Figure 4 is a schematic flowchart of generating dynamic area pathfinding data in one embodiment;
图5为一个实施例中建立动态区域层和基础区域层的拼接信息的流程示意图;Figure 5 is a schematic flowchart of establishing splicing information of the dynamic area layer and the basic area layer in one embodiment;
图6为一个实施例中查找与动态层边界线段匹配的目标基础层边界线段的流程示意图;Figure 6 is a schematic flowchart of searching for target base layer boundary line segments that match dynamic layer boundary line segments in one embodiment;
图7为动态层边界线段与基础层边界线段之间的线段关系的一些示例;Figure 7 shows some examples of line segment relationships between dynamic layer boundary line segments and base layer boundary line segments;
图8为一个实施例中寻路数据的生成方法的流程示意图;Figure 8 is a schematic flowchart of a method for generating pathfinding data in one embodiment;
图9为一个应用示例中生成动态多层的一个区域层的区域寻路数据并记录其边界信息的流程示意图;Figure 9 is a schematic flow chart of generating regional pathfinding data of a regional layer in a dynamic multi-layer and recording its boundary information in an application example;
图10为一个应用示例中生成动态多层的动态区域层的一个动态区域的寻路数据并记录其边界信息的流程示意图;Figure 10 is a schematic flow chart of generating pathfinding data of a dynamic area in a dynamic multi-layer dynamic area layer and recording its boundary information in an application example;
图11为一个应用示例中的生成寻路数据的流程示意图;Figure 11 is a schematic flowchart of generating pathfinding data in an application example;
图12为一个实施例中生成的基础区域层的寻路数据的示意图;Figure 12 is a schematic diagram of pathfinding data of the basic area layer generated in one embodiment;
图13为一个实施例中生成的一个动态区域层的寻路数据的示意图;Figure 13 is a schematic diagram of pathfinding data of a dynamic area layer generated in an embodiment;
图14为将图12中的基础区域层的寻路数据与图13中的动态区域层的寻路数据拼接后的 寻路数据的示意图;Figure 14 shows the pathfinding data of the basic area layer in Figure 12 and the pathfinding data of the dynamic area layer in Figure 13 spliced together. Schematic diagram of pathfinding data;
图15为一个实施例中的寻路方法的流程示意图;Figure 15 is a schematic flowchart of a pathfinding method in one embodiment;
图16为一个具体示例中的寻路方法的流程示意图;Figure 16 is a schematic flowchart of a pathfinding method in a specific example;
图17为一个具体示例中在基础区域层的寻路路径示意图;Figure 17 is a schematic diagram of the pathfinding path at the basic area layer in a specific example;
图18为一个具体示例中开启了动态区域层时的寻路路径示意图;Figure 18 is a schematic diagram of the pathfinding path when the dynamic area layer is turned on in a specific example;
图19为一个实施例中计算机设备的内部结构图。Figure 19 is an internal structure diagram of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或服务器不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances so that the embodiments of the invention described herein are capable of being practiced in sequences other than those illustrated or described herein. Furthermore, the terms "include" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product or server that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.
本申请实施例提供的寻路数据的生成方法以及寻路方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他服务器上。一个具体示例中,该服务器104可以是游戏服务器,该终端102是参与游戏的用户终端。本申请实施例可应用于各种场景,包括但不限于云技术、人工智能等。The pathfinding data generation method and pathfinding method provided by the embodiments of the present application can be applied in the application environment as shown in Figure 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system may store data that server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other servers. In a specific example, the server 104 may be a game server, and the terminal 102 is a user terminal participating in the game. The embodiments of this application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, etc.
在其中一种应用场景中,服务器104提供场景数据,以服务器104为游戏服务器为例,服务器104提供游戏场景,具体包括基础地图场景数据、地图场景中存在的动态物体等,服务器104基于这些场景数据生成寻路数据。这些寻路数据是在该游戏场景中可以行走的区域,是在需要进行寻路时需要使用到的数据。以从导航网格为维度提供寻路数据的情况下,该寻路数据是由很多个凸多边形组合而成的。在终端102访问服务器104进行游戏的过程中,服务器104实现游戏业务逻辑的处理,并将游戏场景的画面提供给终端102进行显示,同时服务器104生成寻路数据,在终端102参与游戏的过程中需要寻路时,服务器104基于生成的寻路数据进行寻路,并基于寻路获得的寻路路径进行相应的游戏操作处理,或者将寻路获得的寻路路径提供给终端102进行显示。其中,服务器104可以是在游戏过程中实时生成寻路数据,也可以是在游戏发布之前已经生成了寻路数据,在游戏过程中通过导入已经生成的寻路数据,在需要寻路时再基于寻路数据进行寻路。In one of the application scenarios, the server 104 provides scene data. Taking the server 104 as a game server as an example, the server 104 provides game scenes, specifically including basic map scene data, dynamic objects existing in the map scene, etc., and the server 104 is based on these scenes. The data generates pathfinding data. These pathfinding data are the areas that can be walked in the game scene, and are the data that need to be used when pathfinding is required. When pathfinding data is provided from the navigation grid as a dimension, the pathfinding data is composed of many convex polygons. When the terminal 102 accesses the server 104 to play the game, the server 104 implements the processing of the game business logic and provides the game scene screen to the terminal 102 for display. At the same time, the server 104 generates pathfinding data. During the process of the terminal 102 participating in the game, When pathfinding is required, the server 104 performs pathfinding based on the generated pathfinding data, and performs corresponding game operation processing based on the pathfinding path obtained by pathfinding, or provides the pathfinding path obtained by pathfinding to the terminal 102 for display. The server 104 may generate pathfinding data in real time during the game, or may have generated pathfinding data before the game is released. During the game, the server 104 imports the pathfinding data that has been generated, and then based on the pathfinding data when pathfinding is needed. Pathfinding data is used for pathfinding.
在另一种应用场景中,终端102也可以直接从服务器104获得游戏相关数据,或者通过第三方设备从服务器104获得游戏相关数据,从而实现离线游戏的运行。终端102在离线运行游戏的过程中,终端102基于存储的游戏场景以及游戏逻辑,实现游戏业务逻辑的处理,并将游戏场景的画面进行显示,同时终端102可以生成寻路数据,在游戏的过程中需要寻路时,基于生成的寻路数据进行寻路。其中,若从服务器104获得的游戏相关数据中包含已经生成的寻路数据,则终端102无需自行生成寻路数据,直接基于寻路数据进行寻路即可。In another application scenario, the terminal 102 can also obtain game-related data directly from the server 104, or obtain game-related data from the server 104 through a third-party device, thereby implementing offline game operation. When the terminal 102 runs the game offline, the terminal 102 implements game business logic processing based on the stored game scenes and game logic, and displays the game scene screen. At the same time, the terminal 102 can generate pathfinding data. During the game process When pathfinding is required, pathfinding is performed based on the generated pathfinding data. Among them, if the game-related data obtained from the server 104 includes already generated path-finding data, the terminal 102 does not need to generate the path-finding data by itself, and can directly perform path-finding based on the path-finding data.
其中,终端102可以但不限于是各种台式计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented as an independent server or a server cluster composed of multiple servers.
在一个实施例中,如图2所示,提供了一种寻路数据的生成方法,以该方法应用于图1 中的终端102或服务器104为例进行说明,包括以下步骤S202至S210。In one embodiment, as shown in Figure 2, a method for generating pathfinding data is provided, and this method is applied to Figure 1 The terminal 102 or the server 104 in is used as an example for illustration, including the following steps S202 to S210.
步骤S202:确定目标场景中的动态区域层,动态区域层中包括至少一个动态区域。Step S202: Determine the dynamic area layer in the target scene, and the dynamic area layer includes at least one dynamic area.
目标场景是指需要生成对应的寻路数据的场景,以游戏应用为例,该目标场景可以是一个具体的游戏场景。动态区域层是指该目标场景中的动态物所在的区域层,其中,动态物是指在该游戏场景中状态会发生变化的物体,一些可能的状态会生变化的物体,例如可以是:随着游戏进度的变化或者游戏操作的不同,新添加到该场景的物体;随着游戏进度的变化或者游戏操作的不同,物体的形状、位置等发生了变化的物体;由于游戏内容的更新,需要新添加到该场景中的物体等。The target scene refers to the scene where corresponding pathfinding data needs to be generated. Taking a game application as an example, the target scene can be a specific game scene. The dynamic area layer refers to the area layer where the dynamic objects in the target scene are located. The dynamic objects refer to objects whose status changes in the game scene. Some possible objects whose status changes can be: for example: Objects that are newly added to the scene as the game progress changes or game operations change; objects whose shape, position, etc. change as the game progress changes or game operations change; due to updates to game content, it is necessary New objects added to the scene, etc.
动态区域是指该动态物所处的区域,一个动态区域层包括有至少一个动态区域。一些实施例中,可以是将每个动态区域视作一个动态区域层,即一个动态区域层只包括有一个动态区域。一些实施例中,一个动态区域层也可以包括有两个以上的动态区域。The dynamic area refers to the area where the dynamic object is located, and a dynamic area layer includes at least one dynamic area. In some embodiments, each dynamic area may be regarded as a dynamic area layer, that is, a dynamic area layer only includes one dynamic area. In some embodiments, a dynamic area layer may also include more than two dynamic areas.
一些实施例中,如图3所示,确定目标场景中的动态区域层,可以包括如下步骤S2022至步骤S2024。In some embodiments, as shown in Figure 3 , determining the dynamic area layer in the target scene may include the following steps S2022 to S2024.
步骤S2022:确定目标场景中的动态区域。Step S2022: Determine the dynamic area in the target scene.
如上所述,动态区域是指动态物所在的区域。一些实施例中,可以由开发人员识别出动态物,并确定出动态物所在的动态区域。此时,在确定动态区域时,可以由开发人员手动框选等方式确定出动态区域。本申请实施例方案可以基于用户操作确定出目标场景中的动态区域。在一些实施例中,也可以通过对进入到该目标场景的物体添加属性,基于属性自动对物体是否为动态物进行识别,在根据属性确定物体是动态物时,基于动态物的形状以及动态物所处的位置,自动确定该动态物所在的动态区域。例如,通过设置动态区域标志器,由动态区域标志器基于动态建筑或者动态关卡区域,自动标志动态区域。As mentioned above, the dynamic area refers to the area where dynamic objects are located. In some embodiments, the dynamic object can be identified by the developer and the dynamic area where the dynamic object is located can be determined. At this time, when determining the dynamic area, the developer can manually determine the dynamic area through frame selection or other methods. The solution of the embodiment of the present application can determine the dynamic area in the target scene based on user operations. In some embodiments, it is also possible to add attributes to objects entering the target scene, and automatically identify whether the object is a dynamic object based on the attributes. When determining that the object is a dynamic object based on the attributes, based on the shape of the dynamic object and the dynamic object The location of the dynamic object is automatically determined in the dynamic area where the dynamic object is located. For example, by setting a dynamic area marker, the dynamic area marker automatically marks the dynamic area based on the dynamic building or dynamic level area.
一些实施例中,在确定目标场景中的动态区域后,还可以包括:为动态区域添加动态区域标记。从而,通过为动态区域添加动态区域标记后,在后续的过程中,例如在需要确定动态区域层与基础区域层的拼接信息时,或者在寻路时,可以通过动态区域标记识别出动态区域。In some embodiments, after determining the dynamic area in the target scene, it may also include: adding a dynamic area mark to the dynamic area. Therefore, by adding a dynamic area mark to the dynamic area, in subsequent processes, for example, when it is necessary to determine the splicing information of the dynamic area layer and the basic area layer, or during path finding, the dynamic area can be identified through the dynamic area mark.
一些实施例中,为动态区域添加动态区域标记,具体包括:In some embodiments, adding a dynamic area mark to the dynamic area specifically includes:
根据动态区域的形状,为动态区域添加对应的形状标记,并为形状标记分配对应的形状标记标识。According to the shape of the dynamic area, a corresponding shape mark is added to the dynamic area, and a corresponding shape mark identifier is assigned to the shape mark.
其中,形状标记用以标记动态区域的形状类型,例如矩形、圆形、圆锥形、楼梯形、或者其他多边形,在由开发人员手动确定动态区域的情况下,也可以是自定义的其他多边形。通过添加的形状标记,可以用以识别该动态区域的形状,进而可以在生成寻路数据的过程中,或者在进行寻路的过程中,可以结合该动态区域的形状来完成寻路数据的生成过程,或者完成寻路过程。Among them, the shape tag is used to mark the shape type of the dynamic area, such as rectangle, circle, cone, staircase, or other polygons. When the dynamic area is manually determined by the developer, it can also be other customized polygons. The added shape mark can be used to identify the shape of the dynamic area, and then in the process of generating pathfinding data, or in the process of pathfinding, the shape of the dynamic area can be combined to complete the generation of pathfinding data. process, or complete the pathfinding process.
分配的形状标记标识,可以用以唯一识别该动态区域,即形状标记标识可以用以唯一识别一个动态区域。从而,通过形状标记标识可以唯一识别一个动态区域,通过形状标记可以确定该动态区域的形状。一些实施例中,形状标记可以包含在该形状标记标识中,即可以通过形状标记标识可以唯一识别一个动态区域,同时可以通过形状标记标识确定该动态区域的形状。The assigned shape mark identifier can be used to uniquely identify the dynamic area, that is, the shape mark identifier can be used to uniquely identify a dynamic area. Therefore, a dynamic region can be uniquely identified through the shape mark identification, and the shape of the dynamic region can be determined through the shape mark. In some embodiments, the shape mark may be included in the shape mark identifier, that is, a dynamic region can be uniquely identified through the shape mark identifier, and the shape of the dynamic region can be determined through the shape mark identifier.
步骤S2024:根据各动态区域的重叠关系,确定各动态区域所属的动态区域层。Step S2024: Determine the dynamic area layer to which each dynamic area belongs based on the overlapping relationship of each dynamic area.
其中,重叠关系具体可以是指各动态区域是否同时出现的关系,或者各动态区域出现顺序的关系,例如各动态区域之间的位置区域、各动态区域的先后出现的顺序等,都会影响到该动态区域是否能同时出现。例如,在游戏场景中,动态物“房屋”经过某个游戏操作后需要改变为动态物“房屋废墟”,那么动态物“房屋”与动态物“房屋废墟”必然不能同时出现,二者存在先后顺序。因此,动态物“房屋”的动态区域与动态物“房屋废墟”的动态区域需要处于不同的动态区域层。The overlapping relationship specifically refers to the relationship between whether each dynamic area appears at the same time, or the relationship between the order in which each dynamic area appears, such as the position area between each dynamic area, the order in which each dynamic area appears, etc., which will all affect the Whether dynamic areas can appear at the same time. For example, in the game scene, the dynamic object "house" needs to be changed into the dynamic object "house ruins" after a certain game operation. Then the dynamic object "house" and the dynamic object "house ruins" must not appear at the same time. They exist in sequence. order. Therefore, the dynamic area of the dynamic object "house" and the dynamic area of the dynamic object "house ruins" need to be in different dynamic area layers.
一个动态区域层中,可以存在至少一个动态区域。在一个动态区域层中存在多个动态区域 的情况下,这多个动态区域是可以同时出现的。一些实施例中,也可以通过设定规则,确定该动态区域层中的各动态区域是否开启,只有开启的动态区域,才会进入后续的生成寻路数据和进行寻路的过程。There can be at least one dynamic area in a dynamic area layer. Multiple dynamic regions exist in a dynamic region layer In this case, these multiple dynamic areas can appear at the same time. In some embodiments, rules can also be set to determine whether each dynamic area in the dynamic area layer is enabled. Only enabled dynamic areas will enter the subsequent process of generating pathfinding data and performing pathfinding.
步骤S204:加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据。Step S204: Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data.
基础区域层的基础场景数据,是指目标场景中属于基础区域层的场景数据,是在该目标场景中状态不会发生变化的场景数据,例如在该目标场景中不会发生变化的地图、建筑、物件等等。The basic scene data of the basic area layer refers to the scene data belonging to the basic area layer in the target scene. It is the scene data whose status will not change in the target scene, such as maps and buildings that will not change in the target scene. , objects, etc.
加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据时,可以是采用已有的生成寻路数据的方式进行。例如,在一些实施例中,加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据,可以包括:When loading the basic scene data of the basic area layer of the target scene and generating the basic area pathfinding data of the basic area layer based on the basic scene data, the existing method of generating pathfinding data can be used. For example, in some embodiments, loading the basic scene data of the basic area layer of the target scene, and generating the basic area pathfinding data of the basic area layer based on the basic scene data may include:
加载目标场景的基础地图场景;Load the base map scene of the target scene;
若需要对基础地图场景进行分块处理,将基础地图场景划分为各地图分块后,针对各地图分块分别生成对应的分块区域寻路数据,并确定各地图分块对应的分块区域寻路数据之间的分块区域连接关系,基础区域寻路数据包括各分块区域寻路数据以及分块区域连接关系;If the basic map scene needs to be divided into blocks, divide the basic map scene into map blocks, generate corresponding block area pathfinding data for each map block, and determine the block area corresponding to each map block. The block area connection relationship between the pathfinding data. The basic area pathfinding data includes the pathfinding data of each block area and the block area connection relationship;
若不需要对基础地图场景进行分块处理,直接对地图场景生成对应的基础区域寻路数据。If there is no need to segment the basic map scene into blocks, the corresponding basic area pathfinding data can be directly generated for the map scene.
具体地,一个实施例中,对地图分块生成对应的分块区域寻路数据,可以包括:对地图分块对应的分块地图场景进行3D场景体素化,获得分块地图体素数据;过滤分块地图体素数据中的不可行走区域,获得分块地图可走区域体素数据;简化分块地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据;基于分块地图可走区域数据生成多边形;基于各多边形生成细节网络,并基于细节网络获得分块区域寻路数据。Specifically, in one embodiment, generating corresponding block area pathfinding data for map blocks may include: performing 3D scene voxelization on the block map scene corresponding to the map block to obtain block map voxel data; Filter the non-walkable areas in the voxel data of the block map to obtain the voxel data of the walkable area of the block map; simplify the contour lines in the voxel data of the walkable area of the block map to obtain the walkable area of the dynamic map after the simplified contour lines Data; generate polygons based on traversable area data of the block map; generate detailed networks based on each polygon, and obtain block area pathfinding data based on the detail network.
步骤S206:加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据。Step S206: Load the dynamic area layer and generate dynamic area pathfinding data in the dynamic area of the dynamic area layer.
一个实施例中,加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据,具体包括:In one embodiment, the dynamic area layer is loaded and dynamic area pathfinding data in the dynamic area of the dynamic area layer is generated, which specifically includes:
执行动态区域寻路数据生成过程,并在执行动态区域寻路数据生成过程的过程中,过滤不在动态区域层的动态区域内的数据。A dynamic area pathfinding data generation process is performed, and in the process of executing the dynamic area pathfinding data generation process, data that is not within the dynamic area of the dynamic area layer is filtered.
从而,在生成动态区域寻路数据的过程中,通过过滤不在动态区域层的动态区域内的数据,使得生成的动态区域寻路数据只限定在动态区域内,以提高生成的寻路数据的准确性,以及提高最终依据该寻路数据进行寻路获得的寻路路径的正确度。Therefore, in the process of generating dynamic area pathfinding data, by filtering data that is not within the dynamic area of the dynamic area layer, the generated dynamic area pathfinding data is limited to the dynamic area, thereby improving the accuracy of the generated pathfinding data. and improve the accuracy of the pathfinding path finally obtained based on the pathfinding data.
其中,一个实施例中,上述动态区域寻路数据生成过程,具体包括:Among them, in one embodiment, the above-mentioned dynamic area pathfinding data generation process specifically includes:
加载动态区域层的动态地图场景;Load the dynamic map scene of the dynamic area layer;
对动态地图场景进行3D场景体素化,获得动态地图体素数据;Perform 3D scene voxelization on the dynamic map scene to obtain dynamic map voxel data;
过滤动态地图体素数据中的不可行走区域,获得动态地图可走区域体素数据;Filter the non-walkable areas in the dynamic map voxel data and obtain the voxel data of the dynamic map walkable area;
简化动态地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据;Simplify the contour lines in the voxel data of the dynamic map traversable area, and obtain the dynamic map traversable area data after the simplified contour lines;
基于动态地图可走区域数据生成多边形;Generate polygons based on dynamic map traversable area data;
基于各多边形生成细节网络,并基于细节网络获得动态区域寻路数据。A detail network is generated based on each polygon, and dynamic area pathfinding data is obtained based on the detail network.
其中,过滤不在动态区域层的动态区域内的数据的过程,可以在上述动态区域寻路数据生成过程中的不同时刻进行。The process of filtering data that is not within the dynamic area of the dynamic area layer can be performed at different times during the above dynamic area pathfinding data generation process.
例如,在一个实施例中,可以在对动态地图场景进行3D场景体素化之前,过滤不在动态区域层的动态区域内的三角形,以过滤不在动态区域层的动态区域内的数据。For example, in one embodiment, triangles that are not within the dynamic area of the dynamic area layer may be filtered before 3D scene voxelization of the dynamic map scene to filter data that are not within the dynamic area of the dynamic area layer.
在另一个实施例中,可以在获得动态地图体素数据之后,过滤动态地图体素数据中的不可行走区域之前,过滤不在动态区域层的动态区域内的体素,以过滤不在动态区域层的动态区域 内的数据。In another embodiment, after obtaining the dynamic map voxel data and before filtering the non-walkable areas in the dynamic map voxel data, voxels that are not in the dynamic area of the dynamic area layer can be filtered to filter voxels that are not in the dynamic area layer. dynamic area data within.
在另一个实施例中,上述基于动态地图可走区域数据生成多边形,包括:基于动态地图可走区域数据,生成只位于动态区域层的动态区域内的多边形。从而,可以通过生成只位于动态区域层的动态区域内的多边形,以过滤不在动态区域层的动态区域内的数据。In another embodiment, the above-mentioned generation of polygons based on the traversable area data of the dynamic map includes: generating polygons located only within the dynamic area of the dynamic area layer based on the traversable area data of the dynamic map. Thus, data that is not within the dynamic area of the dynamic area layer can be filtered by generating polygons that are only located within the dynamic area of the dynamic area layer.
在另一个实施例中,可以在基于动态地图可走区域数据生成多边形之后,基于各多边形生成细节网络之前,过滤掉不在动态区域层的动态区域内的多边形,以过滤不在动态区域层的动态区域内的数据。In another embodiment, after polygons are generated based on the dynamic map walkable area data and before detail networks are generated based on each polygon, polygons that are not within the dynamic area of the dynamic area layer can be filtered out to filter out dynamic areas that are not in the dynamic area layer. data within.
其中,在一些实施例中,在上述四种过滤不在动态区域层的动态区域内的数据的方式中,可以只采用其中一种方式,也可以是同时采用两种以上的多种方式。In some embodiments, among the above four ways of filtering data that are not within the dynamic area of the dynamic area layer, only one of the methods may be used, or two or more methods may be used simultaneously.
如图4所示,以同时包含上述四种方式为例,一个具体示例中的步骤S206的加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据的过程,具体可以包括如下步骤S2061至步骤S2069。As shown in Figure 4, taking the above four methods as an example, step S206 in a specific example is the process of loading the dynamic area layer and generating the dynamic area pathfinding data in the dynamic area of the dynamic area layer, which may include the following. Step S2061 to step S2069.
步骤S2061:加载动态区域层的动态地图场景。Step S2061: Load the dynamic map scene of the dynamic area layer.
步骤S2062:过滤不在动态区域层的动态区域内的三角形。Step S2062: Filter triangles that are not within the dynamic area of the dynamic area layer.
步骤S2063:对过滤了三角形的动态地图场景进行3D场景体素化,获得动态地图体素数据。Step S2063: Perform 3D scene voxelization on the triangle-filtered dynamic map scene to obtain dynamic map voxel data.
步骤S2064:过滤不在动态区域层的动态区域内的体素。Step S2064: Filter voxels that are not in the dynamic area of the dynamic area layer.
步骤S2065:过滤动态地图体素数据(即过滤了不在动态区域层的动态区域内的体素之后的动态地图体素数据)中的不可行走区域,获得动态地图可走区域体素数据。Step S2065: Filter the unwalkable areas in the dynamic map voxel data (that is, the dynamic map voxel data after filtering the voxels that are not in the dynamic area of the dynamic area layer) to obtain the dynamic map walkable area voxel data.
步骤S2066:简化动态地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据。Step S2066: Simplify the contour lines in the voxel data of the dynamic map traversable area, and obtain the dynamic map traversable area data after the simplified contour lines.
步骤S2067:基于动态地图可走区域数据生成多边形;其中,在该步骤中,可以是基于动态地图可走区域数据,生成只位于动态区域层的动态区域内的多边形。Step S2067: Generate polygons based on the traversable area data of the dynamic map; in this step, polygons located only within the dynamic area of the dynamic area layer may be generated based on the traversable area data of the dynamic map.
步骤S2068:过滤掉不在动态区域层的动态区域内的多边形。Step S2068: Filter out polygons that are not in the dynamic area of the dynamic area layer.
步骤S2069:基于各多边形生成细节网络,并基于细节网络获得动态区域寻路数据。Step S2069: Generate a detail network based on each polygon, and obtain dynamic area pathfinding data based on the detail network.
从而通过将上述多种过滤方式至少执行一种,能够提高最终生成得到的动态区域寻路数据,只有位于动态区域内的寻路数据的可能性。Therefore, by executing at least one of the above multiple filtering methods, it is possible to increase the possibility that the dynamic area pathfinding data finally generated will only contain pathfinding data located within the dynamic area.
步骤S208:建立动态区域层和基础区域层的拼接信息。Step S208: Establish splicing information of the dynamic area layer and the basic area layer.
其中,拼接信息是指动态区域层与基础区域层之间相邻的边界的信息,该拼接信息具体标明了动态区域层的哪个动态区域的哪个多边形的哪条边,与基础区域层的哪个多边形的哪条边可以拼接的信息。例如动态区域层的第一动态区域的第一多边形的第K条边,与基础区域层的第二多边形的第Q条边连接。记录的拼接信息,标识了该线段近似与其他区域相互重合。例如,记录了动态区域层的第一动态区域的第一多边形的第K条边,与基础区域层的第二多边形的第Q条边连接,即代表了第一动态区域的第一多边形的第K条边,与基础区域层的第二多边形的第Q条边近似重合,同时可以记录他们在对应的参考轴上的重叠区域。Among them, the splicing information refers to the information about the adjacent boundary between the dynamic region layer and the base region layer. The splicing information specifically indicates which side of which polygon in which dynamic region of the dynamic region layer is related to which polygon of the base region layer. Information about which edges can be spliced. For example, the K-th side of the first polygon of the first dynamic area of the dynamic area layer is connected to the Q-th side of the second polygon of the base area layer. The recorded splicing information indicates that the line segment approximately overlaps with other areas. For example, it is recorded that the Kth edge of the first polygon of the first dynamic region of the dynamic region layer is connected to the Qth edge of the second polygon of the base region layer, which represents the Kth edge of the first dynamic region. The Kth edge of a polygon approximately coincides with the Qth edge of the second polygon of the basic region layer, and their overlapping areas on the corresponding reference axes can be recorded.
一个实施例中,如图5所示,上述步骤S208中的建立动态区域层和基础区域层的拼接信息,可以包括如下步骤S2018至步骤S2038。In one embodiment, as shown in FIG. 5 , establishing the splicing information of the dynamic area layer and the basic area layer in step S208 may include the following steps S2018 to S2038.
步骤S2018,遍历动态区域层的动态区域寻路数据的动态层边界,动态层边界包括各动态层边界线段。Step S2018: Traverse the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer. The dynamic layer boundary includes each dynamic layer boundary line segment.
其中,遍历动态区域层的动态区域寻路数据的动态层边界,是指遍历动态区域层的所有与基础区域层相邻的多边形的边界。例如,动态区域层中的第一多边形的第H条边、第二多边形的第J条边在该动态区域层的边界,则遍历得到的动态层边界线段,包含该第一多边形的第H条边、第二多边形的第J条边。Wherein, the dynamic layer boundary of the dynamic area pathfinding data that traverses the dynamic area layer refers to the boundaries of all polygons adjacent to the base area layer that traverse the dynamic area layer. For example, if the H-th edge of the first polygon and the J-th edge of the second polygon in the dynamic area layer are at the boundary of the dynamic area layer, then the dynamic layer boundary line segment obtained by traversing includes the first polygon. The Hth side of the polygon and the Jth side of the second polygon.
步骤S2028:查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段。 Step S2028: Find the target base layer boundary line segment in the base area pathfinding data that matches the dynamic layer boundary line segment.
其中,与动态层边界线段匹配的目标基础层边界线段,是指与该动态层边界线段相近,且能够从该动态层边界线段到达该目标基础层边界线段所在区域的基础层边界线段。Wherein, the target base layer boundary line segment matching the dynamic layer boundary line segment refers to the base layer boundary line segment that is close to the dynamic layer boundary line segment and can reach the area where the target base layer boundary line segment is located from the dynamic layer boundary line segment.
步骤S2038:若查找到与动态层边界线段匹配的目标基础层边界线段,建立动态层边界线段与目标基础层边界线段的线段连接关系。Step S2038: If the target base layer boundary line segment matching the dynamic layer boundary line segment is found, establish a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment.
若查找到了与动态层边界线段匹配的目标基础层边界线段,则可以建立动态层边界线段与目标基础层边界线段的线段连接关系,以表明该动态层边界线段与目标基础层边界线段可以拼接。所建立的线段连接关系,可以通过列表或者其他各种可能的方式进行存储。If the target base layer boundary line segment matching the dynamic layer boundary line segment is found, a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment can be established to indicate that the dynamic layer boundary line segment and the target base layer boundary line segment can be spliced. The established line segment connection relationship can be stored in a list or in various other possible ways.
其中,上述动态区域层和基础区域层的拼接信息,包括上述建立的线段连接关系。Among them, the splicing information of the dynamic area layer and the basic area layer includes the line segment connection relationship established above.
一个实施例中,上述步骤S2028中,查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段,具体可以包括:In one embodiment, in the above step S2028, searching for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data may specifically include:
遍历获得基础区域寻路数据的基础层边界,基础层边界包括各基础层边界线段;Traverse to obtain the base layer boundary of the base area pathfinding data. The base layer boundary includes each base layer boundary line segment;
若满足投影条件,确定将动态层边界线段和基础层边界线段投影到目标坐标轴的第一投影重叠区域;If the projection conditions are met, determine the first projection overlap area that projects the dynamic layer boundary line segment and the base layer boundary line segment to the target coordinate axis;
若第一投影重叠区域与第二投影重叠区域不重叠,确定基础层边界线段为匹配的目标基础层边界线段,第二投影重叠区域为将已查找到的已有目标基础层边界线段与动态层边界线段投影到目标坐标轴的重叠区域。If the first projection overlapping area and the second projection overlapping area do not overlap, determine the base layer boundary line segment to be the matching target base layer boundary line segment, and the second projection overlapping area is to combine the found existing target base layer boundary line segment with the dynamic layer The boundary segments are projected onto the overlapping area of the target coordinate axes.
其中,在一个实施例中,可以在动态层边界线段与基础层边界线段的夹角小于夹角阈值时,确定满足投影条件,否则不满足投影条件。In one embodiment, when the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, it can be determined that the projection condition is met, otherwise the projection condition is not met.
其中,目标坐标轴的确定,可以结合动态层边界线段与基础层边界线段与各坐标轴的之间的位置关系确定。Among them, the determination of the target coordinate axis can be determined based on the positional relationship between the dynamic layer boundary line segment and the base layer boundary line segment and each coordinate axis.
一个实施例中,可以在动态层边界线段、基础层边界线段均与第一坐标轴平行时,确定第一坐标轴为目标坐标轴。In one embodiment, when the dynamic layer boundary line segment and the base layer boundary line segment are both parallel to the first coordinate axis, the first coordinate axis may be determined to be the target coordinate axis.
在另一个实施例中,可以在动态层边界线段、基础层边界线段均与第二坐标轴平行时,确定第二坐标轴为目标坐标轴。In another embodiment, when the dynamic layer boundary line segment and the base layer boundary line segment are both parallel to the second coordinate axis, the second coordinate axis may be determined to be the target coordinate axis.
在另一个实施例中,可以在动态层边界线段与基础层边界线段与各坐标轴均不平行,动态层边界线段与基础层边界线段的夹角小于夹角阈值,且动态层边界线段的斜率在预定斜率范围内时,确定第一坐标轴为目标坐标轴。In another embodiment, the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is When the slope is within the predetermined range, the first coordinate axis is determined to be the target coordinate axis.
在另一个实施例中,可以在动态层边界线段与基础层边界线段与各坐标轴均不平行,动态层边界线段与基础层边界线段的夹角小于夹角阈值,且动态层边界线段的斜率在预定斜率范围之外时,确定第二坐标轴为目标坐标轴。In another embodiment, the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and the slope of the dynamic layer boundary line segment is When the slope is outside the predetermined slope range, the second coordinate axis is determined to be the target coordinate axis.
其中,上述各实施例中,动态层边界线段与基础层边界线段与各坐标轴均不平行,可以是指动态层边界线段既不与第一坐标轴平行,也不与第二坐标轴平行,且基础层边界线段既不与第一坐标轴平行,也不与第二坐标轴平行。In the above embodiments, the dynamic layer boundary line segment and the base layer boundary line segment are not parallel to each coordinate axis. This may mean that the dynamic layer boundary line segment is neither parallel to the first coordinate axis nor parallel to the second coordinate axis. And the base layer boundary line segment is neither parallel to the first coordinate axis nor parallel to the second coordinate axis.
在一些实施例中,上述查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段,还可以包括:In some embodiments, the above search for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data may also include:
若第一投影重叠区域与第二投影重叠区域重叠,确定基础层边界线段是否优于已有目标基础层边界线段;If the first projection overlap area overlaps with the second projection overlap area, determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment;
若基础层边界线段优于已有目标基础层边界线段,将已有目标基础层边界线段从已查找到的目标基础层边界线段中删除,并将基础层边界线段确定为匹配的目标基础层边界线段;If the base layer boundary line segment is better than the existing target base layer boundary line segment, delete the existing target base layer boundary line segment from the found target base layer boundary line segments, and determine the base layer boundary line segment as the matching target base layer boundary line segment;
否则,确定基础层边界线段不是匹配的目标基础层边界线段。Otherwise, it is determined that the base layer boundary segment is not a matching target base layer boundary segment.
其中,在确定基础层边界线段是否优于已有目标基础层边界线段时,可以采用任何可能的方式进行。例如,在一个实施例中,若动态层边界线段与基础层边界线段的距离,小于动态层边界线段与已有目标基础层边界线段的距离,或者,动态层边界线段与基础层边界线段的夹角,小于动态层边界线段与已有目标基础层边界线段的夹角,确定基础层边界线段优于已有目 标基础层边界线段,否则确定基础层边界线段没有优于已有目标基础层边界线段。When determining whether the base layer boundary line segment is better than the existing target base layer boundary line segment, any possible method can be used. For example, in one embodiment, if the distance between the dynamic layer boundary line segment and the base layer boundary line segment is less than the distance between the dynamic layer boundary line segment and the existing target base layer boundary line segment, or the distance between the dynamic layer boundary line segment and the base layer boundary line segment is The angle is smaller than the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment. It is determined that the base layer boundary line segment is better than the existing target base layer boundary line segment. Mark the base layer boundary line segment, otherwise it is determined that the base layer boundary line segment is not better than the existing target base layer boundary line segment.
其中,计算动态层边界线段与基础层边界线段的距离的方式,可以采用任何计算线段距离的方式进行,例如通过计算点到线段的距离获得线段之间的距离。计算动态层边界线段与已有目标基础层边界线段的夹角的方式,也可以采用任何计算线段夹角的方式进行,例如通过计算动态层边界线段的线段向量与已有目标基础层边界线段的线段向量的点积,获得夹角。Among them, the method of calculating the distance between the dynamic layer boundary line segment and the base layer boundary line segment can be performed by any method of calculating line segment distance, for example, the distance between line segments is obtained by calculating the distance from a point to a line segment. The method of calculating the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment can also be performed by any method of calculating the angle between the line segments, for example, by calculating the line segment vector of the dynamic layer boundary line segment and the existing target base layer boundary line segment. Dot product of line segment vectors to obtain the included angle.
据此,参考图6所示,一个具体示例中的查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段,具体可以包括:Accordingly, as shown in Figure 6, in a specific example, searching for the target base layer boundary line segment that matches the dynamic layer boundary line segment in the base area pathfinding data may include:
步骤S601:确定基础层边界线段。其中,基础层边界线段是指待进行匹配的基础区域层的边界线段中的其中一个边界线段。Step S601: Determine the base layer boundary line segment. Wherein, the base layer boundary line segment refers to one of the boundary line segments of the base area layer to be matched.
步骤S602:判断是否满足投影条件,若满足投影条件,进入步骤S603,若不满足投影条件,则直接进入步骤S607。确定是否满足投影条件的方式,可以与上述实施例中的方式相同。Step S602: Determine whether the projection condition is met. If the projection condition is met, proceed to step S603. If the projection condition is not met, proceed directly to step S607. The manner of determining whether the projection condition is met may be the same as in the above embodiment.
步骤S603:确定将动态层边界线段和基础层边界线段投影到目标坐标轴的第一投影重叠区域。Step S603: Determine the first projection overlap area that projects the dynamic layer boundary line segment and the base layer boundary line segment to the target coordinate axis.
其中,将动态层边界线段和基础层边界线段投影到目标坐标轴的第一投影重叠区域,是指将动态层边界线段投影到目标坐标轴得到第一投影线段,并将基础层边界线段投影到目标坐标轴得到第二投影线段后,第一投影线段与第二投影线段的相互重叠的线段区域。Wherein, projecting the dynamic layer boundary line segment and the base layer boundary line segment to the first projection overlap area of the target coordinate axis means projecting the dynamic layer boundary line segment to the target coordinate axis to obtain the first projection line segment, and projecting the base layer boundary line segment to After the target coordinate axis obtains the second projection line segment, the mutually overlapping line segment area of the first projection line segment and the second projection line segment.
步骤S604:判断第一投影重叠区域与第二投影重叠区域是否重叠,若重叠,则进入步骤S605,否则,进入步骤S606。Step S604: Determine whether the first projection overlap area and the second projection overlap area overlap. If they overlap, proceed to step S605; otherwise, proceed to step S606.
其中,第二投影重叠区域为将已查找到的已有目标基础层边界线段与动态层边界线段投影到目标坐标轴的重叠区域。已有目标基础层边界线段是指之前已经找到的能够匹配的基础层边界线段,例如假设基础层边界线段包含线段L1、L2、L3……。若在之前的匹配过程中,假设已经确定L1与动态层边界线段不匹配,而线段L2与动态层边界线段匹配,则在将L2加入已查找到的目标基础层边界线段列表中或者通过其他的方式记录后,该L2可作为已有目标基础层边界线段。The second projection overlapping area is an overlapping area where the found existing target base layer boundary line segment and the dynamic layer boundary line segment are projected onto the target coordinate axis. The existing target base layer boundary line segments refer to previously found base layer boundary line segments that can be matched. For example, assume that the base layer boundary line segments include line segments L1, L2, L3.... If in the previous matching process, it is assumed that L1 does not match the dynamic layer boundary line segment, and line segment L2 matches the dynamic layer boundary line segment, then L2 is added to the found target base layer boundary line segment list or through other methods. After the method is recorded, the L2 can be used as the boundary line segment of the existing target base layer.
第二投影重叠区域,是指将动态层边界线段投影到目标坐标轴得到第一投影线段,并将已有目标基础层边界线段到目标坐标轴得到第三投影线段后,第一投影线段与第三投影线段的相互重叠的线段区域。The second projection overlap area refers to projecting the dynamic layer boundary line segment to the target coordinate axis to obtain the first projection line segment, and projecting the existing target base layer boundary line segment to the target coordinate axis to obtain the third projection line segment. Overlapping line segment areas of three projected line segments.
步骤S605:判断基础层边界线段是否优于已有目标基础层边界线段,若是,则进入步骤S606,否则,进入步骤S607。Step S605: Determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment. If so, proceed to step S606; otherwise, proceed to step S607.
若第一投影重叠区域与第二投影重叠区域重叠,则说明当前的基础层边界线段,与已有目标基础层边界线段均可以作为目标基础层边界线段,来实现基础区域层与动态区域层的拼接。然而需要从中选择较优的线段作为最终用来拼接的目标基础层边界线段,因此,需要对基础层边界线段是否优于已有目标基础层边界线段进行分析。具体的方式可以与上述实施例中的方式相同。If the first projection overlap area overlaps with the second projection overlap area, it means that the current base layer boundary line segment and the existing target base layer boundary line segment can be used as the target base layer boundary line segment to realize the connection between the base area layer and the dynamic area layer. splicing. However, a better line segment needs to be selected as the target base layer boundary line segment that is ultimately used for splicing. Therefore, it is necessary to analyze whether the base layer boundary line segment is better than the existing target base layer boundary line segment. The specific manner may be the same as that in the above embodiment.
步骤S606:确定基础层边界线段为匹配的目标基础层边界线段。Step S606: Determine the base layer boundary line segment as the matching target base layer boundary line segment.
其中,在确定基础层边界线段为匹配的目标基础层边界线段之后,若是从步骤S604直接进入S606,即第一投影重叠区域与第二投影重叠区域不重叠,则可以直接将基础层边界线段确定为匹配的目标基础层边界线段,添加到已查找到的目标基础层边界线段列表中。若是从步骤S605进入步骤S606,即在基础层边界线段优于已有目标基础层边界线段时,可以先将该已有目标基础层边界线段从已查找到的目标基础层边界线段列表中删除,然后再将该基础层边界线段添加到已查找到的目标基础层边界线段列表中,也可以是将基础层边界线段添加到已查找到的目标基础层边界线段列表中后,再将该已有目标基础层边界线段从已查找到的目标基础层边界线段列表中删除。Among them, after determining that the base layer boundary line segment is the matching target base layer boundary line segment, if step S604 directly proceeds to S606, that is, the first projection overlap area and the second projection overlap area do not overlap, the base layer boundary line segment can be directly determined. The matching target base layer boundary line segment is added to the list of found target base layer boundary line segments. If step S605 is entered into step S606, that is, when the base layer boundary line segment is better than the existing target base layer boundary line segment, the existing target base layer boundary line segment can be first deleted from the list of found target base layer boundary line segments. Then add the base layer boundary line segment to the found target base layer boundary line segment list, or add the base layer boundary line segment to the found target base layer boundary line segment list, and then add the existing base layer boundary line segment to the found target base layer boundary line segment list. The target base layer boundary segment is deleted from the list of found target base layer boundary segments.
步骤S607:确定基础层边界线段不是匹配的目标基础层边界线段。 Step S607: Determine that the base layer boundary line segment is not a matching target base layer boundary line segment.
应当理解的是,在其他实施例中,若判定第一投影重叠区域与第二投影重叠区域重叠,也可以不对基础层边界线段是否优于已有目标基础层边界线段进行分析,例如直接保留已有目标基础层边界线段,而不将该基础层边界线段添加到已查找到的目标基础层边界线段列表中,再例如直接将已有目标基础层边界线段从已查找到的目标基础层边界线段列表中删除,然后再将该基础层边界线段添加到已查找到的目标基础层边界线段列表中。在其他实施例中,也可以是通过其他方式对基础层边界线段是否优于已有目标基础层边界线段进行分析。It should be understood that in other embodiments, if it is determined that the first projection overlap area overlaps with the second projection overlap area, it is not necessary to analyze whether the base layer boundary line segment is better than the existing target base layer boundary line segment, for example, directly retain the existing target base layer boundary line segment. There is a target base layer boundary line segment without adding the base layer boundary line segment to the found target base layer boundary line segment list. Another example is to directly add the existing target base layer boundary line segment from the found target base layer boundary line segment. Delete it from the list, and then add the base layer boundary segment to the list of found target base layer boundary segments. In other embodiments, other methods may also be used to analyze whether the base layer boundary line segment is better than the existing target base layer boundary line segment.
图7中示出了动态层边界线段与基础层边界线段之间的线段关系的一些示例。Some examples of line segment relationships between dynamic layer boundary line segments and base layer boundary line segments are shown in FIG. 7 .
如图7所示,假设图7中的虚线线段为动态层边界线段,实线线段为基础层边界线段。当然也可以是虚线线段为基础层边界线段,实线线段为动态层边界线段。如图7所示,在701的情形中,动态层边界线段与基础层边界线段相交(例如两条线段的四个点近似在一条直线上,两条线段相交为X形,两个线段相交为T形,两个线段相交为∧形,其中有两点重合),且夹角小于夹角阈值(例如35度),则该基础层边界线段必然是动态层边界线段的目标基础层边界线段。在702所示的情形中,动态层边界线段与基础层边界线段的夹角过大,或者动态层边界线段与基础层边界线段二者投影后不存在覆盖区域,则该基础层边界线段必然不是动态层边界线段的目标基础层边界线段。而在703所示的情形中,动态层边界线段与基础层边界线段的夹角小于夹角阈值,且动态层边界线段与基础层边界线段二者投影后存在覆盖区域,则需要进一步结合两条线段之间的距离等做进一步的分析,才能确定基础层边界线段是否为动态层边界线段的目标基础层边界线段。As shown in Figure 7, it is assumed that the dotted line segment in Figure 7 is the dynamic layer boundary segment and the solid line segment is the base layer boundary segment. Of course, the dotted line segment can also be the base layer boundary segment, and the solid line segment can be the dynamic layer boundary segment. As shown in Figure 7, in the case of 701, the dynamic layer boundary line segment intersects with the base layer boundary line segment (for example, the four points of the two line segments are approximately on a straight line, the intersection of the two line segments is an X shape, and the intersection of the two line segments is T-shaped, two line segments intersect to form a ∧ shape (two points overlap), and the angle is less than the angle threshold (for example, 35 degrees), then the base layer boundary line segment must be the target base layer boundary line segment of the dynamic layer boundary line segment. In the situation shown in 702, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is too large, or there is no coverage area after projection of the dynamic layer boundary line segment and the base layer boundary line segment, then the base layer boundary line segment must not be The target base layer boundary segment for the dynamic layer boundary segment. In the situation shown in 703, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is less than the angle threshold, and there is a coverage area after projection of the dynamic layer boundary line segment and the base layer boundary line segment, so it is necessary to further combine the two Only by further analyzing the distance between the line segments can it be determined whether the base layer boundary line segment is the target base layer boundary line segment of the dynamic layer boundary line segment.
基于上述实施例的说明可以确定,在本申请实施例中,匹配的目标基础层边界线段与动态层边界线段之间,应当满足以下条件:目标基础层边界线段与动态层边界线段之间的线段距离足够小(小于预定距离阈值)、目标基础层边界线段与动态层边界线段之间的线段角度足够小(小于夹角阈值)、目标基础层边界线段与动态层边界线段在水平面的主要轴(上述第一坐标轴或第二坐标轴)上有重叠部分(即上述第一重叠区域不为空)、目标基础层边界线段与动态层边界线段的线段高度小于可以上的台阶高度(可预先配置),其中,该线段高度具体可以是指将目标基础层边界线段投影到第三坐标轴得到投影线段一、并将动态层边界线段投影到第三坐标轴得到投影线段二后,投影线段一与投影线段二的高度差。Based on the description of the above embodiments, it can be determined that in the embodiment of the present application, the following conditions should be met between the matching target base layer boundary line segment and the dynamic layer boundary line segment: the line segment between the target base layer boundary line segment and the dynamic layer boundary line segment The distance is small enough (less than the predetermined distance threshold), the angle between the target base layer boundary line segment and the dynamic layer boundary line segment is small enough (less than the angle threshold), the main axis of the target base layer boundary line segment and the dynamic layer boundary line segment on the horizontal plane ( There is an overlapping portion on the above-mentioned first coordinate axis or second coordinate axis (that is, the above-mentioned first overlapping area is not empty), and the height of the target base layer boundary line segment and the dynamic layer boundary line segment is less than the height of the step that can be climbed (can be pre-configured). ), where the height of the line segment specifically refers to projecting the target base layer boundary line segment to the third coordinate axis to obtain projection line segment one, and projecting the dynamic layer boundary line segment to the third coordinate axis to obtain projection line segment two, and then projecting line segment one and The height difference of projected line segment two.
步骤S210:基于基础区域寻路数据、动态区域寻路数据和拼接信息,生成目标场景的寻路数据。Step S210: Generate pathfinding data of the target scene based on basic area pathfinding data, dynamic area pathfinding data and splicing information.
其中,在一个实施例中,可以将基础区域寻路数据、动态区域寻路数据和拼接信息进行汇总,以生成目标场景的寻路数据。即生成的目标场景的寻路数据,包括基础区域寻路数据、动态区域寻路数据和拼接信息。Among them, in one embodiment, basic area pathfinding data, dynamic area pathfinding data and splicing information can be summarized to generate pathfinding data of the target scene. That is, the generated pathfinding data of the target scene includes basic area pathfinding data, dynamic area pathfinding data and splicing information.
一些实施例中,生成的目标场景的寻路数据,还可以包括动态区域层标识、动态区域标记以及区域形状标识中的一种或多种,用以分别标识各动态区域层、动态区域以及动态区域形状。应当理解的是,在一些具体示例中,这些动态区域层标识、动态区域标记或者区域形状标识也可以直接包含在上述动态区域寻路数据中。In some embodiments, the generated pathfinding data of the target scene may also include one or more of a dynamic area layer identifier, a dynamic area mark, and an area shape identifier to respectively identify each dynamic area layer, dynamic area, and dynamic area. Area shape. It should be understood that in some specific examples, these dynamic area layer identifiers, dynamic area markers or area shape identifiers can also be directly included in the above-mentioned dynamic area pathfinding data.
参考图8所示,在另一个实施例的寻路数据的生成过程中,在上述步骤S204的生成基础区域寻路数据之后,还可以包括:Referring to FIG. 8 , in another embodiment of the pathfinding data generation process, after the basic area pathfinding data is generated in step S204 above, it may also include:
步骤S205:记录基础区域层与动态区域的边界的第一边界信息。Step S205: Record the first boundary information of the boundary between the base area layer and the dynamic area.
从而,生成基础区域寻路数据之后,可直接记录基础区域层与动态区域的边界的第一边界信息,便于在后续建立动态区域层和基础区域层的拼接信息时,无需再针对基础区域寻路数据重新进行查找,即可直接基于记录的基础区域寻路数据的第一边界信息,建立拼接信息,以提高建立拼接信息的效率。其中,记录的基础区域层与动态区域的边界的第一边界信息,可以包含在基础区域寻路数据中,或者从基础区域寻路数据中提取获得。Therefore, after the basic area pathfinding data is generated, the first boundary information of the boundary between the basic area layer and the dynamic area can be directly recorded, so that when the splicing information of the dynamic area layer and the basic area layer is subsequently established, there is no need to search for the basic area. By re-searching the data, the splicing information can be established directly based on the first boundary information of the recorded basic area pathfinding data to improve the efficiency of establishing splicing information. The recorded first boundary information of the boundary between the basic area layer and the dynamic area may be included in the basic area pathfinding data, or may be extracted from the basic area pathfinding data.
其中,记录的第一边界信息,具体可以是该基础区域层的哪个多边形、以及该多边形的哪 条边位于与动态区域层相邻的边界,即记录的第一边界信息,具体可以包含多边形标识以及多边形的边的标识,其中,多边形标识以及多边形的边的标识可以同时包含在同一个信息中,也可以以不同的信息表示。The recorded first boundary information may specifically be which polygon of the base area layer and which part of the polygon. The edge is located at the boundary adjacent to the dynamic area layer, that is, the first boundary information recorded. Specifically, it may include the polygon identifier and the identifier of the polygon's side. The polygon identifier and the identifier of the polygon's side may be included in the same information at the same time. , can also be represented by different information.
参考图8所示,在另一个实施例的寻路数据的生成过程中,在上述步骤S206的生成动态区域寻路数据之后,还可以包括:Referring to FIG. 8 , in another embodiment of the pathfinding data generation process, after the dynamic area pathfinding data is generated in the above step S206, it may also include:
步骤S207:记录动态区域层的所述动态区域与基础区域边界的第二边界信息。Step S207: Record the second boundary information of the boundary between the dynamic area and the basic area of the dynamic area layer.
从而,生成动态区域寻路数据之后,可直接记录该动态区域层的动态区域与基础区域边界的第二边界信息,便于在后续建立动态区域层和基础区域层的拼接信息时,无需再针对动态区域寻路数据重新进行查找,即可直接基于记录的第二边界信息,建立拼接信息,以提高建立拼接信息的效率。其中,记录的第二边界信息,可以包含在动态区域寻路数据中,或者从动态区域寻路数据中提取获得。Therefore, after the dynamic area pathfinding data is generated, the second boundary information of the dynamic area and the basic area boundary of the dynamic area layer can be directly recorded, so that when the splicing information of the dynamic area layer and the basic area layer is subsequently established, there is no need to target the dynamic area. By re-searching the regional pathfinding data, splicing information can be established directly based on the recorded second boundary information, thereby improving the efficiency of establishing splicing information. The recorded second boundary information may be included in the dynamic area pathfinding data, or may be extracted from the dynamic area pathfinding data.
其中,记录的第二边界信息,具体可以是该动态区域层的动态区域的哪个多边形、以及该多边形的哪条边位于与基础区域层相邻的边界,即记录的第二边界信息,具体可以包含多边形标识以及多边形的边的标识,其中,多边形标识以及多边形的边的标识可以同时包含在同一个信息中,也可以以不同的信息表示。The recorded second boundary information may specifically be which polygon of the dynamic area of the dynamic area layer and which side of the polygon is located at the boundary adjacent to the base area layer, that is, the recorded second boundary information. Specifically, it may be Contains polygon identifiers and polygon side identifiers, where the polygon identifier and polygon side identifiers may be included in the same information at the same time, or may be represented by different information.
此时,上述步骤S208的建立动态区域层和基础区域层的拼接信息,具体可以包括如图8所示的步骤S2081。At this time, the above-mentioned step S208 of establishing the splicing information of the dynamic area layer and the basic area layer may specifically include step S2081 as shown in FIG. 8 .
步骤S2081:根据第一边界信息和第二边界信息,建立动态区域层和基础区域层的拼接信息。Step S2081: Establish splicing information of the dynamic region layer and the basic region layer based on the first boundary information and the second boundary information.
此时,在上述步骤S2018中的遍历动态区域层的动态区域寻路数据的动态层边界,具体可以包括:在第二边界信息中,遍历动态区域层的动态区域寻路数据的动态层边界。At this time, traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer in the above step S2018 may specifically include: traversing the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer in the second boundary information.
相应的,在此情况下,在上述步骤S2028中的查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段,具体可以包括:在第一边界信息中,查找与动态层边界线段匹配的目标基础层边界线段。Correspondingly, in this case, searching for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data in the above step S2028 may specifically include: in the first boundary information, searching for the target base layer boundary line segment that matches the dynamic layer boundary line segment. The target base layer boundary segment to which the line segment matches.
从而,通过在生成基础区域寻路数据后,记录基础区域寻路数据的第一边界信息,并且在生成动态区域寻路数据后,记录动态区域寻路数据的第二边界信息,使得在需要建立动态区域层和基础区域层的拼接信息时,可以直接查找记录的第一边界信息和第二边界信息即可建立,而无需再针对全部的基础区域寻路数据和动态区域寻路数据再重新查找它们各自的边界,提高建立动态区域层和基础区域层的拼接信息的效率,同时提高生成寻路数据的生成效率。Therefore, after the basic area pathfinding data is generated, the first boundary information of the basic area pathfinding data is recorded, and after the dynamic area pathfinding data is generated, the second boundary information of the dynamic area pathfinding data is recorded, so that when it is necessary to establish When splicing information between the dynamic area layer and the basic area layer, you can directly search for the recorded first boundary information and second boundary information to establish, without having to search again for all the basic area pathfinding data and dynamic area pathfinding data. Their respective boundaries improve the efficiency of establishing the splicing information of the dynamic area layer and the basic area layer, and at the same time improve the efficiency of generating pathfinding data.
应当理解的是,在一些实施例中,可以只在上述步骤S204的生成基础区域寻路数据之后,记录基础区域寻路数据的第一边界信息,也可以只在上述步骤S206的生成动态区域寻路数据之后,记录动态区域寻路数据的第二边界信息。其中,在本申请的具体示例中,生成基础区域寻路数据之后,记录基础区域寻路数据的第一边界信息的过程,以及生成动态区域寻路数据之后记录动态区域寻路数据的第二边界信息的过程,可以均进行,即第一边界信息和第二边界信息均进行记录。It should be understood that in some embodiments, the first boundary information of the basic area pathfinding data may be recorded only after the basic area pathfinding data is generated in the above step S204, or the first boundary information of the basic area pathfinding data may be recorded only after the dynamic area pathfinding data is generated in the above step S206. After the path data, the second boundary information of the dynamic area path finding data is recorded. Among them, in the specific example of the present application, after generating the basic area path finding data, the process of recording the first boundary information of the basic area path finding data, and after generating the dynamic area path finding data, recording the second boundary of the dynamic area path finding data. The information process can be performed simultaneously, that is, both the first boundary information and the second boundary information are recorded.
基于如上所述的实施例,参考图9所示,一个实施例中生成动态多层的一个区域层的区域寻路数据并记录其边界信息的方式,可以包括如下步骤S901至步骤S911。其中,该区域层可以是静态区域层,也可以是动态区域层。Based on the embodiments described above, with reference to FIG. 9 , in one embodiment, the method of generating area pathfinding data of a regional layer in a dynamic multi-layer and recording its boundary information may include the following steps S901 to S911. The regional layer may be a static regional layer or a dynamic regional layer.
步骤S901:输入区域层的场景数据,该区域层的场景数据包括:地图场景。Step S901: Input the scene data of the regional layer. The scene data of the regional layer includes: a map scene.
步骤S902:判断是否需要进行分块处理。若否,则进入步骤S903,若是,则进入步骤S905。Step S902: Determine whether block processing is required. If not, go to step S903; if yes, go to step S905.
其中,可以根据各种可能的规则来判断是否需要进行分块处理,例如根据设定的分块大小、以及地图场景的大小来判断是否需要进行分块处理,该设定的分块大小可以是预先在配置文件中配置的。以根据设定的分块大小判断是否需要进行分块处理为例,可以是若地图场景的地图大小大于该设定的分块大小,则判定需要进行分块处理,否则,判定不需要进行分块处理。 Among them, whether block processing is needed can be determined based on various possible rules. For example, whether block processing is needed can be determined based on the set block size and the size of the map scene. The set block size can be Pre-configured in the configuration file. Taking the judgment of whether block processing is required based on the set block size as an example, if the map size of the map scene is larger than the set block size, it is determined that block processing is required; otherwise, it is determined that block processing is not required. Block processing.
步骤S903:将整个地图场景作为一个地图分块。Step S903: Divide the entire map scene into one map block.
步骤S904:针对地图分块生成区域寻路数据,并进入步骤S909。其中,针对地图分块生成区域寻路数据的方式,可以与上述实施例中提及的方式相同。Step S904: Generate regional pathfinding data for map blocks, and enter step S909. The method of generating regional pathfinding data for map tiles may be the same as the method mentioned in the above embodiment.
步骤S905:将地图场景划分为多个地图分块。Step S905: Divide the map scene into multiple map blocks.
其中,具体对地图场景划分分块的方式,可以采用任何可能的方式进行。例如,根据预先配置的分块大小,将地图场景划分为多个地图分块,即将地图场景划分为大小均为预先配置的分块大小的各地图分块。Among them, any possible method can be used to divide the map scene into blocks. For example, the map scene is divided into multiple map tiles according to the preconfigured tile size, that is, the map scene is divided into map tiles whose size is the preconfigured tile size.
步骤S906:针对地图分块生成分块区域寻路数据。针对地图分块生成分块区域寻路数据的方式,可以与上述实施例中提及的方式相同。Step S906: Generate block area pathfinding data for map blocks. The method of generating block area pathfinding data for map blocks may be the same as the method mentioned in the above embodiment.
步骤S907:判断是否还有未处理的地图分块,若是,则针对下一个尚未处理的地图分块,返回步骤S906。若否,则进入步骤S908。Step S907: Determine whether there are still unprocessed map blocks. If so, return to step S906 for the next unprocessed map block. If not, proceed to step S908.
步骤S908:建立各地图分块对应的各分块区域寻路数据的连接关系,并进入步骤S909。具体的建立连接关系的方式,可以采用任何可用的建立连接方式,例如可以基于开源的navmesh(一种开源的寻路库生成的寻路数据)库提供的各个地图分块的拼接关系。Step S908: Establish a connection relationship between the pathfinding data of each block area corresponding to each map block, and enter step S909. The specific way to establish a connection relationship can be any available connection establishment method, for example, it can be based on the splicing relationship of each map block provided by the open source navmesh (a pathfinding data generated by an open source pathfinding library) library.
步骤S909:获得该区域层的区域寻路数据。Step S909: Obtain the regional pathfinding data of the regional layer.
其中,可以理解的是,若未对地图场景进行分块,即将整个地图场景作为一个地图分块,则获得的区域寻路数据包含的是直接对该地图分块生成的区域寻路数据。若对地图场景进行了分块,则获得的区域寻路数据包含的是:各地图分块对应的分块区域寻路数据以及各分块区域寻路数据的连接关系。Among them, it can be understood that if the map scene is not divided into blocks, that is, the entire map scene is divided into one map block, then the obtained regional pathfinding data includes the regional pathfinding data generated directly from the map block. If the map scene is divided into blocks, the obtained area pathfinding data includes: the block area pathfinding data corresponding to each map block and the connection relationship between the block area pathfinding data.
此外,应当说明的是,该区域层可以是基础区域层,也可以是动态区域层。若该区域层是基础区域层,则获得的区域寻路数据是基础区域寻路数据。若该区域层是动态区域层,则获得的区域寻路数据是该动态区域层的动态区域寻路数据。In addition, it should be noted that the area layer may be a basic area layer or a dynamic area layer. If the area layer is a basic area layer, the obtained area pathfinding data is basic area pathfinding data. If the area layer is a dynamic area layer, the obtained area pathfinding data is the dynamic area pathfinding data of the dynamic area layer.
步骤S910:判断是否存在目标区域层,若有,则进入步骤S911,若否,则结束针对该区域层的寻路数据的生成过程。Step S910: Determine whether there is a target area layer. If so, proceed to step S911. If not, end the pathfinding data generation process for the area layer.
其中,目标区域层,是指有物体动态变化的动态区域层。比如存在动态区域层C1、C2、C3、C4。则生成该层的navmesh的时候就可以认为存在目标区域层。Among them, the target area layer refers to the dynamic area layer with dynamic changes in objects. For example, there are dynamic area layers C1, C2, C3, and C4. Then when generating the navmesh of this layer, it can be considered that there is a target area layer.
其中,目标区域层的确定方式,可以结合实际技术需要进行设定。Among them, the determination method of the target area layer can be set based on actual technical needs.
例如,在一些实施例中,在本申请实施例的寻路数据的生成方法,是应用于离线生成寻路数据的场景时,可以直接判断是否存在动态区域层,即判断是否存在目标区域层,具体可以是判断是否存在动态区域层,若存在动态区域层,则可以直接判定有目标区域层,而无需关心该区域层是动态区域层的情况下该动态区域层是否有开启。从而通过对所有的区域层都事先生成区域寻路数据,并且记录对应的边界信息,有利于在离线运行时,可以直接对已生成的数据进行运用。For example, in some embodiments, when the pathfinding data generation method in the embodiment of the present application is applied to the scenario of generating pathfinding data offline, it can be directly determined whether there is a dynamic area layer, that is, whether there is a target area layer, Specifically, it can be determined whether a dynamic area layer exists. If a dynamic area layer exists, it can be directly determined that there is a target area layer, without caring about whether the dynamic area layer is turned on when the area layer is a dynamic area layer. Therefore, by generating regional pathfinding data for all regional layers in advance and recording the corresponding boundary information, it is beneficial to directly use the generated data during offline operation.
在另一些实施例中,若本申请实施例的寻路数据的生成方法,是应用于实时在线游戏的在线生成寻路数据的场景时,则可以判断是否有动态区域层,以及该动态区域层的动态区域是否开启,即上述判断存在目标区域层,具体可以是判断是否存在开启了动态区域的动态区域层,若有开启了动态区域层的动态区域层,则确定存在目标区域层,且将开启的动态区域层确定为目标区域层。其中,动态区域层开启,是指该动态区域层处于启用状态。其具体可以由开发人员设定,以游戏场景为例,也可以是基于游戏场景的变化、游戏进度的变化,自动触发相应的动态区域层的开启。In other embodiments, if the method for generating pathfinding data in the embodiment of the present application is applied to a scenario where pathfinding data is generated online in a real-time online game, it can be determined whether there is a dynamic area layer and the dynamic area layer. Whether the dynamic area of is turned on, that is, the above judgment indicates that there is a target area layer. Specifically, it can be judged whether there is a dynamic area layer with the dynamic area turned on. If there is a dynamic area layer with the dynamic area layer turned on, it is determined that the target area layer exists, and the The enabled dynamic area layer is determined as the target area layer. Among them, the dynamic area layer is turned on, which means that the dynamic area layer is enabled. It can be specifically set by the developer, taking the game scene as an example, or it can automatically trigger the opening of the corresponding dynamic area layer based on changes in the game scene and game progress.
步骤S911:记录该区域层的区域寻路数据的边界信息,然后,结束针对该区域层的寻路数据的生成过程,同时可进入对下一个区域层的寻路数据的生成过程。应当理解的是,若该区域层为基础区域层,则记录的边界信息为如上所述的第一边界信息,若该区域层为动态区域层,则记录的边界信息为如上所述的第二边界信息。具体记录边界信息的方式,与上述实施例中提 及的方式相同。Step S911: Record the boundary information of the regional pathfinding data of the regional layer, then end the generation process of the pathfinding data of the regional layer, and at the same time, enter the generation process of the pathfinding data of the next regional layer. It should be understood that if the area layer is a basic area layer, the recorded boundary information is the first boundary information as mentioned above; if the area layer is a dynamic area layer, the recorded boundary information is the second boundary information as mentioned above. Boundary information. The specific way of recording boundary information is the same as that mentioned in the above embodiment. and in the same way.
其中,在上述区域层为动态区域层时,可以分别针对各个动态区域层分别执行寻路数据的生成过程。具体地,基于如上所述的实施例,参考图10所示,一个实施例中的针对动态多层的动态区域层的一个动态区域,对该动态区域生成动态区域寻路数据并记录其边界信息的方式,可以是针对动态区域层的该动态区域的地图场景,先按照如上的方式判断是否需要对该地图区域进行分块处理,若不需要分块处理,则将该动态区域层的动态区域的整个地图场景作为一个地图分块。若需要进行分块处理,则对该动态区域层的整个地图场景进行分块处理,获得各地图分块。然后执行下述步骤S1001至步骤S1014。Wherein, when the above-mentioned area layer is a dynamic area layer, the pathfinding data generation process can be performed separately for each dynamic area layer. Specifically, based on the embodiments described above, with reference to FIG. 10 , in one embodiment, for a dynamic region of a dynamic multi-layer dynamic region layer, dynamic region pathfinding data is generated for the dynamic region and its boundary information is recorded. The method can be to target the map scene of the dynamic area in the dynamic area layer. First, determine whether the map area needs to be divided into blocks according to the above method. If block processing is not required, then the dynamic area of the dynamic area layer will be processed into blocks. The entire map scene is divided into one map tile. If block processing is required, block processing is performed on the entire map scene of the dynamic area layer to obtain each map block. Then the following steps S1001 to S1014 are executed.
步骤S1001:加载动态区域层的一个地图分块的动态地图场景。可以理解的是,在上述未执行分块处理的情况下,加载的该地图分块的动态地图场景是该动态区域层的整个地图场景,在进行了分块处理的情况下,加载的该地图分块的动态地图场景,是其中一个地图分块的地图场景。Step S1001: Load a dynamic map scene of a map block in the dynamic area layer. It can be understood that, in the above case where the blocking process is not performed, the loaded dynamic map scene of the map block is the entire map scene of the dynamic area layer. In the case of the block processing, the loaded map scene A tiled dynamic map scene is a map scene of one of the map tiles.
步骤S1002:过滤不在动态区域内的三角形。具体的过滤方式可以采用已有的过滤动态区域内的三角形的方式进行。Step S1002: Filter triangles that are not in the dynamic area. The specific filtering method can be carried out by using the existing method of filtering triangles in the dynamic area.
步骤S1003:对过滤了三角形的动态地图场景进行3D场景体素化,获得动态地图体素数据。其中,具体的3D场景体素化的方式可以采用已有的3D场景体素化方式进行。Step S1003: Perform 3D scene voxelization on the triangle-filtered dynamic map scene to obtain dynamic map voxel data. Among them, the specific 3D scene voxelization method can be performed using the existing 3D scene voxelization method.
步骤S1004:过滤不在动态区域内的体素。具体的过滤方式可以采用已有的过滤体素的方式进行。Step S1004: Filter voxels that are not in the dynamic area. The specific filtering method can be carried out by using the existing voxel filtering method.
步骤S1005:过滤动态地图体素数据(即过滤了不在动态区域内的体素之后的动态层的地图体素数据)中的不可行走区域,获得动态地图可走区域体素数据。其中,过滤不可行走区域的方式,可以采用已有的方式进行。Step S1005: Filter the unwalkable areas in the dynamic map voxel data (that is, the map voxel data of the dynamic layer after filtering the voxels that are not in the dynamic area) to obtain the dynamic map walkable area voxel data. Among them, existing methods can be used to filter unwalkable areas.
步骤S1006:简化动态地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据。其中,简化轮廓线的方式可以采用已有的简化轮廓线的方式进行。Step S1006: Simplify the contour lines in the voxel data of the dynamic map traversable area, and obtain the dynamic map traversable area data after the simplified contour lines. Among them, the method of simplifying the contour lines can be carried out by using the existing method of simplifying the contour lines.
步骤S1007:基于动态地图可走区域数据生成多边形;其中,在该步骤中,若执行了上述步骤S1002、或者S1004,或者是后续会执行步骤S1008,则此时可以直接针对动态地图可走区域数据生成多边形,也可以基于动态地图可走区域数据,生成只位于动态区域层的动态区域内的多边形。若上述步骤S1002、步骤S1004、步骤S1008均不会执行,则此时需要基于动态地图可走区域数据,生成只位于动态区域层的动态区域内的多边形。也就是说只生成动态区域层的动态区域内的多边形与S1002、S1004、S1008至少有一个需要执行。Step S1007: Generate polygons based on the dynamic map walkable area data; in this step, if the above step S1002 or S1004 is executed, or step S1008 will be executed subsequently, then the dynamic map walkable area data can be directly targeted at this time To generate polygons, you can also generate polygons that are only located in the dynamic area of the dynamic area layer based on the traversable area data of the dynamic map. If none of the above steps S1002, S1004, and S1008 are executed, then it is necessary to generate polygons that are only located in the dynamic area of the dynamic area layer based on the dynamic map walkable area data. That is to say, only the polygons in the dynamic area of the dynamic area layer and at least one of S1002, S1004, and S1008 need to be executed.
步骤S1008:过滤掉不在动态区域层的动态区域内的多边形。Step S1008: Filter out polygons that are not in the dynamic area of the dynamic area layer.
步骤S1009:基于各多边形生成细节网络,并基于细节网络获得该地图分块的分块区域寻路数据。其中,基于多边形生成细节网络的方式,可以采用已有的方式进行,本申请实施例不做具体限定。Step S1009: Generate a detail network based on each polygon, and obtain block area pathfinding data of the map block based on the detail network. Among them, the method of generating a detail network based on polygons can be carried out in an existing manner, and is not specifically limited in the embodiments of this application.
步骤S1010:判断是否还有未处理的地图分块,则是,则针对下一个尚未处理的地图分块,返回步骤S1001。若否,则进入步骤S1011。Step S1010: Determine whether there are still unprocessed map tiles. If so, return to step S1001 for the next unprocessed map tile. If not, proceed to step S1011.
步骤S1011:建立各地图分块对应的各分块区域寻路数据的连接关系,并进入步骤S1012。Step S1011: Establish a connection relationship between the pathfinding data of each block area corresponding to each map block, and enter step S1012.
步骤S1012:获得动态区域寻路数据。Step S1012: Obtain dynamic area pathfinding data.
可以理解的是,若未对动态区域的地图场景进行分块,则获得的动态区域寻路数据包含的是直接对动态区域的地图场景生成的寻路数据。若对动态区域的地图场景进行了分块,则获得的动态区域寻路数据包含的是:各地图分块对应的分块区域寻路数据以及各分块区域寻路数据的连接关系。It can be understood that if the dynamic area map scene is not divided into blocks, the obtained dynamic area pathfinding data includes pathfinding data directly generated for the dynamic area map scene. If the map scene of the dynamic area is divided into blocks, the obtained dynamic area pathfinding data includes: the block area pathfinding data corresponding to each map block and the connection relationship of the block area pathfinding data.
步骤S1013:记录动态区域寻路数据的边界信息。Step S1013: Record the boundary information of the dynamic area pathfinding data.
其中,记录边界信息的方式,与上述实施例中提及的方式相同。The method of recording boundary information is the same as the method mentioned in the above embodiment.
步骤S1014:建立动态区域层和基础区域层的拼接信息,然后,结束针对该动态区域层的 寻路数据的生成过程。Step S1014: Establish the splicing information of the dynamic area layer and the basic area layer, and then end the processing of the dynamic area layer. The generation process of pathfinding data.
其中,建立动态区域层和基础区域层的拼接信息的方式,与上述实施例中提及的方式相同。The method of establishing the splicing information of the dynamic area layer and the basic area layer is the same as the method mentioned in the above embodiment.
基于如上的实施例,以下结合一个生成寻路数据的过程的应用示例进行详细举例说明。Based on the above embodiments, a detailed description will be given below with an application example of a process of generating pathfinding data.
参考图11所示,一个具体应用示例中的生成寻路数据的过程包括以下步骤S1101至步骤S1108。Referring to FIG. 11 , the process of generating pathfinding data in a specific application example includes the following steps S1101 to S1108.
步骤S1101:确定目标场景中的动态区域,并为各动态区域添加动态区域标记,确定各动态区域所属的动态区域层。Step S1101: Determine the dynamic areas in the target scene, add dynamic area tags to each dynamic area, and determine the dynamic area layer to which each dynamic area belongs.
步骤S1102:加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据。Step S1102: Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data.
步骤S1103:记录基础区域寻路数据的第一边界信息。Step S1103: Record the first boundary information of the basic area pathfinding data.
步骤S1104:确定是否有其他的动态区域层,即是否有尚未生成寻路数据的动态区域层,若有,则进入步骤S1105,否则,进入步骤S1108。Step S1104: Determine whether there are other dynamic area layers, that is, whether there are dynamic area layers for which pathfinding data has not been generated. If so, proceed to step S1105; otherwise, proceed to step S1108.
步骤S1105:加载下一个动态区域层的数据,生成动态区域层的动态区域内的动态区域寻路数据。Step S1105: Load the data of the next dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer.
步骤S1106:记录动态区域寻路数据的第二边界信息。Step S1106: Record the second boundary information of the dynamic area pathfinding data.
步骤S1107:根据第一边界信息和第二边界信息,建立动态区域层和基础区域层的拼接信息,并返回上述步骤S1104。Step S1107: Based on the first boundary information and the second boundary information, establish the splicing information of the dynamic area layer and the basic area layer, and return to the above step S1104.
步骤S1108,导出基础区域寻路数据、动态区域寻路数据、拼接信息,获得目标场景的寻路数据。其中,动态区域寻路数据包括各个动态区域层的动态区域的动态区域寻路数据,拼接信息包括各个动态区域层分别与基础区域层进行拼接的拼接信息。Step S1108: Derive basic area pathfinding data, dynamic area pathfinding data, and splicing information to obtain pathfinding data of the target scene. The dynamic area pathfinding data includes dynamic area pathfinding data of dynamic areas of each dynamic area layer, and the splicing information includes splicing information of each dynamic area layer and the basic area layer respectively.
基于如上所述的实施例,以具体示例中生成基础区域层的寻路数据的示意图如图12所示,生成的一个动态区域层的寻路数据如图13所示,将基础区域层的寻路数据和动态区域层的寻路数据拼接融合后获得的寻路数据如图14所示。在图12、13、14所示中,黑色线段表示区域边界,虚线线段表示生成的寻路数据中生成的多边形的线段,应当理解的是,最终获得的寻路数据的各多边形中,多边形的边,既可能是各区域(物体、静态区域和动态区域)的边界线段,也可能是在划分多边形的过程中确定的线段。图12中的点划线线段围成的区域是动态区域层的一个动态区域,结合图12、图13可见,在生成静态区域层的寻路数据时,对动态区域层的动态区域并不处理,动态区域的边界用以辅助确定静态区域层的边界线段。在生成动态区域层的动态区域的寻路数据时,只针对该动态区域中的可行走区域采用上述方式获得各多边形。图14中的双向箭头,表示对应的静态区域层的多边形与动态区域的多边形邻接。Based on the above embodiments, a schematic diagram of generating pathfinding data of the basic area layer in a specific example is shown in Figure 12. The generated pathfinding data of a dynamic area layer is shown in Figure 13. The pathfinding data of the basic area layer is The pathfinding data obtained after splicing and merging the pathfinding data of the path data and the pathfinding data of the dynamic area layer is shown in Figure 14. As shown in Figures 12, 13, and 14, the black line segments represent the area boundaries, and the dotted line segments represent the line segments of the polygons generated in the generated pathfinding data. It should be understood that among the polygons of the ultimately obtained pathfinding data, the The edge may be the boundary line segment of each area (object, static area and dynamic area), or it may be the line segment determined in the process of dividing the polygon. The area enclosed by the dotted line segment in Figure 12 is a dynamic area of the dynamic area layer. Combining Figures 12 and 13, it can be seen that when generating the pathfinding data of the static area layer, the dynamic area of the dynamic area layer is not processed. , the boundary of the dynamic area is used to assist in determining the boundary line segment of the static area layer. When generating the pathfinding data of the dynamic area of the dynamic area layer, each polygon is obtained using the above method only for the walkable area in the dynamic area. The two-way arrows in Figure 14 indicate that the polygons of the corresponding static area layer are adjacent to the polygons of the dynamic area.
一个实施例中,如图15所示,提供了一种寻路方法,以该方法应用于图1中的终端102或服务器104为例进行说明,包括以下步骤S1501至S1503。In one embodiment, as shown in Figure 15, a pathfinding method is provided. This method is explained by taking the method applied to the terminal 102 or the server 104 in Figure 1 as an example, including the following steps S1501 to S1503.
步骤S1501:加载寻路数据,寻路数据包括目标寻路数据,目标寻路数据包括:基础区域层的基础区域寻路数据,以及标记为开启的动态区域层的动态区域寻路数据。Step S1501: Load pathfinding data. The pathfinding data includes target pathfinding data. The target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on.
其中,目标寻路数据是在寻路过程中需要使用到的寻路数据,是用以支持寻路过程的资源。寻路数据的生成过程可以如上述各实施例中提及的方式。Among them, the target pathfinding data is the pathfinding data that needs to be used in the pathfinding process, and is a resource used to support the pathfinding process. The pathfinding data generation process can be as mentioned in the above embodiments.
其中,依据上述寻路数据的生成方式生成得到的寻路数据,在具体的寻路过程中,可能需要使用到全部的寻路数据,也可能是只需要使用到部分寻路数据,本申请实施例中,将此次寻路过程中需要使用到的寻路数据称之为目标寻路数据。其中,该目标寻路数据,必然包含基础区域层的基础区域寻路数据,同时还包含标记为开启的动态区域层的动态区域寻路数据。Among them, the pathfinding data generated according to the above pathfinding data generation method may need to use all the pathfinding data in the specific pathfinding process, or only part of the pathfinding data may need to be used. This application implements In this example, the pathfinding data that needs to be used in this pathfinding process is called target pathfinding data. Among them, the target pathfinding data must include the basic area pathfinding data of the basic area layer, and also include the dynamic area pathfinding data of the dynamic area layer marked as turned on.
举例来说,假设存在两个动态区域层A、B,若当前要进行寻路的目标场景中会存在动态物a,则该动态物a所在的动态区域层A会被标记为开启,从而使得该动态区域层A的动态区域寻路数据处于可用状态。同样的,若动态物a经过状态变化改变为动态物b,或者说动态物a消失,动态物b出现,则动态物a所在的动态区域层A会被标记为不开启、动态物b所在的 动态区域层B会被标记为开启,从而使得该动态区域层A的动态区域寻路数据处于不可用状态、动态区域层B的动态区域寻路数据处于可用状态。For example, suppose there are two dynamic area layers A and B. If there is a dynamic object a in the current target scene for pathfinding, the dynamic area layer A where the dynamic object a is located will be marked as turned on, so that The dynamic area pathfinding data of the dynamic area layer A is available. Similarly, if dynamic object a changes to dynamic object b through a state change, or dynamic object a disappears and dynamic object b appears, the dynamic area layer A where dynamic object a is located will be marked as not open, and the dynamic area layer A where dynamic object b is located will be marked as not open. Dynamic area layer B will be marked as turned on, so that the dynamic area pathfinding data of dynamic area layer A is in an unavailable state, and the dynamic area pathfinding data of dynamic area layer B is in an available state.
一些实施例中,动态区域层的动态区域寻路数据,为标记为开启的动态区域层的动态区域寻路数据,动态区域寻路数据包括:动态区域层的各动态区域中,标记为开启的动态区域的寻路数据。In some embodiments, the dynamic area pathfinding data of the dynamic area layer is the dynamic area pathfinding data of the dynamic area layer marked as enabled. The dynamic area pathfinding data includes: in each dynamic area of the dynamic area layer, the dynamic area pathfinding data of the dynamic area layer is marked as enabled. Pathfinding data for dynamic areas.
从而,在动态区域层中包括有一个或者多个动态区域的情况下,目标寻路数据中的动态区域寻路数据,包含的是动态区域层的各动态区域中,标记为开启的动态区域的寻路数据。也即,标记为不开启的动态区域层的动态区域寻路数据不会包含在目标寻路数据中,以及标记为开启的动态区域层中,标记为不开启的动态区域的动态区域寻路数据也不会包含在目标寻路数据中,以节省内存资源。Therefore, when the dynamic area layer includes one or more dynamic areas, the dynamic area pathfinding data in the target pathfinding data includes the dynamic areas marked as enabled in each dynamic area of the dynamic area layer. Pathfinding data. That is, the dynamic area pathfinding data of the dynamic area layer marked as disabled will not be included in the target pathfinding data, and in the dynamic area layer marked as enabled, the dynamic area pathfinding data of the dynamic area marked as disabled will not be included in the target pathfinding data. It will also not be included in target pathfinding data to save memory resources.
举例来说,假设存在两个动态区域层C、D,动态区域层C中包含两个动态区域:动态区域c1和动态区域c2,若动态区域层C的标记为开启,动态区域c1的标记为开启,动态区域c2的标记为不开启,动态区域层D标记为不开启,则目标寻路数据包含动态区域层C的动态区域c1的动态区域寻路数据,而不包含未开启的动态区域层C的动态区域c2的动态区域寻路数据、以及动态区域层D的动态区域寻路数据。For example, assume that there are two dynamic area layers C and D. Dynamic area layer C contains two dynamic areas: dynamic area c1 and dynamic area c2. If the mark of dynamic area layer C is turned on, the mark of dynamic area c1 is On, dynamic area c2 is marked as not open, and dynamic area layer D is marked as not on, then the target pathfinding data includes the dynamic area pathfinding data of dynamic area c1 of dynamic area layer C, but does not include the unopened dynamic area layer. The dynamic area pathfinding data of the dynamic area c2 of C, and the dynamic area pathfinding data of the dynamic area layer D.
据此,在一个实施例中,在上述加载目标寻路数据之前,方法还包括:Accordingly, in one embodiment, before loading the target pathfinding data, the method further includes:
获取已开启的动态区域层以及已开启的动态区域;Get the enabled dynamic area layer and the enabled dynamic area;
针对已开启的动态区域层中的已开启的动态区域,生成已开启的动态区域层的动态区域寻路数据,并生成基础区域层与动态区域层的拼接信息。Generate dynamic area pathfinding data for the enabled dynamic area layer for the enabled dynamic area in the enabled dynamic area layer, and generate splicing information of the basic area layer and the dynamic area layer.
一些实施例中,目标寻路数据还包括:基础区域层与动态区域层的拼接信息。从而,在后续寻路的过程中,无需再花费额外的资源和时间来查找动态区域层的边界和基础区域层的边界,有利于节省资源,提高寻路效率。In some embodiments, the target pathfinding data also includes: splicing information of the basic area layer and the dynamic area layer. Therefore, in the subsequent path-finding process, there is no need to spend additional resources and time to find the boundaries of the dynamic area layer and the boundaries of the basic area layer, which is beneficial to saving resources and improving path-finding efficiency.
在一些实施例中,上述加载的寻路数据,还可以包括:非目标寻路数据,其中,非目标寻路数据包括标记为未开启的动态区域层的动态区域寻路数据。In some embodiments, the above-mentioned loaded pathfinding data may also include: non-target pathfinding data, where the non-target pathfinding data includes dynamic area pathfinding data marked as an unopened dynamic area layer.
其中,非目标寻路数据是在此次寻路过程中不需要使用到的寻路数据,寻路数据的生成过程可以如上述各实施例中提及的方式。从而,通过在加载寻路数据时,通过加载目标寻路数据和非目标寻路数据,即将基础区域层的基础区域寻路数据,以及所有的动态区域层(包括标记为开启的和标记为未开启的)的动态区域寻路数据均进行加载,方便在后续该非目标寻路数据被启用(即对应的动态区域层的标记更改为开启)后,无需重新加载,可以直接根据是否开启标志对相应的寻路数据进行寻路,以提高寻路效率。The non-target pathfinding data is pathfinding data that does not need to be used in this pathfinding process. The pathfinding data generation process can be as mentioned in the above embodiments. Therefore, by loading the target pathfinding data and non-target pathfinding data when loading the pathfinding data, that is, the base area pathfinding data of the base area layer, and all dynamic area layers (including those marked as turned on and those marked as unavailable). The dynamic area pathfinding data is loaded), so that after the non-target pathfinding data is subsequently enabled (that is, the corresponding dynamic area layer flag is changed to on), there is no need to reload, and you can directly adjust the pathfinding data according to whether the flag is turned on or not. Corresponding pathfinding data is used for pathfinding to improve pathfinding efficiency.
举例来说,假设存在两个动态区域层E、F,若当前要进行寻路的目标场景中会存在动态物e,则该动态物e所在的动态区域层E会被标记为开启,而动态区域层F会被标记为不开启。而动态物e经过状态变化改变为动态物f,或者说动态物e消失,动态物f出现,则动态物e所在的动态区域层E会被标记为不开启、动态物f所在的动态区域层F会被标记为开启。在此情况下,在加载寻路数据时,可以将动态区域层E、F的动态区域寻路数据均进行加载。只需在后续实际结合目标寻路数据进行寻路时,只需结合基础区域寻路数据和标记为开启的动态区域层的动态区域寻路数据进行寻路即可。For example, assume that there are two dynamic area layers E and F. If there is a dynamic object e in the current target scene for pathfinding, the dynamic area layer E where the dynamic object e is located will be marked as turned on, and the dynamic area layer E will be marked as turned on. Area layer F will be marked as not open. And the dynamic object e changes to the dynamic object f after the state change, or the dynamic object e disappears and the dynamic object f appears, then the dynamic area layer E where the dynamic object e is located will be marked as not open, and the dynamic area layer where the dynamic object f is located will be marked. F will be marked as on. In this case, when loading the pathfinding data, both the dynamic area pathfinding data of the dynamic area layers E and F can be loaded. When you actually combine the target pathfinding data for pathfinding later, you only need to combine the basic area pathfinding data and the dynamic area pathfinding data of the dynamic area layer marked as turned on for pathfinding.
步骤S1502:获得起点信息和终点信息。Step S1502: Obtain starting point information and end point information.
其中,起点信息是指要进行寻路的起点,通常是指要进行寻路的开始点,其指示了进行寻路的开始位置。终点信息是指要进行寻路的终点,通常是指要进行寻路的终点,其指示了进行寻路的结束位置。The starting point information refers to the starting point for path finding, usually the starting point for path finding, which indicates the starting position for path finding. The endpoint information refers to the endpoint where pathfinding is to be performed, usually the endpoint where pathfinding is to be performed, and it indicates the end position of pathfinding.
可以采用各种可能方式来确定起点信息和终点信息。例如,在一些实施例中,以游戏场景为例,可以是由游戏用户指定起点信息和终点信息。再例如,以游戏场景为例,可以是将游戏角色(游戏玩家或者NPC角色)所在的位置为起点信息,游戏用户指示的目标位置(例如 点击的目标位置)或者NPC角色要到达的位置作为目标位置。应当理解的是,在其他实施例中,也可以采用其他的方式来确定起点信息和终点信息。Various possible ways can be used to determine the starting point information and the ending point information. For example, in some embodiments, taking a game scene as an example, the starting point information and the end point information may be specified by the game user. For another example, taking a game scene as an example, the location of the game character (game player or NPC character) can be used as the starting point information, and the target location indicated by the game user (for example, The clicked target position) or the position that the NPC character wants to reach is used as the target position. It should be understood that in other embodiments, other methods may be used to determine the starting point information and the end point information.
步骤S1503:基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径。Step S1503: Based on the starting point information and the end point information, perform path finding in the target path finding data to obtain the path finding path.
一个实施例中,在基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径时,可以采用任何可能的方式进行。以寻路数据是以导航网格为基础划分为例,一个具体示例中的基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径,具体可以包括:In one embodiment, when pathfinding is performed in the target pathfinding data based on the starting point information and the endpoint information, and the pathfinding path is obtained, any possible method can be used. Taking the pathfinding data divided based on the navigation grid as an example, in a specific example, based on the starting point information and the end point information, pathfinding is performed in the target pathfinding data to obtain the pathfinding path, which may include:
确定起点信息所属的起点多边形,终点信息所属的终点多边形;Determine the starting point polygon to which the starting point information belongs and the end point polygon to which the end point information belongs;
自起点多边形开始寻路,在目标寻路数据中进行寻路,依次寻找扩展的邻接多边形,直至寻找到终点多边形,获得寻路路径。Start pathfinding from the starting point polygon, perform pathfinding in the target pathfinding data, and sequentially search for expanded adjacent polygons until the end point polygon is found, and obtain the pathfinding path.
其中,在上述寻路过程中,在寻找扩展的邻接多边形时,在存在开启的动态区域层的情况下,具体可以包括:Among them, in the above pathfinding process, when searching for extended adjacent polygons, when there is a dynamic area layer turned on, it may specifically include:
确定与当前已扩展多边形相邻的相邻多边形;Determine adjacent polygons adjacent to the currently expanded polygon;
确定相邻多边形所属的区域;Determine the area to which adjacent polygons belong;
若相邻多边形所属的区域为基础区域层中的区域,将相邻多边形确定为扩展的邻接多边形;If the area to which the adjacent polygon belongs is an area in the basic area layer, determine the adjacent polygon as an extended adjacent polygon;
若相邻多边形所属的区域为动态区域,动态区域开启,且动态区域所属的动态区域层开启,将对应动态区域层的相邻多边形确定为扩展的邻接多边形;If the area to which the adjacent polygons belong is a dynamic area, the dynamic area is turned on, and the dynamic area layer to which the dynamic area belongs is turned on, the adjacent polygons corresponding to the dynamic area layer are determined as extended adjacent polygons;
若动态区域未开启或者动态区域层未开启,寻找下一个相邻的相邻多边形,返回确定相邻多边形所属的区域的步骤,其中,下一个相邻的相邻多边形位于当前已扩展多边形所在的区域层,或者,所述下一个相邻的相邻多边形位于所述当前已扩展多边形所在的区域层的上一层区域层,或者,下一个相邻的相邻多边形位于基础区域层。If the dynamic area is not turned on or the dynamic area layer is not turned on, find the next adjacent adjacent polygon and return to the step of determining the area to which the adjacent polygon belongs, where the next adjacent adjacent polygon is located where the current expanded polygon is located. The area layer, or the next adjacent adjacent polygon is located in the area layer above the area layer where the current expanded polygon is located, or the next adjacent adjacent polygon is located in the base area layer.
如图16所示,其示出了一个具体示例中的寻找扩展的邻接多边形的流程示意图,其具体可以包括如下步骤S1601至步骤S1608。As shown in Figure 16, it shows a schematic flowchart of finding extended adjacent polygons in a specific example, which may specifically include the following steps S1601 to step S1608.
步骤S1601:确定与当前已扩展多边形相邻的相邻多边形。Step S1601: Determine adjacent polygons adjacent to the currently expanded polygon.
其中,当前已扩展多边形,指当前已经查找到并且已经加入到了寻路路径的多边形。以刚开始寻路过程为例,该当前已扩展多边形可以是指上述起点信息所在的多边形。若是在寻路过程中,则该当前已扩展多边形可以是已经加入到了寻路路径的多边形,例如刚加入到寻路路径的多边形,或者是其他某个时刻加入到寻路路径的多边形。Among them, the currently expanded polygon refers to the polygon that has been found and added to the pathfinding path. Taking the path-finding process at the beginning as an example, the currently expanded polygon may refer to the polygon where the above starting point information is located. If it is in the pathfinding process, the currently expanded polygon can be a polygon that has been added to the pathfinding path, such as a polygon that has just been added to the pathfinding path, or a polygon that has been added to the pathfinding path at some other time.
步骤S1602:确定相邻多边形所属的区域。若该相邻多边形属于动态区域,则进入步骤S1603。若该相邻多边形属于基础区域层,则进入步骤S1605。Step S1602: Determine the area to which adjacent polygons belong. If the adjacent polygon belongs to the dynamic area, step S1603 is entered. If the adjacent polygon belongs to the basic area layer, proceed to step S1605.
步骤S1603:判断相邻多边形所属的动态区域是否开启,若开启,则进入步骤S1604,若未开启,则进入步骤S1607。Step S1603: Determine whether the dynamic area to which the adjacent polygon belongs is turned on. If it is turned on, go to step S1604. If it is not turned on, go to step S1607.
步骤S1604,确定动态区域所属的动态区域层是否开启。若开启,则进入步骤S1605,若未开启,则进入步骤S1607。Step S1604: Determine whether the dynamic area layer to which the dynamic area belongs is enabled. If it is turned on, go to step S1605; if it is not turned on, go to step S1607.
步骤S1605:将相邻多边形确定为扩展的邻接多边形。Step S1605: Determine adjacent polygons as extended adjacent polygons.
步骤S1606:判断是否寻路完成。若寻路完成,则直接进入S1608,若寻路未完成,则进入步骤S1607。其中,可以用各种可能的方式来分析确定是否寻路完成。例如,若找到的该相邻多边形是终点信息所在的多边形,则可以直接判定寻路已完成,若找到的该相邻多边形不是终点信息所在的多边形,则判定寻路未完成。在一些实施例中,也可以采用其他的方式来确定是否寻路完成,例如在找到该相邻多边形后,确定将相邻多边形加入到寻路路径后是否优于已查找到的寻路路径,若否,则确定该次寻路已完成,若是,则判定寻路未完成。从而,可以通过寻找起点信息和终点信息之间的多条路径,并从中确定一个最优的路径作为最终的寻路路径。可以理解的是,在其他方式中也可以采用其他的方式来分析确定是否已经寻路完成。Step S1606: Determine whether path finding is completed. If the path finding is completed, proceed directly to S1608; if the path finding is not completed, proceed to step S1607. Among them, various possible ways can be used to analyze and determine whether path finding is completed. For example, if the adjacent polygon found is the polygon where the end point information is located, it can be directly determined that the path finding is completed. If the adjacent polygon found is not the polygon where the end point information is located, it is determined that the path finding is not completed. In some embodiments, other methods may also be used to determine whether path finding is completed, for example, after finding the adjacent polygon, determining whether adding the adjacent polygon to the path finding path is better than the found path finding path. If not, it is determined that the path finding has been completed. If yes, it is determined that the path finding has not been completed. Therefore, multiple paths between the starting point information and the ending point information can be found, and an optimal path can be determined as the final path finding path. It is understandable that other methods may also be used to analyze and determine whether path finding has been completed.
应当理解的是,在其他实施例中,若仅仅只需要基于该相邻多边形是否为终点信息所在 的多边形,来决定是否寻路完成的情况下,则可以在上述步骤S1601之后,先确定是否寻路完成,即确定与当前已扩展多边形相邻的相邻多边形是否为终点信息所在的多边形,若是,则可以直接判定寻路完成,若不是,则进入步骤S1602的确定相邻多边形所属的区域的步骤。并在步骤S1605的将该相邻多边形确定为扩展的邻接多边形之后,直接返回步骤S1601确定下一个相邻多边形。It should be understood that in other embodiments, if it is only necessary to determine whether the adjacent polygon is the end point information polygon to determine whether the path finding is completed, after the above step S1601, first determine whether the path finding is completed, that is, determine whether the adjacent polygon adjacent to the current expanded polygon is the polygon where the end point information is located. If so , then it can be directly determined that the path finding is completed. If not, then enter step S1602 of determining the area to which the adjacent polygon belongs. And after determining the adjacent polygon as an extended adjacent polygon in step S1605, the process directly returns to step S1601 to determine the next adjacent polygon.
步骤S1607:扩展到下一个相邻的多边形,返回上述步骤S1601的确定相邻多边形所属的区域的步骤,下一个相邻的相邻多边形位于所述当前已扩展多边形所在的区域层,或者,下一个相邻的多边形位于当前已扩展多边形所在区域层的上一层区域层,或者是位于基础区域层。Step S1607: Expand to the next adjacent polygon, and return to the step of determining the area to which the adjacent polygon belongs in step S1601. The next adjacent adjacent polygon is located in the area layer where the currently expanded polygon is located, or, next An adjacent polygon is located in the area layer immediately above the area layer where the current expanded polygon is located, or in the base area layer.
其中,当前已扩展多边形可能存在不同的情形,扩展的下一个相邻的相邻多边形也可以存在不同的情形。Among them, the currently expanded polygon may have different situations, and the next adjacent adjacent polygon to be expanded may also have different situations.
以当前已扩展多边形为位于基础区域层的多边形为例,则可以先查看邻接当前已扩展多边形的多边形是否属于开启的动态区域,如果是,则扩展动态区域中已经开启的优先级最高的动态区域层中的多边形。否则扩展基础区域层中的相邻多边形。具体的扩展规则,可以结合不同的方式设定,例如结合终点信息所在的多边形所在的区域设定。例如,若终点信息所在的多边形位于动态区域层,则可以将动态区域层中的多边形作为下一个相邻的多边形。应当理解的是,在其他实施例中,也可以采用其他的方式选择将基础区域层的多边形还是动态区域层的多边形作为下一个相邻的多边形。Taking the current expanded polygon as a polygon located at the base area layer as an example, you can first check whether the polygon adjacent to the currently expanded polygon belongs to an enabled dynamic area. If so, expand the dynamic area with the highest priority that has been enabled in the dynamic area. polygons in the layer. Otherwise extend adjacent polygons in the base region layer. Specific expansion rules can be set in different ways, such as setting the area where the polygon where the end point information is located is located. For example, if the polygon where the end point information is located is located in the dynamic area layer, the polygon in the dynamic area layer can be used as the next adjacent polygon. It should be understood that in other embodiments, other methods may be used to select whether the polygons of the basic region layer or the polygons of the dynamic region layer are used as the next adjacent polygon.
以当前已扩展多边形为位于动态区域层的多边形为例,假设该动态区域层为动态区域层F1,则可以先在动态区域层F1寻找下一个相邻的相邻多边形,若F1中相邻的这个多边形属于优先级更高的动态区域层F2,并且动态区域层F2是已经开启的层,则扩展到动态区域层F2中的邻接多边形。如果在动态区域层F1无法寻找到下一个相邻的相邻多边形,则可以在已经开启的优先级更低的动态区域层F0中查找。如果优先级更低的动态区域层F0或者找不到邻接多边形,则可以进一步在基础区域层中寻找下一个相邻的相邻多边形。在其他实施例中,也可以同时在基础区域层、当前已扩展多边形所在的动态区域层、其他动态区域层中寻找下一个相邻的相邻多边形,若在基础区域层、当前已扩展多边形所在的动态区域层、其他动态区域层中均有相邻多边形,则可以按照一定的优先级或者分析规则,从中确定一个多边形作为下一个相邻多边形。具体的优先级的设置方式或者分析规则的设置方式,可以与上述方式相同。Take the current expanded polygon as a polygon located in the dynamic area layer as an example. Assuming that the dynamic area layer is the dynamic area layer F1, you can first find the next adjacent adjacent polygon in the dynamic area layer F1. If the adjacent polygon in F1 This polygon belongs to the dynamic area layer F2 with a higher priority, and the dynamic area layer F2 is an already enabled layer, so it is extended to the adjacent polygons in the dynamic area layer F2. If the next adjacent adjacent polygon cannot be found in the dynamic region layer F1, it can be searched in the dynamic region layer F0 with a lower priority that has been turned on. If the dynamic region layer F0 with a lower priority or the adjacent polygon cannot be found, the next adjacent adjacent polygon can be further searched for in the base region layer. In other embodiments, the next adjacent adjacent polygon can also be searched for in the base area layer, the dynamic area layer where the current expanded polygon is located, and other dynamic area layers at the same time. If there are adjacent polygons in the dynamic area layer and other dynamic area layers, one polygon can be determined as the next adjacent polygon according to a certain priority or analysis rules. The specific priority setting method or the analysis rule setting method can be the same as the above method.
步骤S1608:返回寻路结果,结束寻路过程。Step S1608: Return the path finding result and end the path finding process.
其中,寻路结果是指最终寻找到的寻路路径。Among them, the pathfinding result refers to the pathfinding path finally found.
为了验证本申请实施例方案在寻路过程中对资源占用的减少以及耗时的减少,将基于本申请实施例的寻路方法与传统寻路方案进行寻路时,对寻路数据的准备耗时基于相同的测试用例进行比较,当地图分块大小为16*16、多边形数量为1时,传统寻路方案的寻路数据的准备需要耗时12~15毫秒,而本申请实施例的方案远远小于1毫秒,可以忽略不计。当地图分块大小为16*16、多边形数量为92时,传统寻路方案的寻路数据的准备的耗时达到了17~21毫秒,而本申请实施例的方案仍远远小于1毫秒,可以忽略不计。当地图分块大小为48*48、多边形数量为1时,传统寻路方案的寻路数据的准备的耗时达到了48~50毫秒,而本申请实施例的方案仍远远小于1毫秒,可以忽略不计。当地图分块大小为48*48、多边形数量为122个时,传统寻路方案的寻路数据的准备的耗时达到了57~68毫秒,而本申请实施例的方案仍远远小于1毫秒,可以忽略不计。当地图大小为8k*8k,多边形数量为1134923时,传统寻路方案的内存占用达到了1262MB,而本申请实施例方案占用的内存只有318MB,远小于传统寻路方案占用的内存。当以服务器举例,如果服务器承载的游戏实例为200,地图总数量为17时,传统寻路方案的内存占用达到了252400MB,而本申请实施例方案占用的内存只有5406MB,远小于传统寻路方案占用的内存。结合对比可以发现,基于本申请实施例方案大大降低了要寻路时 的耗时,且减少了对内存资源的占用。In order to verify that the solution of the embodiment of the present application reduces resource occupation and time-consuming during the path finding process, when path finding is performed based on the path finding method of the embodiment of the present application and the traditional path finding solution, the preparation time of the path finding data is When comparing based on the same test case, when the map block size is 16*16 and the number of polygons is 1, the preparation of pathfinding data of the traditional pathfinding solution takes 12 to 15 milliseconds, while the solution of the embodiment of the present application It is much less than 1 millisecond and can be ignored. When the map block size is 16*16 and the number of polygons is 92, the traditional pathfinding solution takes 17 to 21 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond. Can be ignored. When the map tile size is 48*48 and the number of polygons is 1, the traditional pathfinding solution takes 48 to 50 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond. Can be ignored. When the map block size is 48*48 and the number of polygons is 122, the traditional pathfinding solution takes 57 to 68 milliseconds to prepare pathfinding data, while the solution in the embodiment of the present application is still far less than 1 millisecond. , can be ignored. When the map size is 8k*8k and the number of polygons is 1134923, the memory occupied by the traditional pathfinding solution reaches 1262MB, while the memory occupied by the solution in the embodiment of this application is only 318MB, which is much smaller than the memory occupied by the traditional pathfinding solution. Taking the server as an example, if the server hosts 200 game instances and the total number of maps is 17, the memory occupied by the traditional pathfinding solution reaches 252400MB, while the memory occupied by the solution in the embodiment of this application is only 5406MB, which is much smaller than the traditional pathfinding solution. memory occupied. Through comparison, it can be found that the solutions based on the embodiments of this application greatly reduce the time required to find paths. It is time-consuming and reduces the occupation of memory resources.
结合如上所述的实施例中的寻路方法,基于图12-14所示的生成的寻路数据,一个具体示例中在进行寻路时,只对基础区域层进行寻路获得的寻路路径如图17所述,在动态区域层开启的情况下,同时对基础区域层和动态区域层进行寻路获得的寻路路径如图18所示。与图12-14中类似,在图17、18中黑色线段表示区域边界,虚线线段表示生成的寻路数据中生成的多边形的线段。此外,在图17、18中,假设需要进行寻路的起点S点,寻路的目标位置在P点,S点和P点各自在一个多边形内。在图17所示的示例中,在只对基础区域层进行寻路的情况下,动态区域层的区域视作一个整体来提供寻路路径。在图18所示的示例中,由于动态区域层开启,因此,在进行寻路的过程中,在靠近动态区域层边界时,会有可能选择动态区域层的寻路数据中的相关多边形的区域,即动态区域层的寻路数据也会被作为寻路的对象。最终寻路获得的寻路路径如图17、18中点S与点P之间的黑色线段所示。Combined with the pathfinding method in the above embodiment, based on the generated pathfinding data shown in Figures 12-14, in a specific example, when performing pathfinding, only the pathfinding path is obtained by pathfinding the basic area layer. As shown in Figure 17, when the dynamic area layer is turned on, the pathfinding path obtained by performing pathfinding on the basic area layer and the dynamic area layer at the same time is as shown in Figure 18. Similar to Figures 12-14, in Figures 17 and 18, the black line segments represent the area boundaries, and the dotted line segments represent the line segments of the polygon generated in the generated pathfinding data. In addition, in Figures 17 and 18, it is assumed that the starting point S for pathfinding is required, the target position of the pathfinding is at point P, and point S and point P are each within a polygon. In the example shown in Figure 17, in the case where only the basic area layer is path-finded, the area of the dynamic area layer is regarded as a whole to provide a path-finding path. In the example shown in Figure 18, since the dynamic area layer is turned on, during the pathfinding process, when approaching the boundary of the dynamic area layer, it is possible to select the area of the relevant polygon in the pathfinding data of the dynamic area layer. , that is, the pathfinding data of the dynamic area layer will also be used as the object of pathfinding. The final pathfinding path obtained by pathfinding is shown in the black line segment between point S and point P in Figures 17 and 18.
应该理解的是,虽然如上的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts involved in the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的寻路数据的生成方法的寻路数据的生成装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个寻路数据的生成装置实施例中的具体限定可以参见上文中对于寻路数据的生成方法的限定,在此不再赘述。Based on the same inventive concept, embodiments of the present application also provide a pathfinding data generation device for implementing the above-mentioned pathfinding data generation method. The solution to the problem provided by this device is similar to the solution recorded in the above method. Therefore, for the specific limitations in the embodiments of the device for generating one or more pathfinding data provided below, please refer to the pathfinding data mentioned above. The limitations of the generation method will not be repeated here.
在一个实施例中,提供了一种寻路数据的生成装置,包括:动态层确定模块、基础数据生成模块、动态数据生成模块、拼接模块和数据确定模块,其中:In one embodiment, a pathfinding data generation device is provided, including: a dynamic layer determination module, a basic data generation module, a dynamic data generation module, a splicing module and a data determination module, wherein:
动态层确定模块,用于确定目标场景中的动态区域层,动态区域层中包括至少一个动态区域;a dynamic layer determination module, used to determine the dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area;
基础数据生成模块,用于加载目标场景的基础区域层的基础场景数据,基于基础场景数据生成基础区域层的基础区域寻路数据;The basic data generation module is used to load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
动态数据生成模块,用于加载动态区域层,生成动态区域层的动态区域内的动态区域寻路数据;The dynamic data generation module is used to load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
拼接模块,用于建立动态区域层和基础区域层的拼接信息;The splicing module is used to establish the splicing information of the dynamic regional layer and the basic regional layer;
数据确定模块,用于基于基础区域寻路数据、动态区域寻路数据和拼接信息,生成目标场景的寻路数据。The data determination module is used to generate pathfinding data of the target scene based on basic area pathfinding data, dynamic area pathfinding data and splicing information.
一个实施例中,装置还包括:第一边界记录模块和第二边界记录模块;In one embodiment, the device further includes: a first boundary recording module and a second boundary recording module;
第一边界记录模块,用于记录所述基础区域层与动态区域的边界的第一边界信息;A first boundary recording module, configured to record the first boundary information of the boundary between the basic area layer and the dynamic area;
第二边界记录模块,用于记录所述动态区域层的所述动态区域与基础区域边界的第二边界信息;A second boundary recording module, configured to record the second boundary information of the boundary between the dynamic area and the basic area of the dynamic area layer;
拼接模块,用于根据第一边界信息和第二边界信息,建立动态区域层和基础区域层的拼接信息。The splicing module is used to establish splicing information of the dynamic region layer and the basic region layer based on the first boundary information and the second boundary information.
一个实施例中,动态数据生成模块,用于确定目标场景中的动态区域;根据各动态区域的重叠关系,确定各动态区域所属的动态区域层。In one embodiment, the dynamic data generation module is used to determine dynamic areas in the target scene; and determine the dynamic area layer to which each dynamic area belongs based on the overlapping relationship of each dynamic area.
一个实施例中,动态数据生成模块,用于执行动态区域寻路数据生成过程,并在执行动态区域寻路数据生成过程的过程中,过滤不在动态区域层的动态区域内的数据;其中,动态区域寻路数据生成过程包括:加载动态区域层的动态地图场景;对动态地图场景进行3D场景体 素化,获得动态地图体素数据;过滤动态地图体素数据中的不可行走区域,获得动态地图可走区域体素数据;简化动态地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据;基于动态地图可走区域数据生成多边形;基于各多边形生成细节网络,并基于细节网络获得动态区域寻路数据。In one embodiment, the dynamic data generation module is used to execute the dynamic area pathfinding data generation process, and in the process of executing the dynamic area pathfinding data generation process, filter data that is not within the dynamic area of the dynamic area layer; wherein, dynamic The regional pathfinding data generation process includes: loading the dynamic map scene of the dynamic regional layer; performing 3D scene rendering on the dynamic map scene. Voxelize to obtain the dynamic map voxel data; filter the non-walkable areas in the dynamic map voxel data to obtain the dynamic map walkable area voxel data; simplify the contour lines in the dynamic map walkable area voxel data to obtain simplified contour lines The final dynamic map traversable area data is generated; polygons are generated based on the dynamic map traversable area data; a detail network is generated based on each polygon, and dynamic area pathfinding data is obtained based on the detail network.
一个实施例中,动态数据生成模块,用于在对动态地图场景进行3D场景体素化之前,过滤不在动态区域层的动态区域内的三角形。In one embodiment, the dynamic data generation module is used to filter triangles that are not within the dynamic area of the dynamic area layer before performing 3D scene voxelization on the dynamic map scene.
一个实施例中,动态数据生成模块,用于在获得动态地图体素数据之后,过滤动态地图体素数据中的不可行走区域之前,过滤不在动态区域层的动态区域内的体素。In one embodiment, the dynamic data generation module is configured to filter voxels that are not within the dynamic area of the dynamic area layer after obtaining the dynamic map voxel data and before filtering the unwalkable areas in the dynamic map voxel data.
一个实施例中,动态数据生成模块,用于在基于动态地图可走区域数据生成多边形时,基于动态地图可走区域数据,生成只位于动态区域层的动态区域内的多边形。In one embodiment, the dynamic data generation module is used to generate polygons located only within the dynamic area of the dynamic area layer based on the dynamic map walkable area data when generating polygons based on the dynamic map walkable area data.
一个实施例中,动态数据生成模块,用于在基于动态地图可走区域数据生成多边形之后,基于各多边形生成细节网络之前,过滤掉不在动态区域层的动态区域内的多边形。In one embodiment, the dynamic data generation module is used to filter out polygons that are not within the dynamic area of the dynamic area layer after generating polygons based on the traversable area data of the dynamic map and before generating detailed networks based on each polygon.
一个实施例中,拼接模块,用于遍历动态区域层的动态区域寻路数据的动态层边界,动态层边界包括各动态层边界线段;查找基础区域寻路数据中与动态层边界线段匹配的目标基础层边界线段;若查找到与动态层边界线段匹配的目标基础层边界线段,建立动态层边界线段与目标基础层边界线段的线段连接关系;动态区域层和基础区域层的拼接信息,包括线段连接关系。In one embodiment, the splicing module is used to traverse the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer. The dynamic layer boundary includes each dynamic layer boundary line segment; search for targets in the basic area pathfinding data that match the dynamic layer boundary line segment. Base layer boundary line segment; if the target base layer boundary line segment matching the dynamic layer boundary line segment is found, establish a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment; the splicing information of the dynamic area layer and the base area layer, including line segments connection relationship.
一个实施例中,拼接模块,用于遍历获得基础区域寻路数据的基础层边界,基础层边界包括各基础层边界线段;若满足投影条件,确定将动态层边界线段和基础层边界线段投影到目标坐标轴的第一投影重叠区域;若第一投影重叠区域与第二投影重叠区域不重叠,确定基础层边界线段为匹配的目标基础层边界线段,第二投影重叠区域为将已查找到的已有目标基础层边界线段与动态层边界线段投影到目标坐标轴的重叠区域。In one embodiment, the splicing module is used to traverse the base layer boundary to obtain the base area pathfinding data. The base layer boundary includes each base layer boundary line segment; if the projection conditions are met, it is determined to project the dynamic layer boundary line segment and the base layer boundary line segment to The first projection overlap area of the target coordinate axis; if the first projection overlap area and the second projection overlap area do not overlap, determine the base layer boundary line segment to be the matching target base layer boundary line segment, and the second projection overlap area is the found The existing target base layer boundary line segment and the dynamic layer boundary line segment are projected to the overlapping area of the target coordinate axis.
一个实施例中,拼接模块,用于在第一投影重叠区域与第二投影重叠区域重叠时,确定基础层边界线段是否优于已有目标基础层边界线段;在基础层边界线段优于已有目标基础层边界线段时,将已有目标基础层边界线段从已查找到的目标基础层边界线段列表中删除,并将基础层边界线段确定为匹配的目标基础层边界线段加入到已查找到的目标基础层边界线段列表中;并在基础层边界线段未优于已有目标基础层边界线段时,确定基础层边界线段不是匹配的目标基础层边界线段。In one embodiment, the splicing module is used to determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment when the first projection overlapping area overlaps with the second projection overlapping area; when the base layer boundary line segment is better than the existing target base layer boundary line segment, When selecting a target base layer boundary line segment, delete the existing target base layer boundary line segment from the found target base layer boundary line segment list, and determine the base layer boundary line segment as a matching target base layer boundary line segment and add it to the found target base layer boundary line segment. in the target base layer boundary line segment list; and when the base layer boundary line segment is not better than the existing target base layer boundary line segment, it is determined that the base layer boundary line segment is not a matching target base layer boundary line segment.
一个实施例中,拼接模块,用于在动态层边界线段与基础层边界线段的距离,小于动态层边界线段与已有目标基础层边界线段的距离,或者,动态层边界线段与基础层边界线段的夹角,小于动态层边界线段与已有目标基础层边界线段的夹角,确定基础层边界线段优于已有目标基础层边界线段。In one embodiment, the splicing module is used when the distance between the dynamic layer boundary line segment and the base layer boundary line segment is less than the distance between the dynamic layer boundary line segment and the existing target base layer boundary line segment, or the dynamic layer boundary line segment and the base layer boundary line segment are smaller than the distance between the dynamic layer boundary line segment and the base layer boundary line segment. is smaller than the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment, it is determined that the base layer boundary line segment is better than the existing target base layer boundary line segment.
在一个实施例中,提供了一种寻路装置,寻路装置包括:加载模块、起始点获取模块、寻路模块。其中:In one embodiment, a path-finding device is provided. The path-finding device includes: a loading module, a starting point acquisition module, and a path-finding module. in:
加载模块,用于加载寻路数据,所述寻路数据包括目标寻路数据,目标寻路数据包括:基础区域层的基础区域寻路数据,标记为开启的动态区域层的动态区域寻路数据;A loading module, used to load pathfinding data. The pathfinding data includes target pathfinding data. The target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on. ;
起始点获取模块,用于获得起点信息和终点信息;The starting point acquisition module is used to obtain starting point information and end point information;
寻路模块,基于起点信息和终点信息,在目标寻路数据中进行寻路,获得寻路路径。The pathfinding module, based on the starting point information and the end point information, performs pathfinding in the target pathfinding data to obtain the pathfinding path.
一个实施例中,所述加载模块加载的寻路数据,还包括非目标寻路数据,所述非目标寻路数据包括标记为未开启的动态区域层的动态区域寻路数据。In one embodiment, the pathfinding data loaded by the loading module also includes non-target pathfinding data, and the non-target pathfinding data includes dynamic area pathfinding data marked as unopened dynamic area layer.
一个实施例中,寻路模块用于确定起点信息所属的起点多边形,终点信息所属的终点多边形;自起点多边形开始寻路,在目标寻路数据中进行寻路,依次寻找扩展的邻接多边形,直至寻找到终点多边形,获得寻路路径;其中,寻找扩展的邻接多边形,包括:确定与当前已扩展多边形相邻的相邻多边形;确定相邻多边形所属的区域;若相邻多边形所属的区域为基础区 域层中的区域,将相邻多边形确定为扩展的邻接多边形;若相邻多边形所属的区域为动态区域,动态区域开启,且动态区域所属的动态区域层开启,则优先将相邻多边形确定为扩展的邻接多边形;若动态区域未开启或者动态区域层未开启,寻找下一个相邻的相邻多边形,返回确定相邻多边形所属的区域的步骤,其中,下一个相邻的相邻多边形位于当前已扩展多边形所在的区域层,或者,所述下一个相邻的相邻多边形位于所述当前已扩展多边形所在的区域层的上一层区域层,或者,下一个相邻的相邻多边形位于基础区域层。In one embodiment, the pathfinding module is used to determine the starting point polygon to which the starting point information belongs and the end point polygon to which the end point information belongs; starting path finding from the starting point polygon, performing path finding in the target path finding data, and sequentially searching for extended adjacent polygons until Find the end point polygon and obtain the pathfinding path; among them, searching for expanded adjacent polygons includes: determining the adjacent polygons adjacent to the current expanded polygon; determining the area to which the adjacent polygon belongs; if the area to which the adjacent polygon belongs is based district For areas in the domain layer, the adjacent polygons are determined as extended adjacent polygons; if the area to which the adjacent polygons belong is a dynamic area, the dynamic area is turned on, and the dynamic area layer to which the dynamic area belongs is turned on, the adjacent polygons are first determined as Extended adjacent polygons; if the dynamic area is not turned on or the dynamic area layer is not turned on, find the next adjacent adjacent polygon and return to the step of determining the area to which the adjacent polygon belongs, where the next adjacent adjacent polygon is located at the current The region layer where the expanded polygon is located, or the next adjacent adjacent polygon is located on the region layer above the region layer where the current expanded polygon is located, or the next adjacent adjacent polygon is located on the base layer Regional layer.
一个实施例中,寻路装置还包括:数据生成模块,In one embodiment, the pathfinding device further includes: a data generation module,
数据生成模块,用于获取已开启的动态区域层以及已开启的动态区域;针对已开启的动态区域层中的已开启的动态区域,生成已开启的动态区域层的动态区域寻路数据,并生成基础区域层与动态区域层的拼接信息。The data generation module is used to obtain the enabled dynamic area layer and the enabled dynamic area; for the enabled dynamic area in the enabled dynamic area layer, generate the dynamic area pathfinding data of the enabled dynamic area layer, and Generate the splicing information of the basic area layer and the dynamic area layer.
上述寻路数据的生成装置、以及寻路装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。The above pathfinding data generating device and each module in the pathfinding device may be implemented in whole or in part by software, hardware, or combinations thereof. Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图19所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储目标场景的数据以及生成的寻路数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种寻路数据的生成方法或者寻路方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in Figure 19. The computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O), and a communication interface. Among them, the processor, memory and input/output interface are connected through the system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage medium stores operating systems, computer programs and databases. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media. The computer device's database is used to store target scene data and generated pathfinding data. The input/output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. The computer program implements a pathfinding data generation method or a pathfinding method when executed by the processor.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端。该计算机设备包括处理器、存储器、输入/输出接口、通信接口、显示单元和输入装置。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口、显示单元和输入装置通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种寻路数据的生成方法或者寻路方法。该计算机设备的显示单元用于形成视觉可见的画面,可以是显示屏、投影装置或虚拟现实成像装置,显示屏可以是液晶显示屏或电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, memory, input/output interface, communication interface, display unit and input device. Among them, the processor, memory and input/output interface are connected through the system bus, and the communication interface, display unit and input device are connected to the system bus through the input/output interface. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage medium stores operating systems and computer programs. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used for wired or wireless communication with external terminals. The wireless mode can be implemented through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program implements a pathfinding data generation method or a pathfinding method when executed by the processor. The display unit of the computer device is used to form a visually visible picture and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a display screen. The touch layer covered above can also be buttons, trackballs or touch pads provided on the computer equipment shell, or it can also be an external keyboard, touch pad or mouse, etc.
本领域技术人员可以理解,图19中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 19 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. The specific computer equipment may May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, it implements the steps in the above method embodiments.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiments are implemented.
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器 执行时实现上述各方法实施例中的步骤。In one embodiment, a computer program product is provided, comprising a computer program, the computer program being During execution, the steps in each of the above method embodiments are implemented.
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all It is information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如基础随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. , when executed, the computer program may include the processes of the above method embodiments. Any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory (MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in many forms, such as basic random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include blockchain-based distributed databases, etc., but are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. It is considered to be within the scope of this manual.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。 The above embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all fall within the protection scope of the present application. Therefore, the scope of protection of this application should be determined by the appended claims.

Claims (15)

  1. 一种寻路数据的生成方法,其特征在于,由计算机设备执行,所述方法包括:A method for generating pathfinding data, characterized in that it is executed by a computer device, and the method includes:
    确定目标场景中的动态区域层,所述动态区域层中包括至少一个动态区域;Determine a dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area;
    加载所述目标场景的基础区域层的基础场景数据,基于所述基础场景数据生成所述基础区域层的基础区域寻路数据;Load the basic scene data of the basic area layer of the target scene, and generate the basic area pathfinding data of the basic area layer based on the basic scene data;
    加载所述动态区域层,生成所述动态区域层的动态区域内的动态区域寻路数据;Load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
    建立所述动态区域层和所述基础区域层的拼接信息;Establish splicing information of the dynamic area layer and the basic area layer;
    基于所述基础区域寻路数据、所述动态区域寻路数据和所述拼接信息,生成所述目标场景的寻路数据。Pathfinding data of the target scene is generated based on the basic area pathfinding data, the dynamic area pathfinding data and the splicing information.
  2. 根据权利要求1所述的方法,其特征在于:The method according to claim 1, characterized in that:
    所述基于所述基础场景数据生成所述基础区域层的基础区域寻路数据之后,还包括:记录所述基础区域寻路数据的第一边界信息;After generating the basic area pathfinding data of the basic area layer based on the basic scene data, the method further includes: recording the first boundary information of the basic area pathfinding data;
    所述生成所述动态区域层的动态区域内的动态区域寻路数据之后,还包括:记录所述动态区域寻路数据的第二边界信息;After generating the dynamic area pathfinding data in the dynamic area of the dynamic area layer, the method further includes: recording second boundary information of the dynamic area pathfinding data;
    所述建立所述动态区域层和所述基础区域层的拼接信息,包括:根据所述第一边界信息和所述第二边界信息,建立所述动态区域层和所述基础区域层的拼接信息。The establishing the splicing information of the dynamic area layer and the basic area layer includes: establishing the splicing information of the dynamic area layer and the basic area layer according to the first boundary information and the second boundary information. .
  3. 根据权利要求1所述的方法,其特征在于,所述确定目标场景中的动态区域层,包括:The method according to claim 1, characterized in that determining the dynamic area layer in the target scene includes:
    确定目标场景中的动态区域;Determine dynamic areas in the target scene;
    根据各所述动态区域的重叠关系,确定各所述动态区域所属的动态区域层。According to the overlapping relationship of each of the dynamic areas, the dynamic area layer to which each of the dynamic areas belongs is determined.
  4. 根据权利要求1所述的方法,其特征在于,所述加载所述动态区域层,生成所述动态区域层的动态区域内的动态区域寻路数据,包括:The method of claim 1, wherein loading the dynamic area layer and generating dynamic area pathfinding data within the dynamic area of the dynamic area layer includes:
    执行动态区域寻路数据生成过程,并在执行所述动态区域寻路数据生成过程的过程中,过滤不在所述动态区域层的动态区域内的数据;Execute a dynamic area pathfinding data generation process, and in the process of executing the dynamic area pathfinding data generation process, filter data that is not within the dynamic area of the dynamic area layer;
    所述动态区域寻路数据生成过程包括:The dynamic area pathfinding data generation process includes:
    加载所述动态区域层的动态地图场景;Load the dynamic map scene of the dynamic area layer;
    对所述动态地图场景进行3D场景体素化,获得动态地图体素数据;Perform 3D scene voxelization on the dynamic map scene to obtain dynamic map voxel data;
    过滤所述动态地图体素数据中的不可行走区域,获得动态地图可走区域体素数据;Filter the unwalkable areas in the dynamic map voxel data to obtain the walkable area voxel data of the dynamic map;
    简化所述动态地图可走区域体素数据中的轮廓线,获得简化轮廓线后的动态地图可走区域数据;Simplify the contour lines in the voxel data of the dynamic map walkable area, and obtain the dynamic map walkable area data after the simplified contour lines;
    基于所述动态地图可走区域数据生成多边形;Generate polygons based on the dynamic map traversable area data;
    基于各所述多边形生成细节网络,并基于所述细节网络获得动态区域寻路数据。A detail network is generated based on each of the polygons, and dynamic area pathfinding data is obtained based on the detail network.
  5. 根据权利要求4所述的方法,其特征在于:所述在执行所述动态区域寻路数据生成过程的过程中,过滤不在所述动态区域层的动态区域内的数据,包括以下各项中的至少一项:The method according to claim 4, characterized in that: in the process of executing the dynamic area pathfinding data generation process, filtering data that is not within the dynamic area of the dynamic area layer includes: At least one:
    第一项:First item:
    在对所述动态地图场景进行3D场景体素化之前,过滤不在所述动态区域层的动态区域内的三角形;Before performing 3D scene voxelization on the dynamic map scene, filtering triangles that are not within the dynamic area of the dynamic area layer;
    第二项:second section:
    在所述获得动态地图体素数据之后,所述过滤所述动态地图体素数据中的不可行走区域之前,过滤不在所述动态区域层的动态区域内的体素;After obtaining the dynamic map voxel data and before filtering the non-walkable areas in the dynamic map voxel data, filter voxels that are not within the dynamic area of the dynamic area layer;
    第三项:the third item:
    所述基于所述动态地图可走区域数据生成多边形,包括:Generating polygons based on the traversable area data of the dynamic map includes:
    基于所述动态地图可走区域数据,生成只位于所述动态区域层的动态区域内的多边形; Based on the dynamic map traversable area data, generate polygons located only within the dynamic area of the dynamic area layer;
    第四项:Item 4:
    所述基于所述动态地图可走区域数据生成多边形之后,所述基于各所述多边形生成细节网络之前,还包括:After the polygons are generated based on the traversable area data of the dynamic map and before the detail network is generated based on each of the polygons, the method further includes:
    过滤掉不在所述动态区域层的动态区域内的多边形。Filter out polygons that are not within the dynamic area of the dynamic area layer.
  6. 根据权利要求1或2所述的方法,其特征在于,所述建立所述动态区域层和所述基础区域层的拼接信息,包括:The method according to claim 1 or 2, characterized in that establishing the splicing information of the dynamic area layer and the basic area layer includes:
    遍历所述动态区域层的动态区域寻路数据的动态层边界,所述动态层边界包括各动态层边界线段;Traverse the dynamic layer boundary of the dynamic area pathfinding data of the dynamic area layer, where the dynamic layer boundary includes each dynamic layer boundary line segment;
    查找所述基础区域寻路数据中与所述动态层边界线段匹配的目标基础层边界线段;Search for the target base layer boundary line segment in the base area pathfinding data that matches the dynamic layer boundary line segment;
    若查找到与所述动态层边界线段匹配的目标基础层边界线段,建立所述动态层边界线段与所述目标基础层边界线段的线段连接关系;If a target base layer boundary line segment matching the dynamic layer boundary line segment is found, establish a line segment connection relationship between the dynamic layer boundary line segment and the target base layer boundary line segment;
    所述动态区域层和所述基础区域层的拼接信息,包括所述线段连接关系。The splicing information of the dynamic area layer and the basic area layer includes the line segment connection relationship.
  7. 根据权利要求6所述的方法,其特征在于,所述查找所述基础区域寻路数据中与所述动态层边界线段匹配的目标基础层边界线段,包括:The method according to claim 6, characterized in that the search for the target base layer boundary line segment matching the dynamic layer boundary line segment in the base area pathfinding data includes:
    遍历获得所述基础区域寻路数据的基础层边界,所述基础层边界包括各基础层边界线段;Traverse to obtain the base layer boundary of the base area pathfinding data, where the base layer boundary includes each base layer boundary line segment;
    若满足投影条件,确定将所述动态层边界线段和所述基础层边界线段投影到目标坐标轴的第一投影重叠区域;If the projection conditions are met, determine the first projection overlap area that projects the dynamic layer boundary line segment and the base layer boundary line segment to the target coordinate axis;
    若所述第一投影重叠区域与第二投影重叠区域不重叠,确定所述基础层边界线段为匹配的目标基础层边界线段,所述第二投影重叠区域为将已查找到的已有目标基础层边界线段与所述动态层边界线段投影到所述目标坐标轴的重叠区域。If the first projection overlapping area and the second projection overlapping area do not overlap, the base layer boundary line segment is determined to be the matching target base layer boundary line segment, and the second projection overlapping area is the found existing target base layer. The layer boundary line segment and the dynamic layer boundary line segment are projected to the overlapping area of the target coordinate axis.
  8. 根据权利要求7所述的方法,其特征在于:所述方法还包括:The method according to claim 7, characterized in that: the method further includes:
    若所述第一投影重叠区域与所述第二投影重叠区域重叠,确定所述基础层边界线段是否优于所述已有目标基础层边界线段;If the first projection overlap area overlaps with the second projection overlap area, determine whether the base layer boundary line segment is better than the existing target base layer boundary line segment;
    若所述基础层边界线段优于所述已有目标基础层边界线段,将所述已有目标基础层边界线段从已查找到的目标基础层边界线段列表中删除,并将所述基础层边界线段确定为匹配的目标基础层边界线段;If the base layer boundary line segment is better than the existing target base layer boundary line segment, the existing target base layer boundary line segment is deleted from the found target base layer boundary line segment list, and the base layer boundary line segment is deleted. The line segment is determined as the matching target base layer boundary line segment;
    否则,确定所述基础层边界线段不是匹配的目标基础层边界线段。Otherwise, it is determined that the base layer boundary line segment is not a matching target base layer boundary line segment.
  9. 根据权利要求8所述的方法,其特征在于:若所述动态层边界线段与所述基础层边界线段的距离,小于所述动态层边界线段与所述已有目标基础层边界线段的距离,或者,所述动态层边界线段与所述基础层边界线段的夹角,小于所述动态层边界线段与所述已有目标基础层边界线段的夹角,确定所述基础层边界线段优于所述已有目标基础层边界线段。The method according to claim 8, characterized in that: if the distance between the dynamic layer boundary line segment and the base layer boundary line segment is less than the distance between the dynamic layer boundary line segment and the existing target base layer boundary line segment, Or, the angle between the dynamic layer boundary line segment and the base layer boundary line segment is smaller than the angle between the dynamic layer boundary line segment and the existing target base layer boundary line segment, and it is determined that the base layer boundary line segment is better than the base layer boundary line segment. Describe the boundary line segment of the existing target base layer.
  10. 一种寻路方法,其特征在于,所述寻路方法包括:A path-finding method, characterized in that the path-finding method includes:
    加载寻路数据,所述寻路数据包括目标寻路数据,所述目标寻路数据包括:基础区域层的基础区域寻路数据,标记为开启的动态区域层的动态区域寻路数据;Load pathfinding data, the pathfinding data includes target pathfinding data, and the target pathfinding data includes: basic area pathfinding data of the basic area layer, and dynamic area pathfinding data of the dynamic area layer marked as turned on;
    获得起点信息和终点信息;Obtain starting point information and end point information;
    基于所述起点信息和所述终点信息,在所述目标寻路数据中进行寻路,获得寻路路径。Based on the starting point information and the end point information, path finding is performed in the target path finding data to obtain a path finding path.
  11. 根据权利要求10所述的方法,其特征在于:加载的所述寻路数据,还包括非目标寻路数据,所述非目标寻路数据包括标记为未开启的动态区域层的动态区域寻路数据。The method according to claim 10, characterized in that: the loaded pathfinding data also includes non-target pathfinding data, and the non-target pathfinding data includes dynamic area pathfinding marked as an unopened dynamic area layer. data.
  12. 根据权利要求10或11所述的方法,其特征在于:基于所述起点信息和所述终点信息,在所述目标寻路数据中进行寻路,获得寻路路径,包括:The method according to claim 10 or 11, characterized in that: based on the starting point information and the end point information, performing path finding in the target path finding data to obtain a path finding path, including:
    确定所述起点信息所属的起点多边形,所述终点信息所属的终点多边形;Determine the starting point polygon to which the starting point information belongs and the end point polygon to which the end point information belongs;
    自所述起点多边形开始寻路,在所述目标寻路数据中进行寻路,依次寻找扩展的邻 接多边形,直至寻找到所述终点多边形,获得所述寻路路径;Start pathfinding from the starting point polygon, perform pathfinding in the target pathfinding data, and search for extended neighbors in sequence. Connect polygons until the end point polygon is found, and the pathfinding path is obtained;
    其中,所述寻找扩展的邻接多边形,包括:Wherein, the search for extended adjacent polygons includes:
    确定与当前已扩展多边形相邻的多边形;Determine the polygons adjacent to the currently expanded polygon;
    确定所述相邻多边形所属的区域;Determine the area to which the adjacent polygon belongs;
    若所述相邻多边形所属的区域为基础区域层中的区域,将所述相邻多边形确定为扩展的邻接多边形;If the area to which the adjacent polygon belongs is an area in the basic area layer, determine the adjacent polygon as an extended adjacent polygon;
    若所述相邻多边形所属的区域为动态区域,所述动态区域开启,且所述动态区域所属的动态区域层开启,将对应动态区域层的所述相邻多边形确定为扩展的邻接多边形;If the area to which the adjacent polygons belong is a dynamic area, the dynamic area is turned on, and the dynamic area layer to which the dynamic area belongs is turned on, the adjacent polygons corresponding to the dynamic area layer are determined as extended adjacent polygons;
    若所述动态区域未开启或者所述动态区域层未开启,寻找下一个相邻的相邻多边形,返回确定所述相邻多边形所属的区域的步骤,其中,所述下一个相邻的相邻多边形位于所述当前已扩展多边形所在的区域层,或者,所述下一个相邻的相邻多边形位于所述当前已扩展多边形所在的区域层的上一层区域层,或者,所述下一个相邻的相邻多边形位于所述基础区域层。If the dynamic area is not turned on or the dynamic area layer is not turned on, search for the next adjacent adjacent polygon, and return to the step of determining the area to which the adjacent polygon belongs, wherein the next adjacent adjacent polygon is The polygon is located in the region layer where the current expanded polygon is located, or the next adjacent adjacent polygon is located in the region layer above the region layer where the current expanded polygon is located, or the next adjacent polygon is located in the region layer where the current expanded polygon is located. Neighboring adjacent polygons are located in the base region layer.
  13. 根据权利要求10或11所述的方法,其特征在于:在加载所述目标寻路数据之前,所述方法还包括:The method according to claim 10 or 11, characterized in that: before loading the target pathfinding data, the method further includes:
    获取已开启的动态区域层以及已开启的动态区域;Get the enabled dynamic area layer and the enabled dynamic area;
    针对已开启的动态区域层中的已开启的动态区域,生成已开启的动态区域层的动态区域寻路数据,并生成所述基础区域层与所述动态区域层的拼接信息。For the enabled dynamic region in the enabled dynamic region layer, generate dynamic region pathfinding data of the enabled dynamic region layer, and generate splicing information of the basic region layer and the dynamic region layer.
  14. 一种寻路数据的生成装置,其特征在于,所述装置包括:A device for generating pathfinding data, characterized in that the device includes:
    动态层确定模块,用于确定目标场景中的动态区域层,所述动态区域层中包括至少一个动态区域;A dynamic layer determination module, used to determine the dynamic area layer in the target scene, where the dynamic area layer includes at least one dynamic area;
    基础数据生成模块,用于加载所述目标场景的基础区域层的基础场景数据,基于所述基础场景数据生成所述基础区域层的基础区域寻路数据;A basic data generation module, configured to load basic scene data of the basic area layer of the target scene, and generate basic area pathfinding data of the basic area layer based on the basic scene data;
    动态数据生成模块,用于加载所述动态区域层,生成所述动态区域层的动态区域内的动态区域寻路数据;A dynamic data generation module, configured to load the dynamic area layer and generate dynamic area pathfinding data within the dynamic area of the dynamic area layer;
    拼接模块,用于建立所述动态区域层和所述基础区域层的拼接信息;A splicing module, used to establish the splicing information of the dynamic area layer and the basic area layer;
    数据确定模块,用于基于所述基础区域寻路数据、所述动态区域寻路数据和所述拼接信息,生成所述目标场景的寻路数据。A data determination module, configured to generate pathfinding data of the target scene based on the basic area pathfinding data, the dynamic area pathfinding data and the splicing information.
  15. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至13中任一项所述的方法的步骤。 A computer device includes a memory and a processor, the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the method described in any one of claims 1 to 13 are implemented.
PCT/CN2023/074974 2022-04-18 2023-02-08 Method for generating pathfinding data, pathfinding method, and computer device WO2023202188A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210405389.2A CN116943201A (en) 2022-04-18 2022-04-18 Generating method of path-finding data, path-finding method and computer equipment
CN202210405389.2 2022-04-18

Publications (1)

Publication Number Publication Date
WO2023202188A1 true WO2023202188A1 (en) 2023-10-26

Family

ID=88419091

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/074974 WO2023202188A1 (en) 2022-04-18 2023-02-08 Method for generating pathfinding data, pathfinding method, and computer device

Country Status (2)

Country Link
CN (1) CN116943201A (en)
WO (1) WO2023202188A1 (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060161337A1 (en) * 2005-01-19 2006-07-20 Ping-Chung Ng Route planning process
JP2012117868A (en) * 2010-11-30 2012-06-21 Aisin Aw Co Ltd Route searching device and map data for use in route searching by the same
CN106964156A (en) * 2017-03-24 2017-07-21 腾讯科技(深圳)有限公司 A kind of method for searching and device
CN111111187A (en) * 2019-11-28 2020-05-08 玩心(上海)网络科技有限公司 Online game path finding method and device based on grids
CN111737810A (en) * 2020-08-27 2020-10-02 科大讯飞(苏州)科技有限公司 Path finding method, device, equipment and storage medium
CN112221144A (en) * 2020-11-03 2021-01-15 网易(杭州)网络有限公司 Three-dimensional scene path finding method and device and three-dimensional scene map processing method and device
CN114159777A (en) * 2021-12-06 2022-03-11 网易(杭州)网络有限公司 Hierarchical way finding method and device, electronic equipment and readable medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060161337A1 (en) * 2005-01-19 2006-07-20 Ping-Chung Ng Route planning process
JP2012117868A (en) * 2010-11-30 2012-06-21 Aisin Aw Co Ltd Route searching device and map data for use in route searching by the same
CN106964156A (en) * 2017-03-24 2017-07-21 腾讯科技(深圳)有限公司 A kind of method for searching and device
CN111111187A (en) * 2019-11-28 2020-05-08 玩心(上海)网络科技有限公司 Online game path finding method and device based on grids
CN111737810A (en) * 2020-08-27 2020-10-02 科大讯飞(苏州)科技有限公司 Path finding method, device, equipment and storage medium
CN112221144A (en) * 2020-11-03 2021-01-15 网易(杭州)网络有限公司 Three-dimensional scene path finding method and device and three-dimensional scene map processing method and device
CN114159777A (en) * 2021-12-06 2022-03-11 网易(杭州)网络有限公司 Hierarchical way finding method and device, electronic equipment and readable medium

Also Published As

Publication number Publication date
CN116943201A (en) 2023-10-27

Similar Documents

Publication Publication Date Title
Miller What about people in geographic information science
CN109446281B (en) ArcGIS-based online intelligent mapping system construction method, system and mapping method
CN110399441B (en) Mass point data aggregation rendering method, device, equipment and storage medium
US20170004116A1 (en) Output rendering in dynamic redefining application
CN105190611B (en) The method and device extending transversely for database
CN106455004A (en) Method and apparatus for providing wireless access points
CN108362298A (en) Air navigation aid and device in area map
US20130332476A1 (en) Vector road network simplification
JP5509376B1 (en) How to search local tourist information based on user location
CN110070616A (en) Memory, statistical data rendering method, device and equipment based on GIS platform
CN112784002A (en) Virtual scene generation method, device, equipment and storage medium
KR102171269B1 (en) Method, apparatus and computer program for coloring of image, Method, apparatus and computer program for learning of artificial neural network
WO2023226371A1 (en) Target object interactive reproduction control method and apparatus, device and storage medium
JP7313450B2 (en) Image processing method and its device, electronic equipment and computer program
CN110019592A (en) Two three-dimensional linkage urban pipeline information management systems of one kind and its interlock method
CN111859187B (en) POI query method, device, equipment and medium based on distributed graph database
CN112541912A (en) Method and device for rapidly detecting saliency target in mine sudden disaster scene
CN102982054A (en) Information processor, information processing method and program
CN102831169B (en) Plane figure relation determining method and system in geographical information system
WO2023202188A1 (en) Method for generating pathfinding data, pathfinding method, and computer device
CN111721307A (en) Road network map generation method and related device
CN116778124A (en) Three-dimensional scene editing method, system, equipment and storage medium
CN114820960B (en) Method, device, equipment and medium for constructing map
Wang et al. AR precision navigation system based on Baidu map API
CN116050696A (en) Global power grid maintenance method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23790852

Country of ref document: EP

Kind code of ref document: A1