Route searching method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610788175.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-02
- Publication Date
- 2026-08-21
AI Technical Summary
上述一种寻路方法、装置、电子设备及存储介质,获取目标模型数据,其中,所述目标模型数据对应的目标虚拟场景中包括至少一个目标配置位置;所述目标配置位置关联有一个或多个可部署虚拟对象,且所述可部署虚拟对象处于不可渲染状态;基于目标模型数据所指示的目标场景几何体,确定目标导航网格数据;其中,目标场景几何体包含目标虚拟场景对应的基础场景几何体以及多个可部署虚拟对象对应的部署对象几何体;基于目标导航网格数据,确定目标虚拟场景中的移动路径。该方式中,基于由虚拟场景的模型数据以及多个可替换放置在虚拟场景中的指定位置的场景对象的模型数据生成了导航网格数据,无论在指定场景中放置哪一场景对象,基于该导航网格数据确定的移动路径均可以适配虚拟场景,无需基于替换的场景对象更新导航网格数据,减少了计算资源的浪费,并降低了通信网络的负担,在一定程度上提高了用户体验。
Smart Images

Figure CN122605181A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual model technology, and more specifically, to a pathfinding method, apparatus, electronic device, and storage medium. Background Technology
[0002] In games, scene buildings often support dynamic replacement, and different types of scene objects can be placed in the same location according to gameplay needs. To address the dynamic pathfinding requirements of characters, related technologies typically employ runtime online updates to the navigation grid, reconstructing local pathfinding data after a building replacement is triggered; or a conservative strategy is adopted, pre-marking the area where the dynamic building is located as impassable to maintain pathfinding stability; in addition, there are solutions that maintain multiple independent navigation grids and dynamically switch between them when a building is replaced to adapt to different building layout changes. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a pathfinding method, apparatus, electronic device and storage medium that can reduce the waste of computing resources and reduce the burden on communication networks by eliminating the need to update navigation mesh data based on replaced scene objects, thereby improving the user experience to a certain extent.
[0004] In a first aspect, embodiments of the present invention provide a pathfinding method, comprising: acquiring target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; determining target navigation mesh data based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes a basic scene geometry corresponding to the target virtual scene and deployment object geometry corresponding to multiple deployable virtual objects; and determining a movement path in the target virtual scene based on the target navigation mesh data.
[0005] Secondly, embodiments of the present invention provide a pathfinding device, comprising: a first model data acquisition module, configured to acquire target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; a navigation mesh data determination module, configured to determine target navigation mesh data based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes a basic scene geometry corresponding to the target virtual scene and deployment object geometry corresponding to multiple deployable virtual objects; and a pathfinding module, configured to determine a movement path in the target virtual scene based on the target navigation mesh data.
[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described pathfinding method.
[0007] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the aforementioned pathfinding method.
[0008] The embodiments of the present invention bring the following beneficial effects: The aforementioned pathfinding method, apparatus, electronic device, and storage medium acquire target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; target navigation mesh data is determined based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; and a movement path in the target virtual scene is determined based on the target navigation mesh data. In this method, navigation mesh data is generated based on the model data of the virtual scene and the model data of multiple replaceable scene objects placed at specified locations in the virtual scene. Regardless of which scene object is placed in the specified scene, the movement path determined based on this navigation mesh data can adapt to the virtual scene, eliminating the need to update the navigation mesh data based on the replaced scene objects. This reduces the waste of computing resources and the burden on the communication network, thereby improving the user experience to a certain extent.
[0009] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0010] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0011] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0012] Figure 1 A flowchart of a pathfinding method provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a pathfinding method in a game scene, provided as an embodiment of the present invention; Figure 3 This is a schematic diagram of the dynamic building stacking state in a game scene provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a pathfinding device provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0014] In game development, pathfinding systems are the core technology for enabling automatic character navigation. Pathfinding in games typically involves path planning based on pre-generated navigation grid data. A navigation grid is an abstract representation of walkable areas in the game scene, dividing the scene into multiple polygonal grids, each representing a passable area. Characters navigate from their starting point to their destination by moving between these grids.
[0015] With the diversification of gameplay, many games have introduced dynamic scene building replacement mechanisms, allowing players to choose different building models to place in the same location as needed during gameplay. For example, in simulation management games, players can build different types of buildings on the same plot of land; in sandbox games, players can freely replace buildings in the scene. This mechanism greatly enriches the gameplay and freedom of the game.
[0016] However, the dynamic building replacement mechanism brings new challenges to the pathfinding system. Due to the structural differences between different building models, such as differences in wall positions, internal layouts, and traversable areas, the original navigation grid data may not match the replaced building, leading to pathfinding failures or abnormal behavior of the character.
[0017] For the pathfinding problem in scenarios with dynamic building replacement, there are three main solutions: 1. Mark all potentially replaceable building areas as impassable. These areas are excluded from the wayfinding grid when generating the navigation grid.
[0018] In practical applications, during the scene preprocessing stage, the areas where dynamic buildings are located are set as obstacles, and the pathfinding algorithm will automatically bypass these areas. Regardless of what kind of building the player chooses to place in that location, it will not affect the normal operation of the pathfinding system.
[0019] While this solution is simple and stable to implement, its functionality is severely limited. Marking dynamic building areas as impassable means that characters cannot automatically pathfind into the buildings, which contradicts game design requirements. For gameplay mechanics that require pathfinding to specific locations within buildings, this solution is completely inadequate. Furthermore, this approach wastes a significant amount of available space, reducing the game's realism and immersion.
[0020] 2. Update navigation grid data in real time when players replace buildings.
[0021] In practical applications, if a building replacement event is detected, the old building's grid data needs to be removed from the global navigation grid, and the navigation grid for that area needs to be recalculated based on the new building model. Then, the new grid data is merged into the global navigation grid, and the pathfinding cache is updated.
[0022] This approach has the following drawbacks: (1) High performance overhead: Recalculating the navigation mesh is a computationally intensive operation, especially in large scenes, where it may be necessary to traverse and process a large amount of geometric data; (2) Scene size limitation: The larger the scene, the longer the mesh reconstruction time. In open-world games or large-scale MMO games, this approach can lead to noticeable lag. (3) Frequent replacement problem: If players frequently change buildings, it will repeatedly trigger grid reconstruction, continuously consuming system resources; (4) High real-time requirements: In multiplayer online games, it is necessary to synchronize the grid updates of all players, which increases the network burden.
[0023] 3. Maintain two sets of navigation meshes: a global base mesh and a dynamically mounted mesh. The global base mesh contains basic pathfinding data for the scene. When a building is replaced, an independent navigation mesh is generated for the new building, and this independent mesh is mounted to a specific location on the global mesh, forming a dynamically mounted mesh. During pathfinding, priority is given to checking if there are any mounted independent grids; if so, the independent grid data is used.
[0024] While the aforementioned dual-mesh technique avoids the reconstruction of the global mesh, it introduces new problems: (1) Increased memory usage: Each dynamic building needs to maintain an independent navigation mesh, and memory consumption increases linearly with the number of replaceable buildings; (2) Mounting and unmounting overhead: Although a single mount operation is relatively fast, frequent mounts and unmounts will still cause performance fluctuations; (3) Complex data management: It is necessary to maintain the mapping relationship between the global grid and multiple independent grids, which increases the complexity of the system.
[0025] To overcome the above problems, the loading and unloading of grid data can be performed in a background thread. However, while this method avoids blocking the main thread, it has the following issues: (1) Latency issue: Before the background calculation is completed, the area may be temporarily unable to find a path, resulting in abnormal character behavior; (2) Synchronization complexity: It is necessary to handle data synchronization between the main thread and the background thread, which increases the programming complexity; (3) Resource contention: When multiple threads access and modify grid data at the same time, locking is required to protect them, which may cause performance bottlenecks.
[0026] In summary, the above solutions have varying degrees of deficiencies in terms of performance, memory, and functional completeness, making it difficult to perfectly support the dynamic building replacement function while ensuring smooth game operation.
[0027] Based on this, embodiments of the present invention provide a pathfinding method, apparatus, electronic device, and storage medium, which can be applied to live streaming scenarios.
[0028] See Figure 1 First, a pathfinding method provided by an embodiment of the present invention will be introduced. The method includes the following steps: Step S102: Obtain target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in an unrenderable state.
[0029] The aforementioned target virtual scene typically refers to a 3D virtual model with terrain and topographic representation. This model can be generated by relevant personnel using 3D modeling software, or it can be generated using artificial intelligence technology, or it can be generated based on data obtained from scanning real-world scenes. The specific settings can be configured according to requirements and are not limited here.
[0030] Target virtual scenes typically have corresponding model data. Engines with virtual model rendering capabilities, such as game engines and virtual scene viewing engines, can render and generate the target virtual scene based on the corresponding model data, and display it in the graphical user interface.
[0031] A target virtual scene can include one or more target configuration locations. Users can deploy scene objects at target configuration locations using commands, or replace scene objects deployed at target configuration locations using commands. Scene objects that can be placed at target configuration locations can be called "deployable virtual objects." These deployable virtual objects typically refer to three-dimensional virtual models with fixed or controllable forms, which can be used to simulate living or non-living things; for example, deployable virtual objects can simulate buildings. There can typically be multiple deployable virtual objects deployed at target configuration locations, and the specific configuration can be tailored to requirements.
[0032] To ensure that the subsequently generated target navigation mesh data is applicable to situations where any deployable virtual object is placed at the target configuration location, multiple deployable virtual objects corresponding to the target configuration location are typically added to the target virtual scene. At each target configuration location, multiple deployable virtual objects are usually stacked. Then, the model data corresponding to the target virtual scene with the added deployable virtual objects can be exported as the target model data. The target model data typically includes the model data corresponding to the target virtual scene, the model data corresponding to the deployable virtual objects, and data representing the relative positional and connection relationships between them.
[0033] To ensure that only the target virtual scene is rendered from the target model data, all deployable virtual objects can be set to non-renderable. This can be achieved by modifying the attribute parameters of the model data corresponding to the placeable attributes. Therefore, when rendering a 3D model based on the target model data, only the target virtual scene is generated, achieving the same effect as rendering the target virtual scene directly from the model data corresponding to the target virtual scene.
[0034] Step S104: Determine the target navigation mesh data based on the target scene geometry indicated by the target model data; wherein, the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects.
[0035] The target model data is the model data of the static model formed after deployable virtual objects are added to the target virtual scene. The target scene geometry indicated by the target model data includes both the base scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to each deployable virtual object.
[0036] The base scene geometry describes the shape and size of the base scene objects representing the terrain of the target virtual scene. The deployment object geometry describes the shape and size of the deployable virtual objects. Both base scene objects and deployable virtual objects are typically 3D virtual models. The surface of a 3D virtual model is usually composed of multiple polygonal primitives, such as triangles and quadrilaterals. Each primitive is composed of multiple vertices. The 3D models corresponding to the base scene objects and deployable virtual objects can be directly used as their corresponding geometry, or the 3D models can be simplified, using the colliders corresponding to the base scene objects and deployable virtual objects as their corresponding geometry. A collider in a virtual model is an invisible geometric shape defined for the virtual model in a 3D game or physics simulation engine, used to detect whether the model collides with other objects.
[0037] In generating target navigation mesh data, the target scene geometry can be discretized into voxels. Based directly on the triangular mesh on the surface of the target scene geometry, walkable polygons are determined through steps such as region growing, plane segmentation, and Boolean subtraction (for removing obstacles). During this process, concave polygons need to be segmented into convex regions, and the edge connections between adjacent regions need to be calculated to generate the target navigation mesh data.
[0038] The generation process of the above target navigation grid data takes into account the accessibility of multiple deployable scene objects that will be deployed at the target scene location. No matter which deployable scene object is deployed at the target scene location, the navigation grid indicated by the target navigation grid data will not be affected.
[0039] Step S106: Determine the movement path in the target virtual scene based on the target navigation grid data.
[0040] The process of determining the movement path can be performed before or during the use of the target virtual scene. For example, the starting point and ending point in the target virtual scene can be pre-listed. Then, based on the target navigation grid data, the movement path between the starting point and the ending point can be determined.
[0041] Furthermore, after the target virtual scene is rendered, pathfinding events can be triggered during the user's use of the target virtual scene, and the movement path can be determined based on the pathfinding events and target navigation grid data. These pathfinding events can be triggered by the user or by the system. For example, in a game, a player can select a virtual character in the virtual scene, thereby triggering the aforementioned pathfinding event; the game system can also control the movement of non-player characters within the game's virtual scene by triggering pathfinding events.
[0042] The aforementioned pathfinding events typically have corresponding path start and path end points. When the virtual scene includes user-controlled virtual objects, the path start point is usually the current position of the controlled virtual object in the target virtual scene, and the path end point can be specified by the player, or it can be the scene location corresponding to a game task or game item selected by the player; there are no restrictions here.
[0043] When the target virtual scene does not include controlled virtual objects, the path start and end points can both be specified by the user. For example, the user can input location coordinates to specify the path start and end points, or input location identifiers to specify the path start and end points, similar to the way navigation is done using map software. The specific settings can be configured according to needs and are not restricted here.
[0044] The movement path can be determined based on target navigation grid data and the path start and end points corresponding to pathfinding events. Specifically, the pathfinding process can be implemented using various algorithms, such as A... Algorithms, StringPulling, Hierarchical Pathfinding, Local Aspect Ratio Algorithm, Theta Algorithms, etc. Specific settings can be customized to meet individual needs.
[0045] The aforementioned pathfinding method acquires target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; target navigation mesh data is determined based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes the base scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; and a movement path in the target virtual scene is determined based on the target navigation mesh data. In this method, navigation mesh data is generated based on the model data of the virtual scene and the model data of multiple replaceable scene objects placed at specified locations in the virtual scene. Regardless of which scene object is placed in the specified scene, the movement path determined based on this navigation mesh data can adapt to the virtual scene, eliminating the need to update the navigation mesh data based on the replaced scene objects. This reduces the waste of computing resources and lowers the burden on the communication network, thereby improving the user experience to some extent.
[0046] In one specific embodiment, the aforementioned target model data includes model data of basic scene objects and model data sets corresponding to each target configuration location. The aforementioned basic scene objects typically refer to the overall terrain model that forms the target game scene. The model data set corresponding to each target configuration location includes model data of each deployable virtual object deployed at the corresponding target configuration location. For example, if scene object 1, scene object 2, and scene object 3 can be placed at a certain target configuration location, then its corresponding model data set includes model data of scene object 1, scene object 2, and scene object 3. In addition to vertex data used to generate the deployable virtual object model, the model data typically also indicates one or more of the following: the position, orientation, and scaling of the deployable virtual object in the virtual scene. When a deployable virtual object is placed at a target configuration location and its orientation and scaling can be changed, corresponding model data needs to be generated for each orientation and each scaling.
[0047] The following embodiments provide a method for determining target navigation mesh data based on the target scene geometry indicated by the target model data.
[0048] In practical applications, the target scene geometry needs to be discretized to obtain a voxel mesh. Since there are multiple target scene geometries, each target scene geometry needs to be discretized, that is, the polygon mesh corresponding to the target scene geometry needs to be converted into a regular three-dimensional cubic mesh (called a voxel). Each voxel represents a cubic unit in space.
[0049] After obtaining the voxel mesh, it is necessary to determine the passable area in the virtual space where the virtual scene is located, based on the voxel mesh. The passable area usually refers to the space area not occupied by voxels. In specific implementation, if the first spatial position in the virtual space is located inside the voxel mesh of any geometry in the target scene geometry, it is determined that the first spatial position is outside the passable area. The first spatial position can be any position in the virtual space.
[0050] After determining the passable area, target navigation mesh data is generated based on this area. Surface contours are extracted from the corresponding voxel regions within the passable area, the number of vertices is reduced using a polygon simplification algorithm, and then triangulation or polygon decomposition is performed to generate the target navigation mesh data.
[0051] To ensure that any deployable virtual object placed at the target location can pass through the interior of that scene object, it is typically pre-set that all deployable virtual objects corresponding to the same target location have the same preset passable area, and that the exit and entrance positions of each deployable virtual object are relatively aligned.
[0052] The aforementioned preset traversable area can refer to the entire traversable area of a deployable virtual object, or it can refer to a portion of the traversable area of a deployable virtual object. When there are multiple deployable virtual objects corresponding to the same target configuration location, the aforementioned preset traversable area usually refers to the intersection of the traversable areas of the multiple deployable virtual objects corresponding to that target configuration location. When designing the model of a deployable virtual object, it is necessary to ensure in advance that this area is a traversable area.
[0053] The aforementioned preset passable areas can be located inside or on the surface of a deployable virtual object. Since the same target configuration location may correspond to multiple deployable scene objects, there may be situations where the preset passable area on the surface of a deployable scene object is different from the preset passable area inside another deployable scene object. The specific settings can be configured according to requirements and are not restricted here.
[0054] In the process of generating target model data, in order to reduce the amount of computation required to generate target navigation mesh data in the future, only some scene objects from multiple scene objects that can be placed at the target configuration location can be added to the target virtual scene as deployable virtual objects.
[0055] First, multiple candidate deployable virtual objects corresponding to the target configuration location can be obtained, i.e., all scene objects that can be placed at the target configuration location are identified. Then, the structural similarity of these candidate deployable virtual objects is determined when placed at the target configuration location. Based on the structural similarity of these candidate deployable virtual objects, multiple sets of scene objects are determined; the structural similarity of multiple candidate deployable virtual objects in each scene object set is greater than a preset similarity threshold. For example, multiple candidate deployable virtual objects with a similarity threshold greater than 80% can be placed in the same set. Then, a candidate scene object can be selected from each scene object set, and this selected candidate scene object is designated as the deployable virtual object corresponding to the target configuration location. This method reduces the amount of target model data, thereby reducing the computational resources consumed in determining the target navigation mesh data.
[0056] In practical applications, the target virtual scene needs to be rendered based on the model data of scene objects in a renderable state within the target model data. In the actual implementation, the instantiation process of scene objects in a non-renderable state is skipped. In this case, the renderable scene objects will not be displayed in the target virtual scene; that is, the various deployable virtual objects will not be shown.
[0057] Users can deploy scene objects at target configuration locations via commands. These commands are typically generated through human-computer interaction devices. In response to an object deployment command for a first scene location within at least one target configuration location, the system acquires the visual model data of the target object corresponding to the object deployment command; the target object is at least one of one or more deployable virtual objects associated with the first scene location. This model data is used to dynamically generate the target deployable virtual object. Based on the visual model data of the target object, the target object is rendered and generated in real-time at the first scene location within the target virtual scene. In this case, the target deployable virtual object can generally be considered a dynamic model.
[0058] The following embodiments provide an implementation method for determining a movement path in a virtual scene based on target navigation grid data in response to a pathfinding event triggered for the virtual scene.
[0059] The virtual scene described above can be divided into multiple sub-scene regions. When generating the target navigation mesh data, navigation mesh data corresponding to each sub-scene region is typically generated separately. Correspondingly, the target navigation mesh data includes the sub-navigation mesh data corresponding to each sub-scene region.
[0060] The virtual scene can include controlled virtual objects, which are typically virtual characters controlled by the user through a terminal device. In response to a pathfinding event triggered in the virtual scene, target sub-navigation grid data is determined based on the sub-scene region where the controlled virtual object is located. Typically, the sub-navigation grid data corresponding to the sub-scene region where the controlled virtual object is located is defined as the target sub-navigation grid data. Further, the movement path of the controlled virtual object in the virtual scene can be determined based on the target sub-navigation grid data. When the path endpoint and the location of the controlled virtual object are in different sub-scene regions, the sub-navigation grid data corresponding to the sub-scene region where the path endpoint is located, the sub-scene region where the controlled virtual object is located, and the sub-scene regions in between can all be considered as the target sub-navigation grid data.
[0061] The following embodiments provide an implementation of the above pathfinding method when the virtual scene is a game scene and all deployable virtual objects are virtual buildings (also known as "dynamic buildings").
[0062] In the scene post-processing stage (offline mode), this process simultaneously adds all dynamic building models that might appear in the same location to the scene, forming a stacked building state; then, target navigation mesh data is generated based on this stacked scene. Since the target navigation mesh data contains the geometric information of all buildings, it can be used for correct pathfinding regardless of which building the player selects during gameplay.
[0063] like Figure 2 As shown, this process is achieved through the following steps: 1. Generate a model data set corresponding to the target configuration location: This usually requires recording information such as the model resources, placement location, and orientation of all dynamic buildings, and forming a dynamic building data table; When constructing a dynamic building data table, a template is typically designed in advance, such as an Excel template. This template can include the following parameters: buildingID (unique building identifier); modelPath (building model resource path), for example: / Models / Buildings / House_Type1.fbx; positionX, positionY, positionZ (world coordinates of the building in the scene); rotationX, rotationY, rotationZ (rotation angle of the building); scaleX, scaleY, scaleZ (scale ratio of the building); locationGroup (location group identifier, which is the identifier corresponding to the placement target configuration location; virtual key groups within the same group can be interchanged); buildingType (building type label, such as: residential, commercial, decorative), etc. Specific settings can be configured according to requirements and are not limited here.
[0064] The data table generated by this template needs to accurately record all spatial transformation information of the dynamic building at the target configuration location, ensuring that the building can be accurately placed in the design location.
[0065] Staff can manually fill in the virtual building data into an Excel template. After uploading the building data to the corresponding server of the version control tool (SVN), the data conversion tool will run automatically. This tool will convert the data in the Excel file into an Extensible Markup Language (XML) file for later use.
[0066] The pseudocode for the data transformation tool is as follows: Algorithm ConvertExcelToXML(excelFilePath, xmlOutputPath) sheet ← LoadExcelSheet(excelFilePath, "DynamicBuildings") rootNode ← CreateElement("BuildingConfigs") for i ← 2 to sheet.rowCount do row ← sheet.GetRow(i) / / Create a Building node and set its properties buildingNode ← CreateElement("Building") buildingNode.SetAttribute("id", row["buildingID"]) buildingNode.SetAttribute("model", row["modelPath"]) ... rootNode.AppendChild(buildingNode) end for SaveAsXML(rootNode, xmlOutputPath, encoding="utf-8") End Algorithm 2. Offline scene editing: Add dynamic buildings to the virtual scene as non-drawable entities to form target model data; This process requires importing all dynamic building data into the scene file using a tool, while ensuring that they are invisible during game runtime.
[0067] Different game engines use different scene file formats and organizational structures. For example, for the Unity engine, the scene file format is .unity, stored in YAML format (Unity 2018 and above), and includes information such as the GameObject hierarchy, component configuration, and Transform. For Unreal Engine, the scene file format is .umap, using binary format, and contains serialized data of Actors and their components. For custom-developed engines, .map, .level, or custom formats can be used, depending on the engine architecture design.
[0068] Dynamic building data can be imported into the scene file using tools compatible with the target engine's scene file format. Taking the Unity engine as an example, the specific implementation process is as follows: For Unity's YAML scene files, the existing .unity file's YAML structure needs to be parsed, along with the dynamic building data table (XML). An entity structure needs to be built for each dynamic building in the table. Based on the dynamic building data, components such as Transform and MeshFilter / MeshRenderer are added to each entity, and values are written into these components. The Transform component is a fundamental component of all GameObjects, responsible for controlling the object's position, rotation, and scaling. The MeshFilter / MeshRenderer components are primarily used to store and access mesh data. To prevent dynamic buildings from being displayed during the generation of the target virtual scene, the Entity's HideFlags can be set to HideFlags.DontSaveInBuild or a custom tag can be used to prevent them from being loaded into the runtime scene during the build process. Then, a MeshCollider component is added to navigate mesh generation, and based on the position data, the created Entities are written to a specified hierarchy (such as the scene root node or a dedicated parent node). Finally, the modified data is serialized back to YAML format and saved.
[0069] In the process described above, after adding non-drawable tags (such as `NO_RENDER`, `ENTITY_FLAG_NO_RENDER`, etc.), the geometry data and colliders of the Entity exist completely in the scene file during the offline phase and can be perceived and processed during navigation mesh generation. During the runtime phase, when the game loads the scene, the engine checks the Entity tags and skips Entities with non-drawable tags, preventing them from being instantiated into the runtime scene. This approach makes Entities essentially "empty Entities" at runtime, consuming no rendering resources, memory, or CPU overhead, but their geometric information has already been used for offline navigation mesh generation.
[0070] like Figure 3 As shown, this illustrates the appearance of five dynamic buildings stacked in the same location within a scene. The five dynamic buildings overlap with each other, and based on this scene, NavMesh data that ultimately adapts to all dynamic models can be generated.
[0071] 3. Navigation Mesh Generation: Calculate target navigation mesh data based on target model data (corresponding to the target virtual scene containing all dynamic buildings); After adding all dynamic buildings to the virtual scene, it is necessary to calculate the general target navigation mesh data based on the scene containing all dynamic buildings.
[0072] Specifically, a voxel-based navigation mesh generation method (such as the Recast Navigation algorithm) can be used. This method discretizes the 3D scene space into a voxel mesh, extracts walkable areas through spatial analysis, and generates polygonal meshes. The specific steps include: (1) Convert the scene geometry (including the terrain of the virtual scene and the colliders of all entities) into a three-dimensional voxel array at the configured voxel resolution and mark the traversable properties of each voxel.
[0073] (2) Based on the physical parameters of the virtual character in the virtual scene, such as height, radius, climbing ability, slope limit, etc., filter out the voxel area that meets the passage conditions and remove areas that are suspended, too steep or have insufficient height.
[0074] (3) Extract the surface contour from the walkable voxel region, reduce the number of vertices by polygon simplification algorithm, and then perform triangulation or polygon decomposition to generate a set of navigation polygons.
[0075] (4) Calculate the connection relationship between adjacent polygons, establish a polygon adjacency graph, record shared boundary information, and provide a graph structure basis for the pathfinding algorithm.
[0076] Since multiple dynamic building entities at the same location have been added to the scene simultaneously, the navigation mesh generation algorithm will perceive the collision geometry of all buildings during the voxelization stage. The following key points should be followed when generating navigation mesh data: (1) Spatial intersection principle: When the geometry of multiple buildings overlaps in the same spatial location, the voxelization process adopts the "logical AND" strategy to determine the accessibility of that location - the generated navigation mesh will only contain accessible polygons at that location if all buildings are accessible at that location.
[0077] (2) Obstacle merging: If any building has an obstacle at a certain location, such as a wall or pillar, that location is marked as an impassable area in the final navigation grid, ensuring that the character will not attempt to cross that location regardless of which building is selected at runtime.
[0078] (3) Corridor Alignment Requirements: For areas where characters need to pass through, such as doorways and corridors, all replaceable buildings must maintain a consistent geometric layout at that location. If the corridor location of a building is inconsistent with that of other buildings, a passable mesh cannot be generated at that location, causing all building replacement schemes to be unable to find their way in that area.
[0079] To ensure the effectiveness of the navigation grid, the following specifications must be followed when designing virtual buildings: All buildings within the same location group must have their entrances and exits strictly aligned; differences in internal room layouts should be limited to non-critical path areas; critical passage widths should be consistent to meet the minimum requirement of agentRadius, which is the collision radius of a character and the minimum requirement affecting passage width.
[0080] The pseudocode for generating target navigation mesh data is shown below: Algorithm GenerateNavMesh(sceneFile, outputNavMeshFile) / / Load the scene containing all dynamic building entities scene ← LoadSceneWithDynamicBuildings(sceneFile) / / Configure navigation mesh generation parameters config ← { cellSize: 0.3, cellHeight: 0.2, agentHeight: 2.0, agentRadius: 0.6, agentMaxClimb: 0.9, agentMaxSlope: 45.0 } / / Extract all collision geometry (including undrawable entities) in the scene. geometries ← ExtractCollisionGeometries(scene) / / Execute navigation mesh generation algorithm navmesh ← RecastNavigationAlgorithm(geometries, config) / / Optimize the mesh structure (polygon merging, simplification) navmesh ← OptimizeNavMesh(navmesh) / / Serialize and save navigation mesh data SaveNavMeshToFile(navmesh, outputNavMeshFile) End Algorithm During the generation of target navigation mesh data, it is necessary to ensure that the collision components of all dynamic building entities in the scene are correctly configured and that the collision layer markers are recognizable by the navigation mesh generation algorithm. The selection of parameters cellSize and cellHeight should be based on the minimum channel width of the scene to avoid loss of detail. After generation, the mesh coverage should be checked using visualization tools to confirm that the navigation polygons of the dynamic building areas have been correctly generated. For large scenes, a block generation strategy can be adopted to divide the scene into multiple tiles and generate them in parallel to improve processing efficiency.
[0081] The generated target navigation mesh data is stored in a compact binary format, primarily containing the following data structures: a polygon set, used to store attributes such as a list of vertex indices, center point coordinates, and area for each polygon; a vertex array, identifying a shared pool of vertex coordinates for all polygons; an adjacency table, used to record the IDs of adjacent polygons and shared edge information for each polygon; and metadata, including auxiliary information such as generation parameters, version number, and scene identifier. The data format needs to support fast runtime loading and memory mapping to avoid parsing overhead.
[0082] 4. Perform connectivity verification to ensure that the navigation grid inside and outside the dynamic building is correctly connected.
[0083] In practical applications, a systematic verification process is needed to ensure that the generated navigation grid meets functional requirements, especially to verify the spatial connectivity inside and outside the dynamic building area.
[0084] The connectivity verification of the navigation mesh is based on connectivity determination algorithms in graph theory. The navigation mesh can be abstracted as an undirected graph G=(V,E), where vertices V represent navigation polygons and edges E represent adjacency relationships between polygons. The core of connectivity verification is determining whether a reachable path exists between the set of polygons inside the building and the set of polygons outside.
[0085] The pseudocode for verifying the algorithm flow is as follows: Algorithm VerifyBuildingConnectivity(navmesh, buildingBounds) / / 1. Spatial partitioning: dividing the set of inner and outer polygons interiorSet ←
[0086] boundarySet ←
[0087] for each polygon P in navmesh.polygons do if BoundingBoxContains(buildingBounds, P.centroid) then interiorSet ← interiorSet ∪ {P} end if end for / / 2. Boundary identification: Finding inner and outer connected edges for each P in interiorSet do for each neighborID in P.adjacencyList do N ← navmesh.GetPolygon(neighborID) if N interiorSet then boundarySet ← boundarySet ∪ {(P, N)} end if end for end for / / 3. Connectivity Determination if boundarySet = then return ISOLATED / / Completely closed, no connections else return CONNECTED / / There is at least one entrance / exit end if When connectivity verification fails, initiate the problem diagnosis process: (1) Examine the entrance and exit design of the virtual building model and identify the geometric elements that cause closure. Compare the doorways and passageways of all buildings within the same location group; generate a difference heatmap and mark the inconsistent areas.
[0088] (2) Provide correction solutions based on the analysis results: If the doorway is not aligned: adjust the building rotation angle or modify the model; If the passage is blocked by obstacles: modify the collision body settings or adjust the building layout; If the NavMesh generation parameters are inappropriate: adjust parameters such as cellSize and agentRadius.
[0089] (3) Closed-loop verification Based on the feedback, the relevant staff modified the building model and generated a new navigation mesh using the modified virtual building; the connectivity verification was run again until it passed.
[0090] In some scenarios, not all buildings need to be stacked. The geometric similarity of building models can be analyzed. For buildings with similar structural heights, only one representative building can be stacked. For buildings with completely identical layouts (only the textures or decorations are different), they can share the same navigation mesh.
[0091] In practical implementation, a "similarityGroup" field can be added to the constructed dynamic building data table to mark geometrically similar buildings, and only the entity of the representative building of each similarity group can be added to the target virtual scene.
[0092] For extremely large scenes, the scene can be divided into multiple regions, with each region generating its own navigation mesh. Each scene region can be labeled with a region identifier, and a navigation mesh can be generated for each region separately. At runtime, the corresponding navigation mesh file is loaded based on the region where the character is located to achieve pathfinding. This approach can further reduce memory usage but increases the complexity of data management.
[0093] For certain special buildings, such as super-large buildings or buildings with extremely complex geometry, a hybrid strategy can be adopted. While most regular buildings use the stacking method described above, a few special buildings use a dual-mesh scheme, dynamically mounted at runtime. In the specific implementation, special buildings can be marked, but the process of generating entities for special buildings and adding entities to the target virtual scene is not performed; instead, an independent navigation mesh is generated separately for each special building.
[0094] The above method has the following advantages: 1. Since the navigation mesh is fully generated before the game is released, no mesh calculations, updates, or merging operations are required during game runtime. Compared to existing online update solutions, runtime computational overhead is completely eliminated, and there will be no lag due to building replacements, regardless of the scene size. By setting the undrawable flag in step two, the rendering process is skipped during game runtime, without increasing the rendering burden.
[0095] 2. Compared to the dual-mesh scheme, which requires maintaining an independent navigation mesh for each dynamic building, this scheme only requires one set of global navigation mesh data. Memory usage remains constant regardless of the number of replaceable buildings in the scene. Through the mesh generation algorithm in step three, the geometric information of multiple buildings is integrated into a single mesh data structure, achieving data reuse.
[0096] 3. Unlike the multi-threaded approach, this approach does not require waiting for any calculations to complete during building replacement; characters can immediately and correctly navigate within the new building. This is thanks to the connectivity verification in step four, which ensures that the pre-generated mesh is effective for all building combinations.
[0097] 4. Compared to conservative strategies that mark buildings as impassable, this solution fully preserves the pathfinding functionality within buildings. Characters can freely enter and exit buildings and move between rooms, providing a complete gameplay experience. Through data table management and entity addition processes, it is ensured that all building geometric details are incorporated into the navigation mesh calculations.
[0098] 5. Through the data table configuration in step one, artists and designers can easily add new dynamic buildings without writing code. 6. Automated verification ensures data quality and reduces later debugging costs; the entire process can be integrated into the automated build pipeline without manual intervention.
[0099] 6. Applicable to game scenarios of various sizes, especially advantageous in the following scenarios: large open-world games with large scene scale and insufficient performance of online update solutions; simulation management games where players frequently replace buildings, avoiding the overhead of repeatedly mounting / unmounting the grid; multiplayer online games, eliminating the need for synchronous navigation grid updates and reducing network load.
[0100] For the above method embodiments, see Figure 4 A pathfinding device is shown, the device comprising: The first model data acquisition module 402 is used to acquire target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in an unrenderable state; The navigation mesh data determination module 404 is used to determine the target navigation mesh data based on the target scene geometry indicated by the target model data; wherein, the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; The pathfinding module 406 is used to determine the movement path in the target virtual scene based on the target navigation grid data.
[0101] The aforementioned pathfinding device acquires target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; target navigation mesh data is determined based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; and a movement path in the target virtual scene is determined based on the target navigation mesh data. In this method, navigation mesh data is generated based on the model data of the virtual scene and the model data of multiple replaceable scene objects placed at specified locations in the virtual scene. Regardless of which scene object is placed in the specified scene, the movement path determined based on this navigation mesh data can adapt to the virtual scene, eliminating the need to update the navigation mesh data based on the replaced scene objects. This reduces the waste of computing resources and lowers the burden on the communication network, thereby improving the user experience to some extent.
[0102] The aforementioned apparatus further includes: a scene rendering module, used to render a target virtual scene based on model data of scene objects in a renderable state in the target model data; a second model data acquisition module, used to acquire the visual model data of the target object corresponding to the object deployment instruction in response to an object deployment instruction for a first scene location in at least one target configuration location; the target object is at least one deployable virtual object among one or more deployable virtual objects associated with the first scene location; and an object rendering module, used to render and generate the target object in real time at the first scene location in the target virtual scene based on the visual model data of the target object.
[0103] The aforementioned target model data includes model data of basic scene objects and model data sets corresponding to each target configuration location; the model data sets include model data of each deployable virtual object deployed at the corresponding target configuration location; the model data is used to indicate at least one or more of the following: the position, orientation, and scaling ratio of the deployable virtual object in the virtual scene.
[0104] The aforementioned navigation mesh data determination module is also used for: discretizing the target scene geometry to obtain a voxel mesh; determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh; and generating target navigation mesh data based on the passable area.
[0105] The navigation data determination module is also used to: if the first spatial location in the virtual space is located inside the voxel mesh of any geometry in the target scene geometry, determine that the first spatial location is outside the passable area.
[0106] The preset passable areas corresponding to each deployable virtual object at the same target configuration location are the same, and the exit and entrance positions of each deployable virtual object are relatively aligned.
[0107] The aforementioned device further includes: a scene object acquisition module, used to acquire multiple candidate deployable virtual objects corresponding to the target configuration location; an object set determination module, used to determine multiple scene object sets based on the structural similarity of the multiple candidate deployable virtual objects; the structural similarity of the multiple candidate deployable virtual objects in the scene object set is greater than a preset similarity threshold; and a deployable virtual object determination module, used to determine a candidate scene object from each scene object set, and to determine the determined candidate scene object as the deployable virtual object corresponding to the target configuration location.
[0108] The virtual scene is divided into multiple sub-scene regions; the target navigation grid data includes sub-navigation grid data corresponding to each sub-scene region; the virtual scene includes controlled virtual objects; the device further includes a pathfinding module, used to: in response to a pathfinding event for the virtual scene being triggered, determine the target sub-navigation grid data in the target navigation grid data based on the sub-scene region where the controlled virtual object is located; and determine the movement path of the controlled virtual object in the virtual scene based on the target sub-navigation grid data.
[0109] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described pathfinding method, for example: Obtain target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; determine target navigation mesh data based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; determine the movement path in the target virtual scene based on the target navigation mesh data.
[0110] In the above method, navigation mesh data is generated based on the model data of the virtual scene and the model data of multiple scene objects that can be replaced and placed in specified positions in the virtual scene. Regardless of which scene object is placed in the specified scene, the movement path determined based on the navigation mesh data can be adapted to the virtual scene. There is no need to update the navigation mesh data based on the replaced scene object, which reduces the waste of computing resources and reduces the burden on the communication network, thereby improving the user experience to a certain extent.
[0111] Optionally, the above method further includes: rendering a target virtual scene based on the model data of scene objects in a renderable state in the target model data; in response to an object deployment instruction for a first scene location in at least one target configuration location, obtaining the visual model data of the target object corresponding to the object deployment instruction; the target object is at least one of one or more deployable virtual objects associated with the first scene location; and generating the target object in real time at the first scene location in the target virtual scene based on the visual model data of the target object.
[0112] Optionally, the aforementioned target model data includes model data of basic scene objects and model data sets corresponding to each target configuration location; the model data sets include model data of each deployable virtual object deployed at the corresponding target configuration location; the model data is used to indicate at least one or more of the following: the position, orientation, and scaling ratio of the deployable virtual object in the virtual scene.
[0113] Optionally, the step of determining the target navigation mesh data based on the target scene geometry indicated by the target model data includes: discretizing the target scene geometry to obtain a voxel mesh; determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh; and generating the target navigation mesh data based on the passable area.
[0114] Optionally, the above step of determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh includes: if the first spatial location in the virtual space is located inside the voxel mesh of any geometry in the target scene geometry, then the first spatial location is determined to be outside the passable area.
[0115] Optionally, the preset passable areas corresponding to each deployable virtual object at the same target configuration location are the same, and the exit and entrance positions of each deployable virtual object are relatively aligned.
[0116] Optionally, the above method further includes: obtaining multiple candidate deployable virtual objects corresponding to the target configuration location; determining multiple scene object sets based on the structural similarity of the multiple candidate deployable virtual objects; the structural similarity of the multiple candidate deployable virtual objects in the scene object set is greater than a preset similarity threshold; determining a candidate scene object from each scene object set, and determining the determined candidate scene object as the deployable virtual object corresponding to the target configuration location.
[0117] Optionally, the virtual scene is divided into multiple sub-scene regions; the target navigation grid data includes sub-navigation grid data corresponding to each sub-scene region; the virtual scene includes controlled virtual objects; the method further includes: in response to a pathfinding event for the virtual scene being triggered, determining target sub-navigation grid data in the target navigation grid data based on the sub-scene region where the controlled virtual object is located; and determining the movement path of the controlled virtual object in the virtual scene based on the target sub-navigation grid data.
[0118] Furthermore, Figure 5 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0119] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0120] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams of the invention in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method invented in conjunction with the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0121] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described pathfinding method.
[0122] The pathfinding method, apparatus, and electronic device provided in this invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments, for example: Obtain target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in a non-renderable state; determine target navigation mesh data based on the target scene geometry indicated by the target model data; wherein the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to multiple deployable virtual objects; determine the movement path in the target virtual scene based on the target navigation mesh data.
[0123] In the above method, navigation mesh data is generated based on the model data of the virtual scene and the model data of multiple scene objects that can be replaced and placed in specified positions in the virtual scene. Regardless of which scene object is placed in the specified scene, the movement path determined based on the navigation mesh data can be adapted to the virtual scene. There is no need to update the navigation mesh data based on the replaced scene object, which reduces the waste of computing resources and reduces the burden on the communication network, thereby improving the user experience to a certain extent.
[0124] Optionally, the above method further includes: rendering a target virtual scene based on the model data of scene objects in a renderable state in the target model data; in response to an object deployment instruction for a first scene location in at least one target configuration location, obtaining the visual model data of the target object corresponding to the object deployment instruction; the target object is at least one of one or more deployable virtual objects associated with the first scene location; and generating the target object in real time at the first scene location in the target virtual scene based on the visual model data of the target object.
[0125] Optionally, the aforementioned target model data includes model data of basic scene objects and model data sets corresponding to each target configuration location; the model data sets include model data of each deployable virtual object deployed at the corresponding target configuration location; the model data is used to indicate at least one or more of the following: the position, orientation, and scaling ratio of the deployable virtual object in the virtual scene.
[0126] Optionally, the step of determining the target navigation mesh data based on the target scene geometry indicated by the target model data includes: discretizing the target scene geometry to obtain a voxel mesh; determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh; and generating the target navigation mesh data based on the passable area.
[0127] Optionally, the above step of determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh includes: if the first spatial location in the virtual space is located inside the voxel mesh of any geometry in the target scene geometry, then the first spatial location is determined to be outside the passable area.
[0128] Optionally, the preset passable areas corresponding to each deployable virtual object at the same target configuration location are the same, and the exit and entrance positions of each deployable virtual object are relatively aligned.
[0129] Optionally, the above method further includes: obtaining multiple candidate deployable virtual objects corresponding to the target configuration location; determining multiple scene object sets based on the structural similarity of the multiple candidate deployable virtual objects; the structural similarity of the multiple candidate deployable virtual objects in the scene object set is greater than a preset similarity threshold; determining a candidate scene object from each scene object set, and determining the determined candidate scene object as the deployable virtual object corresponding to the target configuration location.
[0130] Optionally, the virtual scene is divided into multiple sub-scene regions; the target navigation grid data includes sub-navigation grid data corresponding to each sub-scene region; the virtual scene includes controlled virtual objects; the method further includes: in response to a pathfinding event for the virtual scene being triggered, determining target sub-navigation grid data in the target navigation grid data based on the sub-scene region where the controlled virtual object is located; and determining the movement path of the controlled virtual object in the virtual scene based on the target sub-navigation grid data.
[0131] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0132] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0133] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0134] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0135] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A pathfinding method, characterized in that, include: Obtain target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in an unrenderable state; Based on the target scene geometry indicated by the target model data, target navigation mesh data is determined; wherein, the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to the plurality of deployable virtual objects; Based on the target navigation grid data, the movement path in the target virtual scene is determined.
2. The method according to claim 1, characterized in that, The method further includes: Render the target virtual scene based on the model data of the scene objects in the renderable state in the target model data; In response to an object deployment instruction for a first scene location among the at least one target configuration locations, the visualization model data of the target object corresponding to the object deployment instruction is obtained; the target object is at least one of one or more deployable virtual objects associated with the first scene location; Based on the visualization model data of the target object, the target object is rendered and generated in real time at the first scene location in the target virtual scene.
3. The method according to claim 1, characterized in that, The target model data includes model data of basic scene objects and model data sets corresponding to each target configuration location; the model data sets include model data of each deployable virtual object deployed at the corresponding target configuration location; the model data is used to indicate at least one or more of the following: the position, orientation, and scaling ratio of the deployable virtual object in the virtual scene.
4. The method according to claim 1, characterized in that, The step of determining the target navigation mesh data based on the target scene geometry indicated by the target model data includes: The target scene geometry is discretized to obtain a voxel mesh; Based on the voxel grid, the passable area in the virtual space where the virtual scene is located is determined; Based on the passable area, target navigation grid data is generated.
5. The method according to claim 4, characterized in that, The step of determining the passable area in the virtual space where the virtual scene is located based on the voxel mesh includes: If the first spatial location in the virtual space is located inside the voxel mesh of any geometry in the target scene geometry, then the first spatial location is determined to be outside the passable area.
6. The method according to claim 4, characterized in that, The preset passable areas corresponding to each of the deployable virtual objects at the same target configuration location are the same, and the exit and entrance positions of each of the deployable virtual objects are relatively aligned.
7. The method according to claim 1, characterized in that, The method further includes: Obtain multiple candidate deployable virtual objects corresponding to the target configuration location; Based on the structural similarity of the multiple candidate deployable virtual objects, multiple scene object sets are determined; the structural similarity of the multiple candidate deployable virtual objects in the scene object sets is greater than a preset similarity threshold. A candidate scene object is determined from each set of scene objects, and the determined candidate scene object is identified as the deployable virtual object corresponding to the target configuration location.
8. The method according to claim 1, characterized in that, The target virtual scene is divided into multiple sub-scene regions; the target navigation grid data includes sub-navigation grid data corresponding to each of the sub-scene regions. The virtual scene includes controlled virtual objects; The method further includes: In response to a pathfinding event being triggered for the virtual scene, target sub-navigation grid data in the target navigation grid data is determined based on the sub-scene region where the controlled virtual object is located; Based on the target sub-navigation grid data, the movement path of the controlled virtual object in the virtual scene is determined.
9. A pathfinding device, characterized in that, include: The first model data acquisition module is used to acquire target model data, wherein the target virtual scene corresponding to the target model data includes at least one target configuration location; the target configuration location is associated with one or more deployable virtual objects, and the deployable virtual objects are in an unrenderable state; The navigation mesh data determination module is used to determine target navigation mesh data based on the target scene geometry indicated by the target model data; wherein, the target scene geometry includes the basic scene geometry corresponding to the target virtual scene and the deployment object geometry corresponding to the plurality of deployable virtual objects; The pathfinding module is used to determine the movement path in the target virtual scene based on the target navigation grid data.
10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the pathfinding method according to any one of claims 1-8.
11. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the pathfinding method according to any one of claims 1-8.