Path processing method and device of virtual scene, electronic equipment and storage medium
By adopting a bottom-up, layer-by-layer simplified multi-level navigation mesh method, the problem of low pathfinding efficiency in virtual scenes is solved, achieving both the saving of computing resources and the improvement of pathfinding efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-06-30
- Publication Date
- 2026-06-19
Smart Images

Figure CN117357899B_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer technology, and more particularly to a path processing method, apparatus, electronic device, and storage medium for a virtual scene. Background Technology
[0002] Display technologies based on graphics processing hardware have expanded the channels for perceiving the environment and acquiring information. In particular, virtual scene display technologies can realize diverse movements of virtual objects controlled by users or artificial intelligence according to actual application needs. They have various typical application scenarios, such as simulating the real movement process between virtual objects in virtual scenes such as games.
[0003] With the development of virtual scene technology, existing electronic devices can run larger and more extensive virtual scenes. How to find a path in a virtual scene has become an urgent problem to be solved. Related technologies perform pathfinding by traversing the walkable surfaces of virtual objects in the virtual scene. However, this requires huge computing resources and a lot of computing time when dealing with vast virtual scenes.
[0004] In summary, there is currently no good solution to the problem of low pathfinding efficiency in virtual scenes, which leads to high consumption of computing resources. Summary of the Invention
[0005] This application provides a path processing method, apparatus, electronic device, computer-readable storage medium, and computer program product for virtual scenes, which can improve pathfinding efficiency in virtual scenes and thus save computing resources.
[0006] The technical solution of this application embodiment is implemented as follows:
[0007] This application provides a path processing method for a virtual scene, including:
[0008] Obtain a simplified multi-layer navigation mesh of the virtual scene from bottom to top, wherein any navigation patch in the upper layer navigation mesh is mapped to multiple corresponding navigation patches in the lower layer navigation mesh;
[0009] Obtain the start and end points of the path of the virtual object in the virtual scene;
[0010] Based on the path start point and the path end point, pathfinding is performed in the topmost navigation grid to obtain at least one topmost path corresponding to the topmost navigation grid;
[0011] Starting from the topmost navigation grid, mapping is performed from top to bottom based on the topmost path to obtain at least one lower path corresponding to at least one lower navigation grid, wherein the path corresponding to each navigation grid other than the bottommost navigation grid is used for lower-level mapping.
[0012] The at least one lower path corresponding to at least one lower navigation grid is used as the navigation path.
[0013] This application provides a path processing device for a virtual scene, including:
[0014] The mesh processing module is configured to obtain a multi-layer navigation mesh of the virtual scene, which is simplified from bottom to top. In this layer, any navigation facet in the upper navigation mesh is mapped to multiple corresponding navigation faces in the lower navigation mesh.
[0015] The path processing module is configured to obtain the start and end points of the path of the virtual object in the virtual scene;
[0016] The path processing module is further configured to perform pathfinding processing in the topmost navigation grid based on the path start point and the path end point to obtain at least one topmost path corresponding to the topmost navigation grid.
[0017] The path processing module is further configured to perform mapping processing from top to bottom based on the topmost path, starting from the topmost navigation grid, to obtain at least one lower path corresponding to at least one lower navigation grid, wherein the path corresponding to each navigation grid other than the bottommost navigation grid is used for lower-level mapping processing.
[0018] The path processing module is further configured to use at least one lower-level path corresponding to at least one lower-level navigation grid as a navigation path.
[0019] This application provides an electronic device, including:
[0020] Memory, used to store executable instructions;
[0021] The processor, when executing executable instructions stored in the memory, implements the path processing method for the virtual scene provided in the embodiments of this application.
[0022] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute, thereby implementing the virtual scene path processing method provided in this application.
[0023] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the path processing method for a virtual scene provided in this application.
[0024] The embodiments of this application have the following beneficial effects:
[0025] By decomposing the virtual scene into a multi-layered navigation grid, each layer except the top layer performs pathfinding by mapping the path of the upper layer's navigation grid to the lower layer's navigation grid. Compared to performing independent pathfinding at each layer, the computational resource consumption caused by re-pathfinding at each layer is avoided because the path of the upper layer's navigation grid is used as a reference, thus significantly improving pathfinding efficiency. Attached Figure Description
[0026] Figure 1A This is a schematic diagram illustrating the application mode of the path processing method for virtual scenes provided in the embodiments of this application;
[0027] Figure 1B This is a schematic diagram illustrating the application mode of the path processing method for virtual scenes provided in the embodiments of this application;
[0028] Figure 2 This is a schematic diagram of the structure of the terminal device 400 provided in the embodiments of this application;
[0029] Figures 3A to 3D This is a flowchart illustrating the path processing method for a virtual scene provided in an embodiment of this application;
[0030] Figure 4A This is a schematic diagram of a navigation patch in a virtual scene provided in an embodiment of this application;
[0031] Figure 4B This is a schematic diagram of a multi-layer navigation mesh provided in an embodiment of this application;
[0032] Figure 5 This is a schematic diagram of the configuration interface of the navigation grid provided in the embodiments of this application;
[0033] Figures 6A to 6D This is a schematic diagram of the navigation mesh layers provided in the embodiments of this application;
[0034] Figure 7A This is a schematic diagram of the segmentation process provided in an embodiment of this application;
[0035] Figures 7B to 7E This is a schematic diagram of the pathfinding process provided in an embodiment of this application;
[0036] Figure 7F This is a schematic diagram illustrating the detailed processing provided in the embodiments of this application;
[0037] Figures 8A to 8C This is a flowchart illustrating the path processing method for a virtual scene provided in an embodiment of this application;
[0038] Figures 9A to 9C This is a schematic map of the virtual scene provided in the embodiments of this application;
[0039] Figure 9D This is a schematic diagram of a virtual scene provided in an embodiment of this application. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0041] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0042] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0043] It should be noted that in the embodiments of this application, user information, user feedback data and other related data are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0045] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0046] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0047] 1) Virtual scenes utilize the scene output by the device that is different from the real world. Visual perception of virtual scenes can be formed with the naked eye or with the assistance of the device. For example, two-dimensional images are output through a display screen, and three-dimensional images are output through stereoscopic display technologies such as stereoscopic projection, virtual reality and augmented reality. In addition, various possible hardware can be used to form various perceptions that simulate the real world, such as auditory perception, tactile perception, olfactory perception and motion perception.
[0048] 2) In response, used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0049] 3) Virtual objects: Objects that interact within a virtual scene, controlled by the user or a robotic program (e.g., an AI-based robotic program). These objects can remain still, move, and perform various behaviors within the virtual scene, such as characters in a game. Examples include user-controlled virtual objects, virtual monsters, and non-user-controlled objects (NPCs, Non-Player Characters).
[0050] 4) Navigation Mesh: This is the basic unit for loading the virtual scene map into the terminal device's memory. The virtual scene map is divided into multiple map tiles using a grid. Based on the position of the virtual object currently controlled by the player, the current map tile (and potentially surrounding tiles) is loaded and rendered onto the user interface, thus saving memory by avoiding loading the entire virtual scene. For example, the map grid could be a navigation mesh, a polygonal grid data structure used for navigation and pathfinding in complex spaces, marking walkable areas.
[0051] 5) Navigation Polygon (Nav Poly) is the smallest unit of the navigation mesh. It represents a convex polygon and stores some additional navigation information.
[0052] 6) The projection (Recast) navigation mesh is a pathfinding structure obtained by voxelizing the virtual scene. It consists of navigation patches attached to walkable surfaces and navigation links connecting navigation patches on different surfaces.
[0053] 7) Multi-layer navigation mesh: A multi-level simplified structure of the virtual scene used for pathfinding, built upon the projected navigation mesh. The multi-layer navigation mesh comprises multiple levels of navigation meshes, each containing multiple navigation polygons (the navigation polygons in a multi-layer navigation mesh can also be called hierarchical polygons). Each navigation polygon in the current layer of the navigation mesh is obtained by aggregating multiple navigation polygons from the layer below it. Each navigation polygon in the bottommost layer of the navigation mesh corresponds one-to-one with a navigation polygon in the pathfinding structure of the virtual scene (which can be a projected navigation mesh).
[0054] 8) Inter Edge: A data structure representing the adjacent edges between navigation patches.
[0055] This application provides a path processing method, a path processing device, an electronic device, a computer-readable storage medium, and a computer program product for virtual scenes, which can improve pathfinding efficiency in virtual scenes.
[0056] The following describes exemplary applications of the electronic devices provided in the embodiments of this application. These devices can be implemented as various types of user terminals, such as laptops, tablets, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), and in-vehicle terminals, or as servers. Exemplary applications when the device is implemented as a terminal will be described below.
[0057] In one implementation scenario, refer to Figure 1A , Figure 1A This is a schematic diagram of the application mode of the virtual scene path processing method provided in the embodiments of this application. It is applicable to some application modes that can complete the relevant data calculation of the virtual scene by relying entirely on the graphics processing hardware computing power of the terminal device 400, such as stand-alone / offline games, and complete the output of the virtual scene through various types of terminal devices 400 such as smartphones, tablets and virtual reality / augmented reality devices.
[0058] As an example, types of graphics processing hardware include central processing units (CPUs) and graphics processing units (GPUs).
[0059] When visual perception of a virtual scene is formed, the terminal device 400 calculates the data required for display through graphics computing hardware, and completes the loading, parsing and rendering of the display data. The graphics output hardware outputs video frames that can form visual perception of the virtual scene. For example, two-dimensional video frames are displayed on the display screen of a smartphone, or video frames that achieve a three-dimensional display effect are projected onto the lenses of augmented reality / virtual reality glasses. In addition, in order to enrich the perceptual effect, the terminal device 400 can also use different hardware to form one or more of auditory perception, tactile perception, motion perception and taste perception.
[0060] As an example, a client (e.g., a web-based game application) runs on terminal device 400 and interacts with other users in the game by connecting to server 200 (e.g., a game server). Terminal device 400 outputs a virtual scene 101 of the client, which includes path 102.
[0061] For example, a first virtual object can be displayed in the virtual scene. The first virtual object can be a game character controlled by the user. That is, the first virtual object is controlled by the real user and will move in the virtual scene in response to the real user's operation on the controller (such as touch screen, voice switch, keyboard, mouse and joystick). For example, when the real user moves the joystick to the right, the first virtual object will move to the right in the virtual scene. It can also stay still, jump, and be controlled to shoot.
[0062] For example, the first virtual object can be a user-controlled virtual object. The user inputs the path start and end points of the first virtual object into the terminal device 400. The terminal device 400 obtains a multi-layered navigation grid of the virtual scene, simplified from bottom to top. Any navigation patch in the upper-layer navigation grid is mapped to multiple corresponding navigation patches in the lower-layer navigation grid. The terminal device 400 obtains the path start and end points of the virtual object in the virtual scene. Based on the path start and end points, pathfinding is performed in the topmost navigation grid to obtain at least one topmost path corresponding to the topmost navigation grid. Starting from the topmost navigation grid, mapping is performed from top to bottom based on the topmost paths to obtain at least one lower-layer path corresponding to at least one lower-layer navigation grid. The paths corresponding to each navigation grid other than the bottommost navigation grid are used for lower-layer mapping. The terminal device 400 uses the at least one lower-layer path corresponding to at least one lower-layer navigation grid as the navigation path. The terminal device 400 displays the navigation path in the virtual scene, allowing the user to observe the navigation path and control the movement of the virtual object according to it.
[0063] In another implementation scenario, refer to Figure 1B , Figure 1BThis is a schematic diagram of the application mode of the virtual scene path processing method provided in the embodiments of this application. It is applied to the terminal device 400 and the server 200, and is suitable for the application mode that relies on the computing power of the server 200 to complete the virtual scene calculation and output the virtual scene on the terminal device 400.
[0064] Taking the visual perception of forming a virtual scene as an example, server 200 calculates display data related to the virtual scene (such as scene data) and sends it to terminal device 400 via network 300. Terminal device 400 relies on graphics computing hardware to load, parse, and render the calculated display data, and relies on graphics output hardware to output the virtual scene to form visual perception. For example, two-dimensional video frames can be displayed on the screen of a smartphone, or video frames with a three-dimensional display effect can be projected onto the lenses of augmented reality / virtual reality glasses. As for the perception of the form of the virtual scene, it can be understood that it can be achieved with the help of the corresponding hardware output of terminal device 400, such as using a microphone to form auditory perception, using a vibrator to form tactile perception, and so on.
[0065] As an example, a client (e.g., a web-based game application) runs on terminal device 400 and interacts with other users in the game by connecting to server 200 (e.g., a game server). Server 200 sends scene data to terminal device 400, and terminal device 400 outputs a virtual scene 101 from the client, which includes path 102.
[0066] For example, a first virtual object can be displayed in the virtual scene. The first virtual object can be a game character controlled by the user. That is, the first virtual object is controlled by the real user and will move in the virtual scene in response to the real user's operation on the controller (such as touch screen, voice switch, keyboard, mouse and joystick). For example, when the real user moves the joystick to the right, the first virtual object will move to the right in the virtual scene. It can also stay still, jump, and be controlled to shoot.
[0067] For example, the first virtual object can be a user-controlled virtual object. The user inputs the start and end points of the path for the first virtual object into the terminal device 400. The terminal device 400 sends the start and end points to the server 200. The server 200 obtains a simplified multi-layer navigation grid of the virtual scene from bottom to top. Any navigation patch in the upper layer of the navigation grid is mapped to multiple corresponding navigation patches in the lower layer. The server obtains the start and end points of the virtual object's path in the virtual scene. Based on the start and end points, the server performs pathfinding processing in the topmost navigation grid to obtain at least one topmost path corresponding to the topmost navigation grid. Starting from the topmost navigation grid, the server performs mapping processing from top to bottom based on the topmost paths to obtain at least one lower-level path corresponding to at least one lower-level navigation grid. The paths corresponding to each navigation grid other than the bottommost navigation grid are used for lower-level mapping processing. The server uses the at least one lower-level path corresponding to at least one lower-level navigation grid as the navigation path. The terminal device 400 displays the navigation path in the virtual scene, allowing the user to observe the navigation path and control the movement of the virtual object according to it.
[0068] In some embodiments, the terminal device 400 can implement the virtual scene path processing method provided in this application embodiment by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a shooting game APP (i.e., the client mentioned above); it can also be a mini-program, that is, a program that only needs to be downloaded into the browser environment to run; or it can be a game mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.
[0069] In some embodiments, the terminal device 400 may be an in-vehicle terminal, the virtual scene may be a virtual scene mapped from the real world, the virtual object may be a virtual vehicle mapped from a real-world vehicle, and the client running the virtual scene is an electronic map client. The user outputs their current location as the starting point of the path and inputs their destination as the ending point through the in-vehicle terminal. Based on a multi-layered navigation grid, pathfinding is performed layer by layer to obtain at least one navigation path, which is then pushed to the user for selection of a suitable path for vehicle navigation.
[0070] Taking a computer program as an example, in actual implementation, the terminal device 400 has an application that supports virtual scenes installed and running. This application can be any of the following: a first-person shooter (FPS) game, a third-person shooter game, a virtual reality application, a 3D map application, or a multiplayer survival game. Users use the terminal device 400 to manipulate virtual objects located in the virtual scene, and these activities include, but are not limited to: adjusting body posture, crawling, walking, running, riding, jumping, driving, picking up items, shooting, attacking, throwing, and constructing virtual buildings—at least one of these. Illustratively, the virtual object can be a virtual character, such as a realistic or anime character.
[0071] In other embodiments, the embodiments of this application can also be implemented with the aid of cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize the computation, storage, processing, and sharing of data.
[0072] Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. The backend services of the technology network system require substantial computing and storage resources. Cloud gaming, also known as gaming on demand, is an online gaming technology based on cloud computing. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In cloud gaming scenarios, the game does not reside on the player's gaming terminal but runs on a cloud server. The cloud server renders the game scene as a video and audio stream, which is then transmitted to the player's gaming terminal via the network. The player's gaming terminal does not need powerful graphics processing and data computing capabilities; it only needs basic streaming media playback capabilities and the ability to receive player input commands and send them to the cloud server.
[0073] Example, Figure 1BThe server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal device 400 can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal device 400 and the server 200 can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0074] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the terminal device 400 provided in the embodiments of this application. Figure 2 The terminal 400 shown includes at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to implement communication between these components. In addition to a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 440.
[0075] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0076] User interface 430 includes one or more output devices 431 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0077] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices physically located away from the processor 410.
[0078] The memory 450 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 450 described in this application embodiment is intended to include any suitable type of memory.
[0079] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0080] Operating system 451 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, for implementing various basic business functions and handling hardware-based tasks.
[0081] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including Bluetooth, WiFi, and Universal Serial Bus (USB).
[0082] Presentation module 453 enables the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 431 associated with user interface 430 (e.g., a display screen, a speaker, etc.).
[0083] The input processing module 454 is used to detect and translate one or more user inputs or interactions from one or more input devices 432.
[0084] In some embodiments, the path processing device for the virtual scene provided in this application can be implemented in software. Figure 2 A path processing device 455 for a virtual scene stored in memory 450 is shown. This device can be software in the form of programs and plugins, and includes the following software modules: a mesh processing module 4551 and a path processing module 4552. These modules are logically integrated and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0085] The path processing method for virtual scenes provided in this application will be described in conjunction with exemplary applications and implementations of the terminal devices provided in the embodiments of this application.
[0086] See Figure 3A , Figure 3A This is a flowchart illustrating the path processing method for a virtual scene provided in this application embodiment. The following will use a terminal device as the execution subject and will combine... Figure 3A The steps shown are explained.
[0087] In step 301, a multi-layer navigation mesh of the virtual scene is obtained by simplifying it layer by layer from bottom to top.
[0088] For example, each navigation mesh in multiple navigation meshes has the same area, each navigation mesh corresponds to the same area of the virtual scene (e.g., part or all of the area), and any navigation patch in the upper navigation mesh is mapped to the corresponding multiple navigation patches in the lower navigation mesh.
[0089] For example, a navigation patch is a surface structure in a virtual scene on which virtual objects can walk. (Reference) Figure 4A , Figure 4A This is a schematic diagram of a navigation patch in a virtual scene provided in this application embodiment; the navigation mesh 401A is the dark part in the virtual scene, and the navigation mesh 401A is divided into multiple navigation patches 402A, each of which is a walkable surface of a virtual object. This application embodiment uses a pathfinding scenario in a three-dimensional virtual scene as an example for explanation and illustration. In specific implementation, each navigation patch in the navigation mesh can be located on a different plane in the virtual scene. For ease of explanation, the schematic diagram of the navigation mesh used in this application embodiment is two-dimensional and does not limit the actual positional relationship between the navigation patches.
[0090] In some embodiments, see Figure 3B , Figure 3B This is a flowchart illustrating the path processing method for a virtual scene provided in this application embodiment. Step 301 is implemented through steps 3011 to 3014, which are described in detail below.
[0091] In step 3011, the pathfinding structure of the virtual scene is obtained.
[0092] Here, the pathfinding structure includes the connection relationships between each navigation patch and each navigation path. A navigation path is a path that connects different navigation patches.
[0093] For example, the pathfinding structure can be a recast navigation mesh, which is a pathfinding structure obtained by voxelizing the geometry of the virtual scene.
[0094] In step 3012, based on the connection relationship, each navigation patch and each navigation path are combined to form the bottom layer of the multi-layer navigation grid.
[0095] That is, the projected navigation grid is mapped to the lowest layer of the multi-layered navigation grid. (See reference) Figure 4B , Figure 4B This is a schematic diagram of a multi-layer navigation mesh provided in an embodiment of this application. This embodiment uses a 4-layer multi-layer navigation mesh as an example for illustration; in specific implementations, the multi-layer navigation mesh may have more or fewer layers. The projected navigation mesh is mapped to the lowest-level navigation mesh (layer 0), and S1 is a non-navigation patch area in the virtual scene.
[0096] In step 3013, the navigation mesh is aggregated from bottom to top based on each navigation patch of the lowest navigation mesh to obtain the navigation mesh corresponding to each level.
[0097] For example, aggregation combines multiple navigation patches into a single navigation patch. Since the total area of each navigation patch remains constant, the area of the navigation mesh at each level is the same. Through bottom-up, progressive aggregation, the fineness of the navigation patches at the bottom layer of the multi-layered navigation mesh is higher than that of the layers above, and the fineness of the navigation patches in each layer of the multi-layered navigation mesh decreases progressively from bottom to top.
[0098] Continue to refer to Figure 4B Each navigation mesh layer has the same area. Navigation patches A1-0-1 and A1-0-2 in the 0th layer navigation mesh are aggregated into navigation patch A1-1-1 in the 1st layer navigation mesh. Navigation patches A1-1-1, A1-1-2, and A1-1-3 in the 1st layer navigation mesh are aggregated into navigation patch A1-2-1 in the 2nd layer navigation mesh. Navigation patches A1-2-1 and A1-2-2 in the 2nd layer navigation mesh are aggregated into navigation patch A1 in the 3rd layer navigation mesh. The 3rd layer navigation mesh includes navigation patches A1, A2, A3, and A4, and these four navigation patches are not connected to each other.
[0099] In some embodiments, see Figure 3C , Figure 3C This is a flowchart illustrating the path processing method for a virtual scene provided in this application embodiment. Step 3013 is implemented through the following steps 3131 to 3134, which are described in detail below.
[0100] In step 3131, the lowest-level navigation mesh is taken as the navigation mesh to be processed, and the following aggregate subprocessing is performed on the mesh to be processed: each navigation patch in the navigation mesh to be processed is grouped to obtain multiple navigation patch groups.
[0101] Here, each navigation patch in the navigation patch group is interconnected.
[0102] For example, interconnected navigation tiles mean that the regions corresponding to the navigation tiles in the virtual scene are interconnected, and virtual objects can travel from one region to another within these interconnected regions. Interconnected navigation tiles can be adjacent or indirectly adjacent.
[0103] In some embodiments, prior to step 3131, connected regions in the navigation mesh of the layer to be processed are obtained.
[0104] For example, each navigation patch in a connected region is interconnected, but different connected regions are not connected. That is, when the area corresponding to a navigation patch is equal to the area of the connected region containing the navigation patch, each navigation patch in the navigation mesh is not connected.
[0105] Step 3131 can be implemented as follows: For multiple navigation patches in each connected region, perform the following processing: obtain the boundary (inter edge) of each adjacent patch between interconnected navigation patches; based on the minimum segmentation cost and each patch boundary, perform segmentation processing on at least two navigation patches in the multiple navigation patches to obtain multiple navigation patch groups.
[0106] Here, the segmentation cost is the number of interconnected patch boundaries. Interconnected patch boundaries are obtained by segmenting aggregated patches from the navigation mesh of the layer to be processed. Aggregated patches are obtained by aggregating multiple navigation patches into a whole.
[0107] refer to Figure 7A ,refer to Figure 7A , Figure 7A This is a schematic diagram of the segmentation process provided in the embodiments of this application. The dashed lines represent segmentation lines, each node is a navigation patch (navigation patch 1, navigation patch 2, navigation patch 3, navigation patch 4, navigation patch 5, navigation patch 6, navigation patch 7, navigation patch 8), and the edges between navigation patches represent the boundaries of adjacent patches. The cut cost is the number of patch boundaries segmented by the segmentation line. The 8 navigation patches belong to the same connected region, and these 8 navigation patches are not connected to any other navigation patches outside this region. The cut cost for segmentation scheme (a) is 9, the cut cost for segmentation scheme (b) is 6, the cut cost for segmentation scheme (c) is 1, and the cut cost for segmentation scheme (d) is 7. Therefore, segmentation scheme (c) is adopted, with navigation patches 1, 2, 5, and 6 grouped together, and navigation patches 3, 4, 7, and 8 grouped together.
[0108] In some embodiments, prior to step 3131, if any two navigation patches satisfy the connectivity constraint, it is determined that the two navigation patches are not connected to each other.
[0109] For example, connectivity constraints include at least one of the following:
[0110] 1. At least one of any two navigation tiles is located in a restricted area of the virtual scene, where a restricted area is an area where virtual objects are prohibited from entering. For example, if navigation tile A is located in an area of the virtual scene that can only be entered under certain conditions (e.g., reaching a preset level or possessing a specific virtual item), and the virtual object does not meet the specific conditions, then the virtual object cannot enter the area where navigation tile A is located. The virtual object can enter the area corresponding to navigation tile B, even if navigation tiles A and B are adjacent, navigation tiles A and B are not connected.
[0111] 2. Any two navigation tiles belong to different regions in the virtual scene, and these regions are not connected. For example, navigation tile A is located on a cliff in the virtual scene, and navigation tile B is located below the cliff in the virtual scene. Due to the height difference of the terrain in the virtual scene, the two are not connected.
[0112] In some embodiments, the grouping process may be based on the number of navigation tiles, for example, dividing a preset number of adjacent and interconnected navigation tiles into the same area, where the preset number may be 3 or 2.
[0113] In step 3132, each navigation patch corresponding to each navigation patch group is aggregated into a navigation patch of the upper layer.
[0114] For example, aggregation combines multiple navigation tiles into a single navigation tile, where the sum of the areas of the individual navigation tiles equals the area of the aggregated navigation tile. See also... Figure 4B Navigation patches A1-1-1, A1-1-2, and A1-1-3 in the first layer of the navigation mesh are aggregated into navigation patch A1-2-1 in the second layer of the navigation mesh; the total area of navigation patches A1-1-1, A1-1-2, and A1-1-3 is the same as that of navigation patch A1-2-1.
[0115] In step 3133, each navigation patch of the previous layer is used to form the navigation mesh of the layer to be processed.
[0116] For example, based on the positional relationship of each navigation patch in the navigation mesh of the layer to be processed, the navigation patches obtained by the aggregation process are combined into the navigation mesh of the next layer.
[0117] In step 3134, the previous navigation mesh is used as the new navigation mesh to be processed, and the process is transferred to the aggregation subprocessing for the new mesh to be processed until each navigation patch in the previous navigation mesh obtained by the aggregation subprocessing is not connected to each other.
[0118] Here, each navigation grid except the topmost navigation grid is used for aggregation processing of the previous layer, and the area of the navigation grid corresponding to each layer is the same.
[0119] For example, please continue to refer to [the example]. Figure 4B The third layer of the navigation grid is the topmost navigation grid. The third layer of the navigation grid includes navigation patches A1, A2, A3, and A4. The four navigation patches are not connected to each other.
[0120] Continue to refer to Figure 3B In step 3014, the navigation meshes of each level are combined from bottom to top to form a multi-layer navigation mesh.
[0121] For example, the navigation meshes at each level are arranged in the order they were generated to form a multi-level navigation mesh from bottom to top.
[0122] Continue to refer to Figure 3A In step 302, the starting point and ending point of the virtual object's path in the virtual scene are obtained.
[0123] For example, the path start and end points can be input by the user through a terminal device. For instance, the virtual object is a virtual car, and the virtual scene is a virtual scene mapped from the real world onto an electronic map. The user inputs their location as the path start point and their destination as the path end point. This generates a navigation route as driving guidance. Alternatively, the path start and end points can be generated based on the task the virtual object is currently performing in the virtual scene. For example, when the virtual object receives a game task, it generates the corresponding path start and end points.
[0124] In step 303, pathfinding is performed in the topmost navigation grid based on the path start point and path end point to obtain at least one topmost path corresponding to the topmost navigation grid.
[0125] In some embodiments, step 303 is implemented as follows: mapping the path start point and path end point to the top-level navigation mesh, and obtaining the midpoint of the boundary of each navigation patch in the top-level navigation mesh; starting from the path start point, performing path connection processing on multiple midpoints between the path start point and the path end point, as well as the path end point, to obtain at least one candidate path; sorting the number of midpoints traversed by each candidate path in ascending order, and taking at least one candidate path at the head of the ascending order result as the top-level path.
[0126] For example, in this embodiment of the application, the midpoint of the boundary of each navigation patch is used as a waypoint. Each waypoint is traversed, and the path cost is the sum of the Euclidean distances between the midpoints of the boundaries of each patch traversed by the path. By traversing each waypoint, at least one alternative path with the minimum path cost is obtained. (Reference) Figure 7B , Figure 7B This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 701 is the uppermost navigation mesh, comprising four navigation patches: M1, M2, M3, and M4. Regions S2 and S3 are non-navigation patch regions (regions where virtual objects cannot walk on the surface). Z1, Z2, Z3, and Z4 are the midpoints of different patch boundaries. The path between each midpoint is a sub-path. Starting from the path start point D1, connecting the midpoints towards the path end point D2 yields multiple uppermost paths.
[0127] In some embodiments, starting from the path start point, a path connection process is performed on multiple midpoints between the path start point and the path end point, as well as the path end point. This is achieved by traversing each midpoint between the path start point and the path end point in the direction from the path start point to the path end point, and performing the following process: connecting each midpoint based on the ascending order of the number of nodes between it and the path start point, where the number of nodes is the number of nodes between the midpoints and the path start point in the candidate path.
[0128] In some embodiments, starting from the end point of the path, each midpoint between the end point and the beginning point of the path can be traversed in the direction from the end point to the beginning point of the path, and the nodes with smaller Euclidean distances between the midpoints can be connected to obtain the top-level path of the top-level navigation grid.
[0129] In step 304, starting from the topmost navigation grid, mapping is performed from top to bottom based on the topmost path to obtain at least one lower path corresponding to at least one lower navigation grid.
[0130] Here, the paths corresponding to each navigation grid, except for the lowest navigation grid, are used for mapping processing at the next lower level.
[0131] For example, suppose there are k layers in the multi-level navigation grid, where k is a positive integer. The top-level navigation grid is the k-th layer, and at least one lower-level navigation grid can be a navigation grid from the (k-1)-th layer to the i-th layer, where i is greater than 1 and less than k-1. Alternatively, at least one lower-level navigation grid is the bottom-level navigation grid. Or, the mapping process is iterated until the bottom-level navigation grid is reached, obtaining at least one path corresponding to the bottom-level navigation grid.
[0132] In some embodiments, reference Figure 3D , Figure 3DThis is a flowchart illustrating the path processing method for a virtual scene provided in this application embodiment; step 304 is implemented through steps 3041 to 3045, which will be explained in detail below.
[0133] In step 3041, the topmost path is taken as the uppermost path, the topmost navigation grid is taken as the next uppermost navigation grid, and the next lower navigation grid of the topmost path is taken as the navigation grid to be processed.
[0134] For example, please continue to refer to [the example]. Figure 7B ,Will Figure 7B Each path is taken as the top-level path, and the navigation path of each path in the next level navigation grid is obtained.
[0135] After step 3041, the mapping subprocessing of steps 3042 to 3045 is performed.
[0136] In step 3042, the path start point, path end point, and midpoint of each patch boundary passed by the upper-layer path in the navigation mesh are mapped to the navigation mesh of the layer to be processed, respectively, so as to obtain the path start point, path end point, and multiple mapped midpoints in the navigation mesh of the layer to be processed.
[0137] Example, reference Figure 7C , Figure 7C This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 702 is the (k-1)th layer navigation mesh, and the midpoints Z1, Z2, Z3, and Z4 are mapped from the kth layer navigation mesh to navigation mesh 702.
[0138] In step 3043, the navigation patches that the upper-level path passes through in the upper-level navigation mesh are taken as path patches, and each path patch in the upper-level navigation mesh is mapped to the navigation mesh of the layer to be processed, so as to determine the multiple navigation patches corresponding to each path patch.
[0139] Here, multiple navigation patches belong to the navigation mesh of the layer to be processed. The multiple navigation patches corresponding to each path patch in the navigation mesh of the layer to be processed are determined.
[0140] For example, please continue to refer to [the example]. Figure 7C Based on the midpoints Z1, Z2, Z3, and Z4, the sub-paths between the midpoints of the (k-1)th layer navigation mesh are refined based on the boundary of the navigation patches in the navigation mesh 702.
[0141] In this embodiment, instead of performing a complete re-pathfinding for each level, the midpoints output by the pathfinding process of the previous level are reused to refine the path of the previous level, thereby reducing the number of midpoints that need to be traversed, saving computing resources and pathfinding time.
[0142] In step 3044, based on the multiple navigation patches corresponding to each path patch, the sub-path corresponding to each path patch is transformed into at least one refined sub-path corresponding to each path patch.
[0143] Here, a sub-path is a path that passes through a path patch in the upper-level path. The refined sub-path passes through the midpoint of at least one patch boundary corresponding to multiple navigation patches.
[0144] In some embodiments, step 3044 can be implemented as follows: for each path patch and its corresponding multiple navigation patches, perform the following processing: in the direction from the starting point of the path to the ending point of the path, perform path connection processing on the mapping midpoints corresponding to the path patch and the midpoints of the boundaries of each patch corresponding to the multiple navigation patches to obtain multiple sub-candidate paths; sort the number of midpoints passed by each sub-candidate path in ascending order, and take at least one candidate path at the head of the ascending order result as the refined sub-path corresponding to the path patch.
[0145] Continue to refer to Figure 7C The following explanation uses navigation patches M4-1 and M4-2, corresponding to navigation patch M4 in navigation mesh 702, as examples. (Reference) Figure 7D , Figure 7D This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 702-M4 is a part of navigation mesh 702, and the midpoint of the boundary between navigation patch M4-1 and navigation patch M4-2 is Z5. Path L1 (white line) is a sub-path between midpoint Z4 and midpoint Z3 in the k-th layer navigation mesh. Starting from the path start point D1, connecting midpoints Z3, Z5, and Z4 towards the path end point D2 yields path L3 and path L2. Path L3 combined with path L2 is a refined sub-path of path L1.
[0146] In step 3045, each refined sub-path is combined according to the direction from the starting point of the path to the ending point of the path to obtain at least one lower-level path corresponding to the navigation mesh of the layer to be processed.
[0147] For example, each refined sub-path is combined to obtain at least one lower-level path corresponding to the navigation mesh of the layer to be processed.
[0148] In some embodiments, after step 3045, the navigation mesh to be processed is taken as the upper navigation mesh, the navigation mesh below the navigation mesh to be processed is taken as the new navigation mesh to be processed, and the process is transferred to the mapping subprocess for the navigation mesh to be processed (steps 3042 to 3045) until the navigation mesh to be processed obtained by the mapping subprocess is the lowest navigation mesh.
[0149] This application performs pathfinding through iteration, which requires fewer waypoints to be traversed compared to pathfinding based directly on the virtual scene's pathfinding structure. This reduces the time required to traverse waypoints, improves pathfinding efficiency, and saves computing resources, thereby saving memory required by the virtual scene's client.
[0150] Continue to refer to Figure 3A In step 305, at least one lower path corresponding to at least one lower navigation grid is used as the navigation path.
[0151] In some embodiments, step 305 is implemented by determining each lower-level path corresponding to each lower-level navigation grid, and using the path that meets the filtering criteria in each lower-level path as the navigation path.
[0152] Here, the filtering criteria must include at least one of the following:
[0153] 1. The lower-level path corresponds to the shortest movement distance in the virtual scene. For example, movement distance refers to the distance a virtual object moves in the three-dimensional space of the virtual scene; that is, considering the total distance the virtual object travels when moving along the lower-level path. (Reference) Figure 7E , Figure 7E This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 703 is the lowest level navigation mesh, and navigation path L4 and navigation path L5 are the final refined navigation paths. Based on the actual distance that the virtual object needs to move in the virtual scene, the final navigation path can be obtained by filtering from navigation path L4 and navigation path L5.
[0154] 2. The lower-level path crosses the fewest navigation tiles in the virtual scene's pathfinding structure.
[0155] In some embodiments, the map hierarchy in response to the virtual scene corresponds to a lower navigation grid, and the lower navigation grid is an intermediate navigation grid. After step 305, the navigation path corresponding to the intermediate navigation grid is displayed in the map. From the intermediate navigation grid to the lowest navigation grid, mapping is performed from top to bottom based on the intermediate navigation grid to obtain at least one lower path corresponding to each navigation grid.
[0156] For example, if the currently displayed map layer in the virtual scene is an intermediate layer, and the lower navigation grid is also an intermediate layer, the path corresponding to the lower navigation grid will be displayed directly; see reference. Figure 9A , Figure 9AThis is a schematic map of the virtual scene provided in this embodiment of the application. Map 901A is a map of the virtual scene, and its layers correspond to the lower navigation grid, which is an intermediate navigation grid. Map 901A displays the path start point 902A, the path end point 903A, and two lower-level paths (path 905A and path 904A). After displaying the navigation path, the server or terminal device continues to perform pathfinding processing in the background based on the multi-layer navigation grid, layer by layer, until the lowest navigation grid.
[0157] In some embodiments, in response to the map hierarchy of the virtual scene corresponding to a lower navigation grid, and the lower navigation grid being an intermediate navigation grid, after step 305, the navigation path corresponding to the intermediate navigation grid is displayed in the map; in response to a triggering operation to display the next layer navigation grid of the intermediate navigation grid, mapping processing is performed based on the intermediate navigation grid to obtain at least one lower path corresponding to the next layer navigation grid; the at least one lower path of the next layer navigation grid is used as the navigation path and displayed in the map.
[0158] For example, when a user triggers the next level of the navigation grid, the server or terminal device continues to perform pathfinding processing in the background, layer by layer, based on the multi-level navigation grid until the bottommost navigation grid is reached. (Reference) Figure 9B , Figure 9B This is a schematic diagram of a virtual scene provided in the embodiments of this application. Map 901B is displayed in response to a trigger operation. Map 901B is a lower layer map of map 901A and corresponds to the next layer navigation grid. Three navigation paths (path 904B, path 905B and path 906B) are displayed in map 901B.
[0159] In some embodiments, step 305 is implemented by: displaying a map of the virtual scene, the map scale corresponding to the lower navigation grid; displaying at least one lower path of the lower navigation grid in the map; and, in response to a selection operation for any lower path, using the lower path as a navigation path and displaying the selected navigation path.
[0160] For example, the selected state can be displayed through bolding, color changing, dashed lines, or flashing. (See reference) Figure 9C , Figure 9C This is a schematic map of the virtual scene provided in this application embodiment; path 905B is selected.
[0161] In some embodiments, the navigation path corresponding to the bottommost navigation grid can also be displayed in the virtual scene environment as guide lines, see reference. Figure 9D , Figure 9DThis is a schematic diagram of a virtual scene provided in an embodiment of this application. The virtual object 901D walks in the virtual scene along the navigation path guide line 902D corresponding to the navigation path, and the path corresponding to the middle layer of the multi-layer navigation grid is displayed in the map 903D.
[0162] This application embodiment decomposes the virtual scene into multiple navigation meshes. Except for the top layer, each layer performs pathfinding by mapping the path of the upper layer navigation mesh to the lower layer navigation mesh. Compared with performing independent pathfinding at the same layer, the path of the upper layer navigation mesh is used as a reference, which avoids the computational resource consumption caused by traversing a large number of navigation patches in the virtual scene. This reduces the memory occupied by the client running the virtual scene, improves pathfinding efficiency, and saves computational resources.
[0163] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0164] The virtual scene path processing method provided in this application embodiment can be applied in the following application scenarios:
[0165] Large-scale virtual environments refer to virtual scenes that exceed typical sizes, such as those covering tens of square kilometers. Virtual objects (e.g., player-controlled characters, virtual monsters) need to navigate within these environments. For large-scale virtual environment pathfinding, relevant technologies employ Recast & Detour navigation algorithms. However, the size of the walkable area for a single virtual object corresponding to a pre-generated navigation mesh is limited. Furthermore, these technologies typically use the A* algorithm for pathfinding. The time cost of the A* algorithm (a direct search method for finding the shortest path in a static road network) is determined by the number of navigation meshes traversed during its execution. Therefore, for large-scale virtual environments, a large number of navigation meshes need to be traversed to obtain a navigation path. Moreover, due to the limitations of engine (e.g., Unreal Engine 4, UE4, Unreal Engine 4) on the number of iterations of the A* algorithm, the search process may be prematurely truncated, returning only a partial path, resulting in an incomplete navigation path. The virtual scene path processing method provided in this application embodiment can reduce the computational resource consumption required for pathfinding in the virtual scene, thereby reducing the pathfinding time required for pathfinding processing while obtaining the complete path.
[0166] refer to Figure 8A , Figure 8A This is a flowchart illustrating the path processing method for a virtual scene provided in this application embodiment. It uses a terminal device as the execution entity, combined with... Figure 8AThe steps shown are explained. The path processing process in the virtual scene is mainly divided into two stages: the preprocessing stage (steps 801A and 802A) and the path calculation stage (step 803A).
[0167] In step 801A, the geometry of the virtual scene is voxelized to obtain the pathfinding structure of the virtual scene.
[0168] For example, voxelization is the process of converting the geometric representation of an object into a voxel representation that is closest to the object. Voxelization of the geometry of a virtual scene yields the pathfinding structure of the virtual scene. The pathfinding structure can be a recast navigation mesh, and the navigation patches in the recast navigation mesh can represent the shape and surface information of the walkable surfaces of virtual objects in the virtual scene.
[0169] In step 802A, a multi-layer navigation mesh is generated based on the pathfinding structure of the virtual scene.
[0170] For example, the pathfinding structure in a virtual scene can be a projected navigation mesh. Using this mesh as the initial layer, navigation patches within it are divided into multiple groups. Each group is then aggregated into a single navigation patch, resulting in the upper-level navigation mesh of the initial layer. This grouping and aggregation process is repeated to obtain multiple layers of navigation meshes, forming a multi-layered navigation mesh. Each layer of the navigation mesh corresponds to the same area in the virtual scene. Grouping multiple navigation patches can be achieved using graph partitioning software (e.g., METIS, an open-source graph partitioning package that can be used to partition irregular graphs, meshes, etc.). (See reference.) Figures 6A to 6D , Figure 6A , Figure 6B , Figure 6C , Figure 6D This is a schematic diagram of the navigation mesh layers provided in this embodiment of the application. Assuming the multi-layer navigation mesh includes four layers, the bottommost navigation mesh 601 comprises a large number of navigation patches, and the bottommost navigation mesh 601 corresponds one-to-one with the pathfinding structure of the virtual scene. Navigation mesh 602 is the navigation mesh above the bottommost navigation mesh 601. Each navigation patch in navigation mesh 602 is obtained by aggregating the interconnected navigation patches in the bottommost navigation mesh 601. Similarly, each navigation patch in navigation mesh 603 is obtained by aggregating the interconnected navigation patches in navigation mesh 602. Each navigation patch in navigation mesh 604 is obtained by aggregating the interconnected navigation patches in the topmost navigation mesh 604. The total area of each layer of the multi-layer navigation mesh is the same.
[0171] In some embodiments, the multi-layered navigation mesh is configured in an array of SupportedAgents objects for the game engine. (See reference) Figure 5 , Figure 5 This is a schematic diagram of the configuration interface for the navigation mesh provided in this embodiment of the application. The Nav Data Class is configured as a Hierarchical Recast Nav mesh. This configuration method enables the construction of a multi-layered navigation mesh when pre-generating navigation data. During the operation of the virtual scene, when there is an agent object (a virtual object with a pathfinding requirement) that meets the pathfinding conditions or when a pathfinding request is received that uses the multi-layered navigation mesh as navigation data, pathfinding processing will be performed automatically.
[0172] The following explains the process of generating multi-layer navigation meshes. (Refer to...) Figure 8B , Figure 8B This is a flowchart illustrating the path processing method for a virtual scene provided in an embodiment of this application.
[0173] In step 801B, the pathfinding structure for the virtual scene is generated.
[0174] For example, step 801B can be referred to step 801A, and will not be repeated here.
[0175] In step 802B, the 0th layer navigation mesh of the multi-layer navigation mesh is generated based on the pathfinding structure.
[0176] For example, the connection relationships of each navigation patch are obtained from the data structure of the projected navigation mesh, thereby constructing the 0th layer navigation mesh.
[0177] In step 803B, let i = 0.
[0178] In step 804B, each navigation patch of the i-th layer navigation mesh is grouped.
[0179] For example, the navigation tiles in each group are interconnected (interconnectivity means that in a virtual scene, for directly adjacent or indirectly adjacent navigation tiles, a virtual object can move from one navigation tile to another; in this case, the two navigation tiles are interconnected, and the connectivity between navigation tiles can be determined based on the actual situation of the virtual scene. For example, due to significant terrain differences, a virtual object cannot move from one navigation tile to another; navigation tile A is located on a cliff, and navigation tile B is located below the cliff; navigation tiles A and B are not connected).
[0180] At least two navigation patches are grouped into the same group when the segmentation cost is minimized when dividing a group of at least two navigation patches into the same group. The segmentation cost is the number of connected patch boundaries that are cut when the navigation patches in the same group are treated as a whole and separated from the navigation mesh. Connected patch boundaries are the boundaries between interconnected navigation patches.
[0181] refer to Figure 7A , Figure 7A This is a schematic diagram of the segmentation process provided in the embodiments of this application. The dashed lines represent segmentation lines, each node is a navigation patch (navigation patch 1, navigation patch 2, navigation patch 3, navigation patch 4, navigation patch 5, navigation patch 6, navigation patch 7, navigation patch 8), and the edges between navigation patches represent the boundaries of adjacent patches. The cut cost is the number of patch boundaries segmented by the segmentation line. The 8 navigation patches belong to the same connected region, and these 8 navigation patches are not connected to any other navigation patches outside this region. The cut cost for segmentation scheme (a) is 9, the cut cost for segmentation scheme (b) is 6, the cut cost for segmentation scheme (c) is 1, and the cut cost for segmentation scheme (d) is 7. Therefore, segmentation scheme (c) is adopted, with navigation patches 1, 2, 5, and 6 grouped together, and navigation patches 3, 4, 7, and 8 grouped together.
[0182] In step 805B, for each group, the navigation patches in the same group are aggregated into navigation patches of layer i+1.
[0183] For example, navigation patches belonging to the same group are aggregated into a new navigation patch. That is, the regions corresponding to navigation patches in the same group in the i-th layer navigation mesh are treated as a single navigation patch in the (i+1)-th layer.
[0184] In step 806B, the patch boundaries between adjacent navigation patches in layer i+1 are identified and added.
[0185] For example, suppose the navigation grid is at level i. Vertex set ; Patch boundary set Then the navigation grid of the i-th layer... .
[0186] In step 807B, it is determined whether all mutually reachable navigation patches have been aggregated.
[0187] For example, to determine if there are still interconnected navigation patches in the (i+1)th layer that have not been aggregated, referring to Figure 7, according to the segmentation scheme (c), we obtain navigation patches consisting of navigation patches 1, 2, 5, and 6, and navigation patches 3, 4, 7, and 8. If there are adjacent patch boundaries between the newly aggregated navigation patches (the patch boundary between the original navigation patch 3 and navigation patch 6), then we can continue to aggregate the new navigation patches.
[0188] If the result of step 807B is yes, then output the multi-layer navigation mesh; if the result of step 807B is no, then execute step 808B.
[0189] In step 808B, i is set to i+1. After step 808B, step 804B is executed.
[0190] For example, by performing grouping and aggregation processing in a loop until there are no more navigation patches that can be aggregated in the navigation mesh of layer i+1, a multi-layer navigation mesh is output.
[0191] Continue to refer to Figure 8A In step 803A, pathfinding is performed from top to bottom based on each layer of the multi-layer navigation grid.
[0192] After step 803A, if the currently output navigation path is not the path of the lowest layer navigation grid of the multi-layer navigation grid, the pathfinding process is executed repeatedly until the navigation path in the lowest layer navigation grid is obtained.
[0193] For example, in a multi-layered navigation mesh, from the top to the bottom, the navigation patches of the previous layer are obtained by aggregating multiple navigation patches from the navigation mesh of the layer below. From top to bottom, the granularity of the navigation patches in each layer gradually increases. That is, the top layer has the fewest navigation patches, requiring the fewest patches to be traversed, and this gradually increases downwards. Based on the top-layered navigation mesh, the initial path between the starting and ending points can be obtained relatively quickly. Then, based on this initial path, the path can be refined layer by layer using the multi-layered navigation mesh, eliminating the need for re-processing the entire path based on each layer's navigation mesh, thus reducing computational resource consumption.
[0194] The following explains the pathfinding process in step 803A. (Refer to...) Figure 8C , Figure 8C This is a flowchart illustrating the path processing method for a virtual scene provided in an embodiment of this application.
[0195] In step 801C, pathfinding processing is performed on the k-th layer of the multi-layer navigation grid to obtain the navigation path corresponding to the k-th layer of the navigation grid.
[0196] For example, in this embodiment of the application, the midpoints of the boundaries of adjacent navigation patches are used as waypoints. The calculated path cost is then the sum of the Euclidean distances between the midpoints of the boundaries of each patch traversed by the path. (See reference...) Figure 7B , Figure 7B This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 701 is the k-th layer navigation mesh, comprising four navigation patches: M1, M2, M3, and M4. Regions S2 and S3 are non-navigation patch regions (regions where virtual objects cannot walk on the surface). Z1, Z2, Z3, and Z4 are the midpoints of different patch boundaries. The path between each midpoint is a sub-path. Starting from the path start point D1, connecting the midpoints towards the path end point D2 yields multiple navigation paths. In some embodiments, there may be at least one navigation path.
[0197] In step 802C, based on the midpoint of the boundary of each patch of the (k-1)th layer navigation mesh, each sub-path of the k-th layer navigation path is refined to obtain multiple refined sub-paths.
[0198] For example, each navigation patch in the k-th layer navigation mesh is obtained by aggregating the navigation patches of the (k-1)-th layer navigation mesh that are interconnected. Any one k-th layer navigation patch corresponds to multiple (k-1)-th layer navigation patches. Each midpoint traversed by the path in the k-th layer navigation mesh is mapped to the (k-1)-th layer navigation mesh as a waypoint. The sub-paths between each mapped waypoint are then refined based on the midpoints of the patch boundaries of the (k-1)-th layer navigation mesh.
[0199] refer to Figure 7C , Figure 7C This is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation mesh 702 is the (k-1)th layer navigation mesh, and midpoints Z1, Z2, Z3, and Z4 are mapped from the k-th layer navigation mesh to navigation mesh 702. Based on midpoints Z1, Z2, Z3, and Z4, the sub-paths between midpoints of the (k-1)th layer navigation mesh are refined according to the patch boundaries of the navigation patches in navigation mesh 702.
[0200] The following explanation uses navigation patches M4-1 and M4-2, corresponding to navigation patch M4 in navigation mesh 702, as examples. (Reference) Figure 7D , Figure 7D This is a schematic diagram of the pathfinding process provided in an embodiment of this application. The midpoint of the boundary between navigation patch M4-1 and navigation patch M4-2 is Z5. Path L1 (white line) is a sub-path between the midpoint Z4 and the midpoint Z3 in the k-th layer navigation mesh. Starting from the path start point D1, connecting the midpoints Z3, Z5, and Z4 towards the path end point D2 yields path L3 and path L2. Path L3 combined with path L2 is a refined sub-path of path L1.
[0201] In this embodiment, each navigation patch in the multi-layer navigation mesh, except for the bottommost layer, corresponds to a larger walkable area (compared to the bottommost navigation mesh). Therefore, it can significantly reduce the number of nodes traversed, accelerate long-distance pathfinding in virtual scenes, and return a complete path with better quality, avoiding the problem of incomplete paths caused by the limited number of iterations of the A* algorithm.
[0202] In step 803C, each refined sub-path is combined to obtain the navigation path of the (k-1)th layer navigation mesh.
[0203] For example, combining each refined sub-path in order from the path's starting point to its ending point yields the complete navigation path for the (k-1)th layer navigation mesh. The navigation path can be represented as a sequence of midpoints of the patch boundaries for data storage.
[0204] In step 804C, it is determined whether k-1 is equal to 0.
[0205] If the result of step 804C is yes, then step 805C is executed; if the result of step 804C is no, then step 806C is executed.
[0206] In step 805C, the navigation path in the pathfinding structure is obtained based on the mapping relationship between the navigation mesh of layer 0 and the pathfinding structure of the virtual scene.
[0207] In step 806C, k is set to k-1. After step 806C, step 802C is executed. Through iterative processing, the navigation path corresponding to the lowest layer, i.e., layer 0 navigation mesh, is finally obtained.
[0208] Figure 7F This is a schematic diagram of the refinement process provided in the embodiments of this application. The navigation path of the k-th layer navigation grid includes multiple sub-paths (k-th layer sub-path 1, k-th layer sub-path 2, ...). Based on the (k-1)-th layer navigation grid, each sub-path is progressively refined to obtain the navigation path of the 0-th layer navigation grid. The navigation path of the 0-th layer navigation grid is then mapped to obtain the navigation path in the pathfinding structure. The navigation path in the pathfinding structure includes multiple sub-paths (sub-path 1, sub-path 2, sub-path 3, sub-path 4, ... sub-path n, where n is a positive integer). Real-world navigation guide lines in the virtual scene can then be generated based on the navigation paths in the pathfinding structure and displayed to assist the user in moving virtual objects; alternatively, the virtual objects can be controlled to move automatically based on the navigation paths in the pathfinding structure.
[0209] In some embodiments, the final navigation path can be multiple, see reference. Figure 7E , Figure 7EThis is a schematic diagram of the pathfinding process provided in an embodiment of this application. Navigation grid 703 is the lowest-level navigation grid, and navigation paths L4 and L5 are the final refined navigation paths. Based on the actual distance a virtual object needs to move in the virtual scene, a preferred path can be selected from navigation paths L4 and L5, and the virtual object can be controlled to move automatically according to the preferred path. For example, if the virtual object is a non-player-controlled character, it can be controlled to move automatically according to the preferred path.
[0210] For example, the virtual scene path processing method of this application generates a multi-layer navigation mesh with four levels for a 2km*2km area in the virtual scene. Compared with the prior art, which only generates the navigation mesh corresponding to the virtual scene, generating a multi-layer navigation mesh requires an additional 2 seconds. The memory usage is as follows: Level 0 12.50MB, Level 1 1.59MB, Level 2 0.55MB, and Level 3 0.32MB. The path finding time is shown in Table (1) below. Table (1) is a comparison table of the path finding time of the multi-layer navigation mesh of the virtual scene path processing method provided by this application and the projection navigation mesh of the prior art. The virtual scene path processing method provided by this application consumes far less time for path finding over a long distance of 2800 meters in a virtual scene (area of 2km*2km) than the prior art. Furthermore, this application significantly reduces the runtime path finding time consumption with less additional memory usage and can return a better complete path.
[0211]
[0212] Table (1)
[0213] The embodiments of this application can significantly reduce the time overhead of pathfinding in virtual scenes. Compared with the A* algorithm of related technologies, which is limited by the number of iterations and cannot return results for pathfinding requests, the path processing method for virtual scenes provided by the embodiments of this application saves the computing resources required for pathfinding, and can obtain complete paths. It also supports pathfinding through special paths such as navigation links (paths connecting different navigation patches), and can be compatible with more application scenarios.
[0214] The following description continues to illustrate the exemplary structure of the virtual scene path processing device 455 provided in the embodiments of this application as a software module. In some embodiments, such as... Figure 2As shown, the software modules in the virtual scene path processing device 455 stored in the memory 450 may include: a mesh processing module 4551, configured to obtain a multi-layer navigation mesh of the virtual scene simplified layer by layer from bottom to top, wherein any navigation patch in the upper navigation mesh is mapped to multiple corresponding navigation patches in the lower navigation mesh; a path processing module 4552, configured to obtain the path start point and path end point of the virtual object in the virtual scene; the path processing module 4552 is further configured to perform pathfinding processing in the uppermost navigation mesh based on the path start point and path end point to obtain at least one uppermost path corresponding to the uppermost navigation mesh; the path processing module 4552 is further configured to perform mapping processing from top to bottom based on the uppermost path, starting from the uppermost navigation mesh to obtain at least one lower path corresponding to at least one lower navigation mesh, wherein the path corresponding to each navigation mesh other than the lowermost navigation mesh is used for lower-level mapping processing. The path processing module 4552 is further configured to use at least one lower path corresponding to at least one lower navigation mesh as a navigation path.
[0215] In some embodiments, the mesh processing module 4551 is configured to obtain the pathfinding structure of the virtual scene, wherein the pathfinding structure includes the connection relationship between each navigation patch and each navigation path, and the navigation path is a path connecting different navigation patches; based on the connection relationship, each navigation patch and each navigation path are combined to form the bottom layer navigation mesh of the multi-layer navigation mesh; from bottom to top, each navigation patch of the bottom layer navigation mesh is aggregated to obtain the navigation mesh corresponding to each level, wherein each navigation mesh except the top layer navigation mesh is used for the aggregation processing of the previous level, and the area of the navigation mesh corresponding to each level is the same; the navigation meshes of each level are combined from bottom to top to form a multi-layer navigation mesh.
[0216] In some embodiments, the mesh processing module 4551 is configured to take the lowest-level navigation mesh as the navigation mesh to be processed and perform the following aggregation sub-processing on the mesh to be processed: grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, wherein each navigation patch in the navigation patch group is interconnected; aggregating each navigation patch corresponding to each navigation patch group into a navigation patch of the upper layer; forming the upper layer navigation mesh of the navigation mesh to be processed by each upper layer navigation patch; taking the upper layer navigation mesh as the new navigation mesh to be processed and entering the aggregation sub-processing for the new mesh to be processed, until each navigation patch in the upper layer navigation mesh obtained by the aggregation sub-processing is no longer interconnected.
[0217] In some embodiments, before grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, the mesh processing module 4551 is configured to obtain connected regions in the navigation mesh to be processed, wherein each navigation patch in the connected region is interconnected, and different connected regions are not interconnected; the mesh processing module 4551 is configured to perform the following processing on the multiple navigation patches in each connected region: obtain each patch boundary adjacent to each interconnected navigation patch; based on the minimum segmentation cost and each patch boundary, segment at least two navigation patches in the multiple navigation patches to obtain multiple navigation patch groups; wherein the segmentation cost is the number of interconnected patch boundaries, the interconnected patch boundaries are obtained by segmenting aggregated patches from the navigation mesh to be processed, and the aggregated patches are obtained by aggregating multiple navigation patches into a whole.
[0218] In some embodiments, the mesh processing module 4551 is configured to, before grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, determine that the two navigation patches are not connected to each other when any two navigation patches meet the connectivity restriction conditions, wherein the connectivity restriction conditions include at least one of the following: at least one of the two navigation patches is located in a restricted area in the virtual scene, wherein the restricted area is an area that virtual objects are prohibited from entering; any two navigation patches belong to different areas in the virtual scene, and the different areas are not connected to each other.
[0219] In some embodiments, the path processing module 4552 is configured to map the path start point and path end point to the top-level navigation mesh, and obtain the midpoint of the boundary of each navigation patch in the top-level navigation mesh; starting from the path start point, perform path connection processing on multiple midpoints between the path start point and the path end point and the path end point to obtain at least one candidate path; sort the number of midpoints traversed by each candidate path in ascending order, and take at least one candidate path located at the head of the ascending order result as the top-level path.
[0220] In some embodiments, the path processing module 4552 is configured to start from the path start point and traverse each midpoint between the path start point and the path end point in the direction from the path start point to the path end point to perform the following processing: connect each midpoint based on the ascending order of the number of nodes between the path start point and the path start point, wherein the number of nodes is the number of nodes between the midpoint and the path start point in the candidate path.
[0221] In some embodiments, the path processing module 4552 is configured to take the topmost path as the uppermost path, the topmost navigation mesh as the next-level navigation mesh, and the next-level navigation mesh of the topmost path as the navigation mesh to be processed, and perform the following mapping sub-processes: mapping the path start point, path end point, and the midpoint of each patch boundary traversed by the uppermost path in the next-level navigation mesh to the navigation mesh to be processed, respectively, to obtain the path start point, path end point, and multiple mapped midpoints in the navigation mesh to be processed; taking the navigation patches traversed by the uppermost path in the next-level navigation mesh as path patches, and mapping each... Each path patch is mapped onto the navigation mesh of the layer to be processed to determine multiple navigation patches corresponding to each path patch, wherein the multiple navigation patches belong to the navigation mesh of the layer to be processed. Based on the multiple navigation patches corresponding to each path patch, the sub-path corresponding to each path patch is transformed into at least one refined sub-path corresponding to each path patch, wherein the sub-path is the path in the upper layer path that passes through the path patch, and the refined sub-path passes through the midpoint of the boundary of at least one patch corresponding to multiple navigation patches. Each refined sub-path is combined in the direction from the starting point of the path to the ending point of the path to obtain at least one lower layer path corresponding to the navigation mesh of the layer to be processed.
[0222] In some embodiments, the path processing module 4552 is configured to combine each refined sub-path in the direction from the path start point to the path end point to obtain at least one lower-level path corresponding to the navigation grid to be processed, then take the navigation grid to be processed as the upper-level navigation grid, take the next-level navigation grid of the navigation grid to be processed as the new navigation grid to be processed, and proceed to the mapping sub-processing for the navigation grid to be processed until the navigation grid to be processed obtained by the mapping sub-processing is the lowest-level navigation grid.
[0223] In some embodiments, the path processing module 4552 is configured to perform the following processing for each path patch and the corresponding multiple navigation patches: according to the direction from the path start point to the path end point, perform path connection processing on the mapping midpoints corresponding to the path patch and the midpoints of the boundaries of each patch corresponding to the multiple navigation patches to obtain multiple sub-candidate paths; sort the number of midpoints passed by each sub-candidate path in ascending order, and take at least one candidate path located at the head of the ascending order sorting result as the refined sub-path corresponding to the path patch.
[0224] In some embodiments, the path processing module 4552 is configured to determine each lower path corresponding to each lower navigation grid, and to take the path that meets the filtering conditions as the navigation path, wherein the filtering conditions include at least any one of the following: the lower path has the shortest corresponding movement distance in the virtual scene; the lower path crosses the fewest navigation patches in the pathfinding structure of the virtual scene.
[0225] In some embodiments, the path processing module 4552 is configured to respond to the map hierarchy of the virtual scene corresponding to a lower navigation grid, and the lower navigation grid is an intermediate navigation grid. After taking at least one lower path corresponding to at least one lower navigation grid as a navigation path, the navigation path corresponding to the intermediate navigation grid is displayed in the map. From the intermediate navigation grid to the bottommost navigation grid, mapping processing is performed from top to bottom based on the intermediate navigation grid to obtain at least one lower path corresponding to each navigation grid.
[0226] In some embodiments, the path processing module 4552 is configured to, after taking at least one lower path corresponding to at least one lower navigation grid as a navigation path, display the navigation path corresponding to the intermediate navigation grid in the map; in response to a triggering operation of displaying the next layer navigation grid of the intermediate navigation grid, perform mapping processing based on the intermediate navigation grid to obtain at least one lower path corresponding to the next layer navigation grid; take at least one lower path of the next layer navigation grid as a navigation path and display the navigation path in the map.
[0227] In some embodiments, the path processing module 4552 is configured to display a map of a virtual scene, the map scale of which corresponds to the lower navigation grid; display at least one lower path of the lower navigation grid in the map; and, in response to a selection operation for any lower path, use the lower path as a navigation path and display the selected navigation path.
[0228] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the virtual scene path processing method described above in this application.
[0229] This application provides a computer-readable storage medium storing executable instructions. When these executable instructions are executed by a processor, they cause the processor to execute the path processing method for a virtual scene provided in this application. For example... Figure 3A The method for handling paths in a virtual scene is shown.
[0230] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0231] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0232] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).
[0233] As an example, executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located in one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0234] In summary, by decomposing the virtual scene into multiple navigation meshes through the embodiments of this application, each layer except the top layer performs pathfinding by mapping the path of the upper layer navigation mesh to the lower layer navigation mesh. Compared to performing independent pathfinding at each layer, the use of the path of the upper layer navigation mesh as a reference avoids the computational resource consumption caused by traversing a large number of navigation patches in the virtual scene, reduces the memory occupied by the client running the virtual scene, improves the pathfinding efficiency in the virtual scene, and thus saves computational resources.
[0235] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A path processing method for a virtual scene, characterized in that, The method includes: Obtain a simplified multi-layer navigation mesh of the virtual scene from bottom to top, wherein any navigation patch in the upper layer navigation mesh is mapped to multiple corresponding navigation patches in the lower layer navigation mesh; Obtain the start and end points of the path of the virtual object in the virtual scene; Based on the path start point and the path end point, pathfinding is performed in the topmost navigation grid to obtain at least one topmost path corresponding to the topmost navigation grid. The pathfinding process uses the midpoint of the boundary of adjacent facets between navigation facets as waypoints, and the path cost corresponding to the calculated path is the sum of the Euclidean distances between the midpoints of the boundary of each facet passed by the path. Starting from the topmost navigation grid, mapping is performed from top to bottom based on the topmost path to obtain at least one lower path corresponding to at least one lower navigation grid. The path corresponding to each navigation grid other than the bottommost navigation grid is used for lower-level mapping. The mapping process includes: using the topmost path as the upper path, the topmost navigation grid as the next-upper navigation grid, and the next-upper navigation grid as the navigation grid to be processed, and performing the following mapping sub-processes: mapping the path start point, the path end point, and the midpoint of each patch boundary traversed by the upper path in the next-upper navigation grid to the navigation grid to be processed, respectively, to obtain the path start point, path end point, and multiple mapped midpoints in the navigation grid to be processed; and mapping the upper path to the next-upper navigation grid... The navigation patches traversed in the upper-layer navigation mesh are used as path patches. Each path patch in the upper-layer navigation mesh is mapped to the navigation mesh to be processed to determine multiple navigation patches corresponding to each path patch, wherein the multiple navigation patches belong to the navigation mesh to be processed. Based on the multiple navigation patches corresponding to each path patch, the sub-path corresponding to each path patch is transformed into at least one refined sub-path corresponding to each path patch, wherein the sub-path is the path in the upper-layer path that passes through the path patch, and the refined sub-path passes through the midpoint of at least one patch boundary corresponding to multiple navigation patches. Each refined sub-path is combined according to the direction from the starting point of the path to the ending point of the path to obtain at least one lower-layer path corresponding to the navigation mesh to be processed. The at least one lower path corresponding to at least one lower navigation grid is used as the navigation path.
2. The method of claim 1, wherein, The process of obtaining a simplified multi-layer navigation mesh of the virtual scene from bottom to top includes: Obtain the pathfinding structure of the virtual scene, wherein the pathfinding structure includes the connection relationship between each navigation patch and each navigation path, and the navigation path is a path connecting different navigation patches; Based on the connection relationship, each navigation patch and each navigation path are combined to form the bottom layer of the multi-layer navigation grid; The navigation mesh is aggregated from bottom to top based on each of the navigation patches of the bottommost navigation mesh to obtain the navigation mesh corresponding to each level. Each navigation mesh except the topmost navigation mesh is used for the aggregation process of the previous level, and the area of the navigation mesh corresponding to each level is the same. The navigation grids of each level are combined from bottom to top to form a multi-layered navigation grid.
3. The method of claim 2, wherein, The bottom-up aggregation process based on each navigation patch of the lowest-level navigation mesh includes: The lowest-level navigation mesh is taken as the navigation mesh to be processed, and the following aggregate subprocessing is performed on the navigation mesh to be processed; Each navigation patch in the navigation mesh to be processed is grouped to obtain multiple navigation patch groups, wherein each navigation patch in the navigation patch group is interconnected; Each navigation patch corresponding to each navigation patch group is aggregated into a navigation patch of the upper layer; Each of the navigation patches in the previous layer is used to form the navigation mesh of the layer to be processed. The previous layer navigation mesh is used as the new navigation mesh to be processed, and the process is transferred to the aggregate subprocess for the new navigation mesh to be processed until each navigation patch in the previous layer navigation mesh obtained by the aggregate subprocess is not connected to each other.
4. The method of claim 3, wherein, Before grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, the method further includes: Obtain the connected regions in the navigation mesh of the layer to be processed, wherein each navigation patch in the connected region is interconnected, and different connected regions are not interconnected; The process of grouping each navigation patch in the navigation mesh of the layer to be processed to obtain multiple navigation patch groups includes: For each of the multiple navigation patches in each of the connected regions, the following processing is performed: Obtain the boundary of each adjacent facet among interconnected navigation faces; Based on the minimum segmentation cost and the boundary of each of the multiple navigation patches, at least two of the navigation patches are segmented to obtain multiple groups of navigation patches. The segmentation cost is the number of interconnected patch boundaries, which are obtained by segmenting aggregated patches from the navigation mesh of the layer to be processed. The aggregated patches are obtained by aggregating multiple navigation patches into a whole.
5. The method of claim 3, wherein, Before grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, the method further includes: When any two navigation patches satisfy the connectivity constraint, it is determined that the two navigation patches are not connected to each other, wherein the connectivity constraint includes at least one of the following: At least one of any two navigation patches is located in a restricted area of the virtual scene, wherein the restricted area is an area where the virtual object is prohibited from entering; Any two navigation patches belong to different regions in the virtual scene, and the different regions are not connected.
6. The method of claim 1, wherein, The step of performing pathfinding processing in the top-level navigation grid based on the path start point and the path end point to obtain at least one top-level path corresponding to the top-level navigation grid includes: Map the path start point and the path end point to the topmost navigation mesh, and obtain the midpoint of the boundary of each navigation patch in the topmost navigation mesh; Starting from the path start point, perform path connection processing on multiple midpoints between the path start point and the path end point, as well as the path end point, to obtain at least one alternative path; Sort the number of midpoints traversed by each candidate path in ascending order, and take at least one candidate path at the head of the ascending sort result as the top-level path.
7. The method of claim 6, wherein, The process of connecting multiple midpoints between the path start point and the path end point, starting from the path start point, includes: Starting from the path's starting point, traverse each of the midpoints between the path's starting point and its ending point in the direction from the path's starting point to its ending point, and perform the following processing: Each midpoint is connected based on the ascending order of the number of nodes between it and the starting point of the path, wherein the number of nodes is the number of nodes between the midpoint and the starting point of the path in the candidate path.
8. The method of claim 1, wherein, After combining each refined sub-path in the direction from the starting point of the path to the ending point of the path to obtain at least one lower-level path corresponding to the navigation mesh of the layer to be processed, the method further includes: The navigation mesh to be processed is taken as the upper navigation mesh, and the navigation mesh below the navigation mesh to be processed is taken as the new navigation mesh to be processed. Then, the process is transferred to the mapping subprocess for the navigation mesh to be processed until the navigation mesh to be processed obtained by the mapping subprocess is the lowest navigation mesh.
9. The method as described in claim 1, characterized in that, The step of transforming the sub-path corresponding to each path patch into at least one refined sub-path corresponding to each path patch, based on multiple navigation patches corresponding to each path patch, includes: For each of the path patches and the corresponding plurality of navigation patches, the following processing is performed: According to the direction from the starting point of the path to the ending point of the path, the mapping midpoints corresponding to the path patches and the midpoints of the boundaries of each patch corresponding to the multiple navigation patches are processed to obtain multiple sub-candidate paths; Sort the number of midpoints traversed by each of the sub-candidate paths in ascending order, and take at least one of the sub-candidate paths at the head of the ascending sort result as the refined sub-path corresponding to the path patch.
10. The method according to any one of claims 1 to 9, characterized in that, The step of using at least one lower-level path corresponding to at least one lower-level navigation grid as a navigation path includes: Determine each lower-level path corresponding to each lower-level navigation grid, and take the path that meets the filtering criteria from each lower-level path as the navigation path, wherein the filtering criteria include at least any one of the following: The lower-level path has the shortest corresponding movement distance in the virtual scene; The lower-level path traverses the fewest navigation patches in the pathfinding structure of the virtual scene.
11. The method according to any one of claims 1 to 9, wherein The map hierarchy in response to the virtual scene corresponds to the lower navigation grid, and the lower navigation grid is an intermediate navigation grid. After taking at least one lower path corresponding to at least one lower navigation grid as the navigation path, the method further includes: The navigation path corresponding to the intermediate navigation grid is displayed on the map; Starting from the intermediate navigation grid and continuing down to the bottom navigation grid, a mapping process is performed based on the intermediate navigation grid from top to bottom to obtain at least one lower-level path corresponding to each navigation grid.
12. The method according to any one of claims 1 to 9, wherein The map hierarchy in response to the virtual scene corresponds to the lower navigation grid, and the lower navigation grid is an intermediate navigation grid. After taking at least one lower path corresponding to at least one lower navigation grid as the navigation path, the method further includes: The navigation path corresponding to the intermediate navigation grid is displayed on the map; In response to a triggering operation that displays the next layer navigation grid of the intermediate layer navigation grid, a mapping process is performed based on the intermediate layer navigation grid to obtain at least one lower layer path corresponding to the next layer navigation grid; At least one lower-level path of the next-level navigation grid is used as the navigation path, and the navigation path is displayed on the map.
13. The method according to any one of claims 1 to 9, characterized in that, The step of using at least one lower-level path corresponding to at least one lower-level navigation grid as a navigation path includes: A map displaying a virtual scene is shown, the map's scale corresponding to the lower-level navigation grid; At least one lower-level path of the lower-level navigation grid is displayed in the map; In response to a selection operation for any of the lower-level paths, the lower-level path is used as the navigation path, and the selected navigation path is displayed.
14. A path processing apparatus of a virtual scene, characterized in that, The device includes: The mesh processing module is configured to obtain a multi-layer navigation mesh of the virtual scene, which is simplified from bottom to top. In this layer, any navigation facet in the upper navigation mesh is mapped to multiple corresponding navigation faces in the lower navigation mesh. The path processing module is configured to obtain the start and end points of the path of the virtual object in the virtual scene; The path processing module is further configured to perform pathfinding processing in the topmost navigation grid based on the path start point and the path end point to obtain at least one topmost path corresponding to the topmost navigation grid. The pathfinding processing uses the midpoint of the boundary of adjacent facets between navigation facets as waypoints, and the path cost corresponding to the calculated path is the sum of the Euclidean distances between the midpoints of the boundary of each facet passed by the path. The path processing module is further configured to perform mapping processing from top to bottom based on the topmost navigation grid, starting from the topmost navigation grid, to obtain at least one lower-level path corresponding to at least one lower-level navigation grid. The path corresponding to each navigation grid other than the bottommost navigation grid is used for lower-level mapping processing. The mapping processing includes: using the topmost path as the upper-level path, the topmost navigation grid as the next-upper-level navigation grid, and the next-upper-level navigation grid as the navigation grid to be processed, and performing the following mapping sub-processes: mapping the path start point, the path end point, and the midpoint of each patch boundary traversed by the upper-level path in the next-upper-level navigation grid to the navigation grid to be processed, respectively, to obtain the path start point, path end point, and multiple mapped midpoints in the navigation grid to be processed; and mapping the path start point, path end point, and multiple mapped midpoints in the navigation grid to be processed. The navigation patches traversed by the upper-level path in the upper-level navigation mesh are used as path patches. Each path patch in the upper-level navigation mesh is mapped to the navigation mesh to be processed to determine multiple navigation patches corresponding to each path patch, wherein the multiple navigation patches belong to the navigation mesh to be processed. Based on the multiple navigation patches corresponding to each path patch, the sub-path corresponding to each path patch is transformed into at least one refined sub-path corresponding to each path patch, wherein the sub-path is the path in the upper-level path that passes through the path patch, and the refined sub-path passes through the midpoint of the boundary of at least one patch corresponding to multiple navigation patches. Each refined sub-path is combined according to the direction from the starting point of the path to the ending point of the path to obtain at least one lower-level path corresponding to the navigation mesh to be processed. The path processing module is further configured to use at least one lower-level path corresponding to at least one lower-level navigation grid as a navigation path.
15. The apparatus of claim 14, wherein, The grid processing module is specifically used for: Obtain the pathfinding structure of the virtual scene, wherein the pathfinding structure includes the connection relationship between each navigation patch and each navigation path, and the navigation path is a path connecting different navigation patches; Based on the connection relationship, each navigation patch and each navigation path are combined to form the bottom layer of the multi-layer navigation grid; The navigation mesh is aggregated from bottom to top based on each of the navigation patches of the bottommost navigation mesh to obtain the navigation mesh corresponding to each level. Each navigation mesh except the topmost navigation mesh is used for the aggregation process of the previous level, and the area of the navigation mesh corresponding to each level is the same. The navigation grids of each level are combined from bottom to top to form a multi-layered navigation grid.
16. The apparatus of claim 15, wherein, The grid processing module is also used for: The lowest-level navigation mesh is taken as the navigation mesh to be processed, and the following aggregate subprocessing is performed on the navigation mesh to be processed; Each navigation patch in the navigation mesh to be processed is grouped to obtain multiple navigation patch groups, wherein each navigation patch in the navigation patch group is interconnected; Each navigation patch corresponding to each navigation patch group is aggregated into a navigation patch of the upper layer; Each of the navigation patches in the previous layer is used to form the navigation mesh of the layer to be processed. The previous layer navigation mesh is used as the new navigation mesh to be processed, and the process is transferred to the aggregate subprocess for the new navigation mesh to be processed until each navigation patch in the previous layer navigation mesh obtained by the aggregate subprocess is not connected to each other.
17. The apparatus of claim 16, wherein, The grid processing module is also used for: Before grouping each navigation patch in the navigation mesh to be processed to obtain multiple navigation patch groups, a connected region in the navigation mesh to be processed is obtained, wherein each navigation patch in the connected region is interconnected, and different connected regions are not interconnected. The grid processing module is also used for: For each of the multiple navigation patches in each of the connected regions, the following processing is performed: Obtain the boundary of each adjacent facet among interconnected navigation faces; Based on the minimum segmentation cost and the boundary of each of the multiple navigation patches, at least two of the navigation patches are segmented to obtain multiple groups of navigation patches. The segmentation cost is the number of interconnected patch boundaries, which are obtained by segmenting aggregated patches from the navigation mesh of the layer to be processed. The aggregated patches are obtained by aggregating multiple navigation patches into a whole.
18. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the method according to any one of claims 1 to 13.
19. A computer-readable storage medium storing executable instructions, the method comprising: When the executable instructions are executed by the processor, they implement the method according to any one of claims 1 to 13.
20. A computer program product comprising computer programs or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the method described in any one of claims 1 to 13.