Path construction method, device, equipment, medium and product in virtual scene
By automatically determining the outer edges and sampling points of navigation patches in a virtual scene, a path corresponding to the movement type is generated, which solves the problem of low path construction efficiency in existing technologies and is suitable for large-scale virtual scenes and frequently updated scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-04-20
- Publication Date
- 2026-05-19
AI Technical Summary
In existing technologies, manually placing virtual scene paths is inefficient and cannot be applied to large-scale virtual scenes and frequent updates.
By acquiring non-adjacent navigation patches in the virtual scene, determining the external edges and orientations, and sampling to obtain uniformly distributed sampling points, the path corresponding to the movement type is automatically determined based on the sampling points and the orientation of the external edges, thus controlling the virtual object to move between navigation patches.
It improves path construction efficiency in large-scale virtual scenes and frequent updates, reduces reliance on developer operations, and is suitable for both online and offline games.
Smart Images

Figure CN116943203B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, device, medium and product for constructing paths in a virtual scene. Background Technology
[0002] With the development of virtual scene technology, virtual objects need to move in virtual scenes in various ways, such as climbing and jumping. Virtual scenes are formed by connecting multiple navigation tiles, and the movement of virtual objects is actually decomposed into movement between different navigation tiles.
[0003] When a virtual object needs to automatically move from one navigation tile to a non-adjacent navigation tile, paths corresponding to different movement types need to be pre-placed manually in the virtual scene to control the virtual object's movement along the corresponding path. However, manual placement is inefficient and unsuitable for large-scale virtual scenes or situations where the virtual scene is frequently updated.
[0004] There is currently no effective solution in terms of how to improve the efficiency of constructing paths in virtual scenes. Summary of the Invention
[0005] This application provides a method, apparatus, and computer-readable storage medium for constructing paths in a virtual scene, which can effectively improve the efficiency of constructing paths in a virtual scene.
[0006] The technical solution of this application embodiment is implemented as follows:
[0007] This application provides a path construction method for a virtual scene, including:
[0008] Obtain a first navigation patch and a second navigation patch of a virtual scene, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene;
[0009] Based on the relative positional relationship between the first navigation patch and the second navigation patch, the outer edge of the first navigation patch and the orientation of the outer edge are determined, wherein the outer edge is the edge of the first navigation patch that has navigation information on one side, and the orientation is the direction pointing to the side of the outer edge that does not have the navigation information.
[0010] Sampling is performed on each of the external edges to obtain multiple sampling points evenly distributed within the external edges. For any one of the sampling points, the following processing is performed:
[0011] Based on the sampling points and the orientation of the external edges, determine the path corresponding to the movement type;
[0012] The path is used to control the virtual object to move between the first navigation panel and the second navigation panel according to the movement type.
[0013] This application provides a path construction device for a virtual scene, including:
[0014] The acquisition module is used to acquire a first navigation patch and a second navigation patch of a virtual scene, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene;
[0015] The first determining module is used to determine the outer edge of the first navigation patch and the orientation of the outer edge based on the relative positional relationship between the first navigation patch and the second navigation patch, wherein the outer edge is the edge of the first navigation patch that has navigation information on one side, and the orientation is the direction pointing to the side of the outer edge that does not have the navigation information.
[0016] A sampling module is used to perform sampling processing from each of the external edges to obtain multiple sampling points evenly distributed in the external edges;
[0017] The second determining module is used to determine a path corresponding to the movement type based on the sampling point and the orientation of the external edge; wherein the path is used to control the virtual object to move between the first navigation panel and the second navigation panel corresponding to the movement type.
[0018] This application provides an electronic device, including:
[0019] Memory, used to store executable instructions;
[0020] The processor, when executing executable instructions stored in the memory, implements the path construction method for the virtual scene provided in the embodiments of this application.
[0021] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute a path construction method for a virtual scene provided in this application.
[0022] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the virtual scene path construction method described above in this application.
[0023] The embodiments of this application have the following beneficial effects:
[0024] By determining multiple evenly distributed sampling points from the outer edges of the first navigation patch, and based on these sampling points and the outer edges, a path corresponding to the movement type is determined. The virtual object is then controlled to move between the first and second navigation patches according to the corresponding movement type. Since the computing device can automatically execute this process, the path does not require developer intervention in its placement, and paths corresponding to each sampling point can be generated in batches. This makes it suitable for large-scale virtual scenes and situations with frequent updates to the virtual scene, effectively improving the efficiency of constructing virtual scene paths. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the structure of the virtual scene path construction system provided in the embodiments of this application;
[0026] Figure 2 This is a schematic diagram of the structure of the virtual scene path construction device provided in the embodiments of this application;
[0027] Figures 3A to 3I This is a flowchart illustrating the path construction method for a virtual scene provided in an embodiment of this application;
[0028] Figures 4A to 4B This is a schematic diagram illustrating the principles of the relevant technologies;
[0029] Figures 4C to 4P This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in the embodiments of this application. Detailed Implementation
[0030] 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.
[0031] 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.
[0032] 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.
[0033] 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.
[0034] 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.
[0035] 1) Navigation Mesh: 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.
[0036] 2) Navigation patch: It is the smallest unit of the navigation mesh, representing a convex polygon. Additional navigation information is stored in the navigation patch.
[0037] 3) Virtual geometry: This is a data structure that records the three-dimensional shape (e.g., capsule shape) used to represent virtual objects. It simplifies the description of the collision volume of characters in the game and has attributes such as height and radius.
[0038] 4) Game Engine: This refers to the core components of pre-written, editable computer game systems or interactive real-time graphics applications. These systems provide game designers with various tools needed to write games, aiming to allow game developers to easily and quickly create game programs without starting from scratch. Most support multiple operating platforms, such as Linux, Mac OS X, and Microsoft Windows. A game engine includes the following systems: rendering engine (i.e., "renderer," including 2D and 3D graphics engines), physics engine, collision detection system, sound effects, scripting engine, computer animation, artificial intelligence, network engine, and scene management.
[0039] 5) Virtual Scene: This refers to the scene displayed (or provided) by the game program when it runs on a terminal device. The scene can be a simulation of the real world, a semi-simulated / semi-fictional environment, or a purely fictional virtual environment. A virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. Users can control virtual objects to move within this virtual scene.
[0040] 6) Responding to: used to indicate the conditions or states on which the operation is performed. When the conditions or states on which the operation is performed are met, one or more operations 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.
[0041] 7) Cloud gaming: This is a gaming method based on cloud computing. In cloud gaming, all games run on the server side, and the rendered game screen is compressed and transmitted to the user over the network. On the client side, the user's gaming device does not need any high-end processors or graphics cards; only basic video decompression capabilities are required.
[0042] 8) Path: Used to control the movement of virtual objects between two non-adjacent navigation tiles on the terrain of the virtual scene, according to the corresponding movement type. The connection structure generated by the movement of virtual geometry between two non-adjacent navigation tiles on the terrain can be used as a path; that is, a path can be a connection structure generated by the movement of virtual geometry between two non-adjacent navigation tiles on the terrain.
[0043] 9) External edge: The edge in the navigation patch that has navigation information on one side.
[0044] 10) Internal edge: The edge in the navigation patch that has navigation information on both sides.
[0045] 11) Virtual geometry can stand: At a certain point in the virtual scene, the volume of the virtual geometry and the surrounding virtual scene environment are physically intersected. When the physical intersection judgment result indicates that the virtual geometry does not intersect with the surrounding virtual scene environment, the virtual geometry does not collide with the surrounding virtual scene environment, and at this time the virtual geometry can stand.
[0046] 12) Connection Structure: This is a data structure that records the coordinates of each point on the movement trajectory of a virtual geometry between two non-adjacent navigation tiles, as well as the occurrence time of each coordinate. The occurrence time of the coordinates at the start of the movement trajectory is earlier than that at the end. Connection structures include climbing connection structures and jumping connection structures. The climbing connection structure records the coordinates of each point on the climbing movement trajectory between two non-adjacent navigation tiles, along with the occurrence time of each coordinate. In the climbing connection structure, the ordinate of the start of the climbing movement trajectory is less than the ordinate of the end of the climbing movement trajectory. The jumping connection structure records the coordinates of each point on the jumping movement trajectory between two non-adjacent navigation tiles, along with the occurrence time of each coordinate. In the jumping connection structure, the ordinate of the start of the jumping movement trajectory is greater than the ordinate of the end of the jumping movement trajectory.
[0047] During the implementation of the embodiments of this application, the applicant discovered the following problems with the related technology:
[0048] In related technologies, see Figure 4A , Figure 4A This is a schematic diagram of the relevant technology. In response to a search operation on search box 1, path 2 is placed on the map of the virtual scene; in response to click operations on the path start point 4 and path end point 3, the position of path 2 on the map is adjusted so that the position of path 2 meets the developer's design expectations.
[0049] In related technologies, see Figure 4B , Figure 4B This is a schematic diagram of the relevant technology. In response to the fine-tuning operation of the path starting point 5, the position of the path in the map is adjusted so that the position of the path meets the developer's design expectations.
[0050] Therefore, in related technologies, path setting relies on developer actions, resulting in relatively low efficiency. Setting paths on all four sides of an obstacle requires at least four developer actions. This demonstrates that repeatedly relying on developers to set paths is extremely inefficient, especially with large maps. Furthermore, when the virtual scene map changes, the path positions also need to be updated accordingly; in related technologies, this reliance on developer settings leads to low efficiency during the update process.
[0051] This application provides a method, apparatus, device, computer-readable storage medium, and computer program product for constructing paths in virtual scenes, which can effectively improve the efficiency of constructing paths in virtual scenes. The following describes an exemplary application of the virtual scene path construction device provided in this application. The device provided in this application can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), or as a server.
[0052] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the virtual scene path construction system 100 provided in the embodiments of this application. In order to realize the application scenario of virtual scene path construction (for example, in online games, constructing a path for controlling virtual objects to move between two navigation tiles that are not adjacent to each other), the terminal (terminal 400 is shown as an example) connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of both.
[0053] Terminal 400 is used by users to access client 410, and is displayed on graphical interface 410-1 (graphical interface 410-1 is shown as an example). Terminal 400 and server 200 are interconnected via wired or wireless network.
[0054] In some embodiments, server 200 may 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. Terminal 400 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, in-vehicle terminal, etc., but is not limited to these. Terminals and servers can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0055] In some embodiments, in the application scenario of online games, the server 200 obtains the first navigation panel and the second navigation panel of the virtual scene, determines the path for the virtual object to move between the first navigation panel and the second navigation panel, controls the virtual object to move between the first navigation panel and the second navigation panel according to the path, and sends the corresponding game scene image data to the terminal 400 for display.
[0056] In other embodiments, in the application scenario of a single-player game, the terminal 400 obtains the first navigation tile and the second navigation tile of the virtual scene, determines the path for the virtual object to move between the first navigation tile and the second navigation tile, and controls the virtual object to move between the first navigation tile and the second navigation tile according to the path.
[0057] In other embodiments, the embodiments of this application can 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.
[0058] 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, allowing for on-demand use with flexibility and convenience. Cloud computing technology will become a crucial support. The backend services of cloud computing systems require substantial computing and storage resources.
[0059] See Figure 2 , Figure 2 This is a schematic diagram of the server 200 for the virtual scene path construction method provided in this application embodiment. Figure 2 The server 200 shown includes at least one processor 210, memory 250, and at least one network interface 220. The various components of server 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to implement communication between these components. In addition to a data bus, the bus system 240 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 240.
[0060] Processor 210 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.
[0061] The memory 250 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 250 may optionally include one or more storage devices physically located away from the processor 210.
[0062] The memory 250 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 250 described in this application embodiment is intended to include any suitable type of memory.
[0063] In some embodiments, memory 250 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.
[0064] Operating system 251 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.
[0065] The network communication module 252 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 220, such as Bluetooth, WiFi, and Universal Serial Bus (USB).
[0066] In some embodiments, the virtual scene path construction apparatus provided in this application can be implemented in software. Figure 2 A path construction device 255 for a virtual scene stored in memory 250 is shown. This device can be software in the form of programs or plugins, and includes the following software modules: an acquisition module 2551, a first determination module 2552, a sampling module 2553, and a second determination module 2554. These modules are logically related and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0067] The path construction method for virtual scenes provided in this application will be described by referring to exemplary applications and implementations of the servers or terminals provided in the embodiments of this application. See also Figure 3A , Figure 3A This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment, which will be combined with... Figure 3A Steps 101 to 104 are described below.
[0068] In step 101, a first navigation patch and a second navigation patch of the virtual scene are obtained, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene.
[0069] As an example, see Figure 4E , Figure 4E This is a flowchart illustrating a path construction method for a virtual scene provided in this application embodiment. The server obtains a first navigation patch 701 and a second navigation patch 702 that are not adjacent on the terrain of the virtual scene. Because there is an obstacle 703 between the first navigation patch 701 and the second navigation patch 702, the first navigation patch 701 and the second navigation patch 702 are not adjacent on the terrain.
[0070] As an example, see Figure 4F , Figure 4F This is a flowchart illustrating a path construction method for a virtual scene provided in this application embodiment. The server obtains a first navigation patch 704 and a second navigation patch 705 that are not adjacent on the terrain of the virtual scene. Since there are other navigation patches between the first navigation patch 701 and the second navigation patch 702, the first navigation patch 704 and the second navigation patch 705 are not adjacent on the terrain.
[0071] In step 102, the outer edge of the first navigation patch and its orientation are determined based on the relative positional relationship between the first navigation patch and the second navigation patch.
[0072] The outer edge of the first navigation patch is the edge in the first navigation patch that has navigation information on one side, and its orientation is the direction pointing to the side of the outer edge that does not have navigation information. See, for example... Figure 4I , Figure 4I This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. The outer edge of the first navigation patch ABCD is the edge AD in the first navigation patch ABCD that has navigation information on one side.
[0073] Navigation information is the information contained within the navigation patch used to control the movement of virtual objects. See also... Figure 4F The navigation information carried inside the navigation patch 704 can be used to control the virtual object to move from point E to point F.
[0074] In some embodiments, see Figure 3B , Figure 3B A flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3B The step 102 shown can be implemented by performing steps 1021 to 1023 on any edge of the first navigation patch.
[0075] In step 1021, the navigation information on both sides of the edge is determined, wherein the navigation information indicates whether there is navigation information on both sides of the edge.
[0076] As an example, see Figure 4IOne side of edge AD has navigation information, while the other side does not. One side of edge AB has navigation information, and the other side also has navigation information. One side of edge BC has navigation information, and the other side also has navigation information.
[0077] In step 1022, in response to the navigation information condition indicating that only one side of the edge has navigation information, the edge is determined as an external edge.
[0078] As an example, see Figure 4I In response to the situation where navigation information indicates that only one side of the edge AD has navigation information, the edge AD is determined as an external edge.
[0079] In step 1023, the direction perpendicular to the outer edge and pointing to the side without navigation information is determined as the orientation of the outer edge.
[0080] As an example, see Figure 4I The direction perpendicular to the outer edge AD and pointing to the side without navigation information is determined as the orientation of the outer edge.
[0081] In this way, by determining the navigation information of the edge, the outer edge and its orientation can be determined, which facilitates the subsequent determination of the path used to control the virtual object to move between the first navigation panel and the second navigation panel according to the orientation of the outer edge.
[0082] In step 103, sampling is performed on each outer edge to obtain multiple sampling points evenly distributed in the outer edge.
[0083] In some embodiments, the sampling process is used to uniformly sample points on the outer edge to obtain sampling points. See also Figure 3B , Figure 3B A flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3B The step 103 shown can be implemented by performing the following steps 1031 to 1033 for any external edge.
[0084] In step 1031, the midpoint of the outer edge is determined as the sampling point.
[0085] As an example, the midpoint of the outer edge is equidistant from both endpoints of the outer edge.
[0086] As an example, see Figure 4J , Figure 4J This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. The midpoint P of the outer edge AB is determined as the sampling point, where the length of line segment AP is equal to the length of line segment PB.
[0087] In step 1032, the midpoint of the outer edge is used as the midpoint of the first iteration segmentation, and k iterations of segmentation are performed to obtain the 2nd segmentation of the outer edge. k Line segments are created until the length of the line segment is greater than the size of the virtual object.
[0088] Where k is a positive integer, and the size of the virtual object refers to the maximum value among the length, height and width of the virtual object.
[0089] In some embodiments, iterative segmentation is a process of dividing a line segment into two sub-segments by using the midpoint of the line segment as the dividing point.
[0090] As an example, see Figure 4J Using the midpoint of the outer edge as the midpoint of the first iteration of the segmentation, perform the first iteration of segmentation to obtain the second segment of the outer edge. 1 The sub-segments are sub-segments AP and PB. Sub-segments AP and PB are subjected to a second iteration of segmentation to obtain the second outer edge. 2 Line segments. Perform k iterations of segmentation to obtain the outer edge 2. k The process continues until the length of a sub-segment exceeds the size of the virtual object. In other words, the iterative segmentation stops when the length of a sub-segment is less than the size of the virtual object.
[0091] In step 1033, the midpoint of each sub-segment is determined as the sampling point.
[0092] As an example, see Figure 4J When k=1, the midpoints of sub-segment AP and sub-segment PB are determined as sampling points.
[0093] In this way, by sampling any external edge, multiple sampling points of the external edge are obtained, which makes it easier to construct the corresponding path at the sampling point. Since the length of the sub-segment is greater than the size of the virtual object, the density between sampling points is reasonable, and the virtual object is placed on one sampling point, rather than one virtual object being placed on two sampling points.
[0094] In step 104, the following processing is performed for any sampling point: based on the sampling point and the orientation of the external edge, the path corresponding to the movement type is determined.
[0095] The path is used to control the movement of virtual objects between the first navigation panel and the second navigation panel according to the corresponding movement type.
[0096] In some embodiments, the movement type includes climbing movement, and the path includes a climbing path. Climbing movement refers to movement where the height of the starting point is lower than the height of the ending point. A climbing path represents a climbing connection structure for performing a climbing movement. A climbing path can be a climbing connection structure generated by a virtual geometry climbing between a first navigation patch and a second navigation patch.
[0097] As an example, see Figure 4E The climbing path 51 is used to control the virtual object to climb and move between the first navigation panel 701 and the second navigation panel 702. The virtual object can climb and move along the climbing path 51 from the first navigation panel 701 to reach the second navigation panel 702. The climbing path 51 can be a climbing connection structure generated by the virtual geometry climbing and moving between the first navigation panel 701 and the second navigation panel 702.
[0098] In some embodiments, see Figure 3C , Figure 3C This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3C Step 104 shown can be achieved by performing steps 1041 to 1042.
[0099] In step 1041, the virtual geometry is controlled to move along the orientation at the sampling point.
[0100] Virtual geometry is a data structure used to describe the collision volume of virtual objects. See also: Figure 4K , Figure 4K This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. The virtual geometry 71 is controlled to move towards Dir at sampling point P.
[0101] In step 1042, in response to the virtual geometry encountering an obstacle while moving along the orientation, the virtual geometry is controlled to simulate a virtual object climbing based on the sampling point and orientation, and the connection structure formed during the climbing process of the virtual geometry is used as the climbing path.
[0102] As an example, see Figure 4K In response to the virtual geometry 71 encountering an obstacle 72 while moving along the direction Dir, based on the sampling point P and the direction Dir, the virtual geometry 71 is controlled to simulate a virtual object climbing, and the connection structure formed during the climbing process of the virtual geometry 71 is used as the climbing path.
[0103] In some embodiments, see Figure 3D , Figure 3D This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3DStep 1042 shown can be achieved by performing steps 10421 to 10422.
[0104] In step 10421, along a first direction perpendicular to the orientation, the virtual geometry is controlled to move multiple times from the sampling point according to the climbing step length, and the position reached by the virtual geometry in the last movement is determined as the end point of the climbing path.
[0105] In some embodiments, the climbing step size refers to the distance the virtual geometry moves each time. The climbing step size can be set according to the size of the virtual geometry.
[0106] As an example, see Figure 4K Along the first direction 73 perpendicular to Dir, the virtual geometry 71 is controlled to move multiple times from the sampling point P according to the climbing step length, and the position P1 reached by the last movement of the virtual geometry is determined as the end point of the climbing path.
[0107] In some embodiments, see Figure 3E , Figure 3E This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3E Step 10421 shown can be achieved by performing steps 104211 to 104215.
[0108] In step 104211, at the sampling point, the virtual geometry is controlled to move (i-1)th time along the first direction according to the climbing step length.
[0109] As an example, see Figure 4K At sampling point P, the virtual geometry 71 is controlled to move for the first time along the first direction 73 according to the climbing step length.
[0110] In some embodiments, the above step 104211 can be implemented in the following way: at the sampling point, control the virtual geometry to move for the first time along the first direction according to the climbing step length; at the position after the (i-1)th movement, control the virtual geometry to move for the i-th time along the first direction according to the climbing step length.
[0111] In step 104212, at the position after the i-th movement, the virtual geometry is controlled to move along the orientation.
[0112] As an example, see Figure 4K After the first move, control the virtual geometry to move towards Dir from its current position. After the second move, control the virtual geometry to move towards Dir from its current position. After the third move, control the virtual geometry to move towards Dir from its current position.
[0113] In step 104213, in response to encountering an obstacle during the movement in the forward direction, at the position after the i-th movement, control the virtual geometric body to perform the (i + 1)-th movement in the first direction according to the climbing step length.
[0114] Where 1 < i ≤ N, and N is the maximum number of movements when the virtual geometric body encounters an obstacle during the movement in the forward direction. That is, the virtual geometric body encounters an obstacle during the first N movements in the forward direction, and the virtual geometric body does not encounter an obstacle during the (N + 1)-th movement in the forward direction.
[0115] As an example, in response to encountering an obstacle during the movement in the forward direction, at the position after the first movement, control the virtual geometric body to perform the second movement in the first direction according to the climbing step length.
[0116] In step 104214, at the position after the (N + 1)-th movement, control the virtual geometric body to move in the forward direction.
[0117] As an example, see Figure 4K , at the position after the third movement, control the virtual geometric body 71 to move in the forward direction of Dir.
[0118] In step 104215, in response to not encountering an obstacle during the movement in the forward direction, control the virtual geometric body to move in the second direction perpendicular to the forward direction, and determine the position reached by the virtual geometric body moving in the second direction as the end point of the climbing path.
[0119] As an example, see Figure 4K , in response to not encountering an obstacle 72 during the movement in the forward direction of Dir, control the virtual geometric body 71 to move in the second direction 74 perpendicular to the forward direction, and determine the position reached by the virtual geometric body 72 moving in the second direction 74 as the end point P1 of the climbing path.
[0120] In step 10422, use the connection structure of the virtual geometric body climbing from the sampling point to the end point as the climbing path.
[0121] As an example, see Figure 4K , use the path of the virtual geometric body climbing from the sampling point P to the end point P1 as the climbing path.
[0122] In this way, by simulating the movement of the virtual object with the virtual geometric body, the position of the end point of the climbing path can be accurately determined, and thus the end point of the climbing path can be accurately determined. By using the connection structure of the virtual geometric body climbing from the sampling point to the end point as the climbing path, the climbing path can be automatically determined, and the determination process does not need to rely on the operation of the developer, thus significantly improving the efficiency of constructing the climbing path of the virtual scene.
[0123] In some embodiments, the movement type includes jump movement, and the path includes jump path. Jump movement refers to movement from a starting point at a height higher than the ending point. Jump path represents the connection structure for jump movement. Jump path can be a jump connection structure generated by virtual geometry jumping between a first navigation patch and a second navigation patch.
[0124] As an example, see Figure 4E The jump path 52 is used to control the virtual object to jump between the first navigation panel 701 and the second navigation panel 702. The virtual object can jump along the jump path 52 from the second navigation panel 702 to reach the first navigation panel 701. The climbing path 52 can be a jump connection structure generated by the virtual geometry jumping between the first navigation panel 701 and the second navigation panel 702.
[0125] See Figure 3F , Figure 3F This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3F Step 104 shown can be achieved by performing steps 1043 to 1044.
[0126] In step 1043, the virtual geometry is controlled to move along the orientation at the sampling point.
[0127] Virtual geometry is a data structure used to describe the collision volume of virtual objects.
[0128] As an example, see Figure 4L The virtual geometry 75 is controlled to move towards Dir at sampling point P.
[0129] In step 1044, in response to the virtual geometry not encountering any obstacles during its movement along the orientation, the virtual geometry is controlled to simulate a virtual object jumping based on the sampling point and orientation, and the connection structure formed during the virtual geometry's jump is used as the jump path.
[0130] As an example, see Figure 4L In response to the virtual geometry 75 not encountering an obstacle 76 during its movement toward Dir, based on the sampling point P and the orientation Dir, the virtual geometry 75 is controlled to simulate a virtual object jumping, and the path formed during the jumping process of the virtual geometry 75 is used as the jump path.
[0131] In some embodiments, see Figure 3G , Figure 3G This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. Figure 3G Step 1044 shown can be achieved by performing steps 10441 to 10442.
[0132] In step 10441, along a second direction perpendicular to the orientation, control the virtual geometric body to move multiple times from the sampling point according to the jump step length, and determine the position where the virtual geometric body reaches after the last movement as the end point of the jump path.
[0133] In some embodiments, the jump step length refers to the distance that the virtual geometric body moves each time. The jump step length can be set according to the size of the virtual geometric body. The jump step length can be equal to the climbing step length.
[0134] As an example, refer to Figure 4L , along a second direction 77 perpendicular to the orientation Dir, control the virtual geometric body 75 to move multiple times from the sampling point P according to the jump step length, and determine the position P2 where the virtual geometric body 75 reaches after the last movement as the end point of the jump path.
[0135] In some embodiments, refer to Figure 3H , Figure 3H is a schematic flowchart of a path construction method for a virtual scene provided by an embodiment of the present application. Figure 3H The shown step 10441 can be implemented by executing the following steps 104411 to step 104415.
[0136] In step 104411, at the sampling point, control the virtual geometric body to perform the (j - 1)-th movement along the second direction according to the jump step length.
[0137] As an example, refer to Figure 4L , at the sampling point P, control the virtual geometric body 75 to perform the first movement along the second direction 77 according to the jump step length.
[0138] In step 104412, at the position where it is after the (j - 1)-th movement, control the virtual geometric body to move in the opposite direction of the orientation.
[0139] As an example, refer to Figure 4L , at the position where it is after the first movement, control the virtual geometric body 75 to move in the opposite direction of the orientation Dir.
[0140] In step 104413, in response to encountering an obstacle during the movement in the opposite direction of the orientation, at the position where it is after the (j - 1)-th movement, control the virtual geometric body to perform the j-th movement along the second direction according to the jump step length.
[0141] Where 1 < j ≤ M, M represents the maximum number of movements when the virtual geometric body encounters an obstacle during the movement in the opposite direction of the orientation. For example, at the position where it is after the (M - 1)-th movement, the virtual geometric body encounters an obstacle during the movement in the opposite direction of the orientation.
[0142] As an example, see Figure 4L In response to encountering an obstacle 76 while moving in the opposite direction toward Dir, at the position after the first movement, the virtual geometry is controlled to move a second time along the second direction 77 by the jump step length. In response to encountering an obstacle 76 while moving in the opposite direction toward Dir, at the position after the second movement, the virtual geometry is controlled to move a third time along the second direction 77 by the jump step length.
[0143] In step 104414, at the position after the (M+1)th jump, control the virtual geometry to move in the opposite direction of the orientation.
[0144] As an example, see Figure 4L At the location after the 4th jump, control the virtual geometry 75 to move in the opposite direction to Dir.
[0145] In step 104415, in response to not encountering any obstacles during the movement in the opposite direction of orientation, the position after the (M+1)th jump is determined as the end point of the jump path.
[0146] As an example, see Figure 4L In response to not encountering any obstacles 76 during the movement in the opposite direction toward Dir, the location after the 4th jump is determined as the end point P2 of the jump path.
[0147] In step 10442, the connection structure of the virtual geometry jumping from the sampling point to the endpoint is used as the jump path.
[0148] As an example, see Figure 4L The path from sampling point P to endpoint P2 of the virtual geometry is taken as the jump path.
[0149] In this way, by simulating the movement of virtual objects through virtual geometry, the location of the endpoint of the jump path can be accurately determined. By using the connection structure of the virtual geometry jumping from the sampling point to the endpoint as the jump path, the jump path can be automatically determined. The determination process does not depend on the developer's operation, thus significantly improving the efficiency of constructing jump paths for virtual scenes.
[0150] In some embodiments, see Figure 3I , Figure 3I This is a flowchart illustrating the path construction method for a virtual scene provided in this application embodiment. After step 104 above, the path can be verified by executing steps 105 to 107.
[0151] In step 105, the virtual geometry is controlled to move sequentially on the first connection structure, the second connection structure, and the third connection structure.
[0152] The first connection structure is a path from the starting point of the path to the first intermediate position, the second connection structure is a path from the ending point of the path to the second intermediate position, and the third connection structure is a path from the first intermediate position to the second intermediate position. The first intermediate position and the second intermediate position have the same height.
[0153] As an example, see Figure 4M , Figure 4M This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. The virtual geometry is controlled to move between the first connecting structure AC, the second connecting structure BD, and the third connecting structure CD. The first connecting structure AC is the connection structure from the starting point A of the path to the first intermediate position C; the second connecting structure BD is the connection structure from the ending point B of the path to the second intermediate position D; and the third connecting structure CD is the connection structure from the first intermediate position C to the second intermediate position D. The first intermediate position C and the second intermediate position D have the same height.
[0154] In some embodiments, prior to step 105 above, the heights of the first intermediate position and the second intermediate position can be determined as follows: the height of the starting point of the path and the height of the ending point of the path are compared to obtain a comparison result; in response to the comparison result indicating that the height of the starting point of the path is greater than the height of the ending point of the path, the height of the starting point of the path and the verification height are summed, and the first summation result is determined as the heights of the first intermediate position and the second intermediate position; in response to the comparison result indicating that the height of the starting point of the path is less than the height of the ending point of the path, the height of the ending point of the path and the verification height are summed, and the second summation result is determined as the heights of the first intermediate position and the second intermediate position.
[0155] As an example, see Figure 4M The heights of the starting point A and the ending point B of the path are compared to obtain a comparison result. In response to the comparison result indicating that the height of the starting point A is greater than the height of the ending point B, the height of the starting point A and the verification height are summed, and the first summation result is determined as the height of the first intermediate position C and the second intermediate position D. In response to the comparison result indicating that the height of the starting point A is less than the height of the ending point B, the height of the ending point B and the verification height are summed, and the second summation result is determined as the height of the first intermediate position C and the second intermediate position D.
[0156] In some embodiments, the expression for the height of the first intermediate position C can be:
[0157] H=Max(A.Height,B.Height)+Heightconstant (1)
[0158] Where H represents the height of the first midpoint C or the height of the second midpoint D, A.Height represents the height of the starting point A of the path, B.Height represents the height of the ending point B of the path, Max(A.Height, B.Height) represents the maximum value of the height of the starting point A and the ending point B, and Heightconstant represents the verification height.
[0159] In some embodiments, the verification height can be set based on the height of the path's starting point A and the height of the path's ending point B.
[0160] In step 106, in response to the fact that the virtual geometry did not encounter any obstacles during its movement on the first, second, and third connection structures, the path verification is determined to be successful, and the path is marked as being able to be used to control the virtual object to perform movement of a certain type.
[0161] As an example, see Figure 4M In response to the fact that the virtual geometry does not encounter any obstacles during its movement on the first connection structure AC, the second connection structure BD, and the third connection structure CD, the verification of path AB is confirmed to be successful, and path AB is marked as being able to be used to control the virtual object to perform movement-type movements.
[0162] In step 107, in response to encountering obstacles during movement on the first, second, and third connection structures of the virtual geometry, it is determined that the path verification has failed and the path is deleted.
[0163] As an example, see Figure 4M In response to the virtual geometry encountering an obstacle while moving on the first connecting structure AC, the second connecting structure BD, and the third connecting structure CD, it is determined that the verification of path AB has failed, and the path is deleted.
[0164] In this way, by controlling the virtual geometry to move in a three-segment path, that is, moving sequentially on the first connection structure, the second connection structure, and the third connection structure, the path is effectively verified. If the path verification is successful, the path is marked as usable for controlling the virtual object to move. If the path verification fails, the path is deleted, thus effectively preventing the use of paths that have failed verification to control the virtual object to move, which would cause the virtual object to be unable to move on the path.
[0165] Thus, by determining multiple evenly distributed sampling points on the outer edges of the first navigation panel, and based on these sampling points and the outer edges, a path corresponding to the movement type is determined. This path then controls the virtual object to move between the first and second navigation panels according to the corresponding movement type. Because the path generation process based on sampling points and outer edges does not require developer intervention, and multiple sampling points can be batch-generated to create paths corresponding to each sampling point, the efficiency of constructing paths for the virtual scene is effectively improved.
[0166] The following will describe an exemplary application of the embodiments of this application in a real-world online game scenario.
[0167] In the application scenario of automatic pathfinding for game robots, the game engine calculates the target navigation patch (the second navigation patch described above) that the game robot needs to move to and the corresponding movement type. By generating a path corresponding to the movement type between the current navigation patch (the first navigation patch described above) and the target navigation patch (the second navigation patch) that are not adjacent on the terrain of the virtual scene, the game robot can move between the current navigation patch and the target navigation patch according to the path.
[0168] In a real-world online game application scenario, in response to the player's specified target location and corresponding movement type, the virtual object is controlled to reach the corresponding target location using the specified movement type, based on the path of the corresponding movement type.
[0169] In a real-world online game application scenario, see Figure 4C , Figure 4C This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. In response to a click operation on the selection control 41, a path construction interface is displayed; in response to a selection operation on the path construction control in the path construction interface, a progress bar 43 is displayed; in response to the completion of the progress bar 43, a path for the virtual scene is generated.
[0170] As an example, see Figure 4D , Figure 4D This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. For example... Figure 4D The images shown are paths 44, 45, 46, 47, 48, and 49 of a virtual scene generated by the virtual scene path construction method provided in this application embodiment.
[0171] The virtual scene path construction method provided in this application embodiment can generate multiple paths densely over a short distance, allowing virtual objects to move on different paths when seeking a way in the virtual scene, thus avoiding collisions caused by multiple virtual objects moving on the same path.
[0172] See Figure 4E , Figure 4E This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. Using the virtual scene path construction method provided in this application embodiment, paths 50, 51, 52, 53, and 54 can be densely generated over a short distance. Paths 50, 51, 52, 53, and 54 are all used to control virtual objects to climb.
[0173] See Figure 4F , Figure 4F This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. Using the virtual scene path construction method provided in this application embodiment, paths 55, 56, and 57 can be densely generated over a short distance, wherein paths 55, 56, and 57 are all used to control virtual objects to jump.
[0174] In some embodiments, see Figure 4G , Figure 4G This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. The virtual scene path construction method provided in this application embodiment can... Figure 4G Steps 201 to 206 shown are implemented, and will be explained below.
[0175] In step 201, the edges from which paths can be generated are determined.
[0176] In some embodiments, step 201 above can be implemented in the following way: performing the following processing on any edge of the current navigation patch: determining the navigation information status on both sides of the edge, wherein the navigation information status indicates whether there is navigation information on both sides of the edge; in response to the navigation information status indicating that only one side of the edge has navigation information, determining the edge as an edge that can generate a path (i.e., the external edge described above); determining the direction that is perpendicular to the edge that can generate a path and points to the side with navigation information as the orientation of the edge that can generate a path.
[0177] As an example, see Figure 4H , Figure 4H This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. For example... Figure 4HIn the triangular navigation patch shown, both sides of edges A and B have navigation information, while one side of edge C has navigation information, but the other side does not. This means that a special object blocks the terrain to the right of edge C. Therefore, edge C can be identified as an edge from which a path can be generated.
[0178] As an example, see Figure 4I , Figure 4I This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. Determining the edges in navigation patch ABCD that can generate paths can be achieved as follows: Traverse edges AB, BC, CD, and AD. Since edges AB, BC, and CD have other navigation patches on one side, both sides of edges AB, BC, and CD have navigation information. However, edge AD has no other navigation patches on one side, meaning it has no navigation information. Therefore, edge AD is determined as the edge in navigation patch ABCD that can generate paths.
[0179] In step 202, the edges are processed iteratively.
[0180] As an example, see Figure 4J , Figure 4J This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. Iterative edge processing can be achieved as follows: determine the midpoint P of edge AB and the orientation Dir of edge AB; continue iteratively determining the midpoint of edge AP and the midpoint of edge PB until the edge length is less than the size of the virtual object, at which point the iteration stops.
[0181] In step 203, the midpoint of the iteration is fed into the climbing generator.
[0182] As an example, see Figure 4K , Figure 4K This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. After any iteration midpoint is fed into the climbing generator, the climbing generator generates a path in the following manner: At the sampling point P, the capsule is controlled to move for the first time along a first direction according to the climbing step length; at the position after the first movement, the capsule is controlled to move towards Dir, and in response to encountering an obstacle during the movement towards Dir, at the position after the first movement, the capsule is controlled to move for the second time along the first direction according to the climbing step length; at the position after the third movement, the capsule is controlled to move towards Dir, and in response to not encountering an obstacle during the movement towards Dir, the capsule is controlled to move along a second direction perpendicular to the orientation, and the position reached by the virtual geometry moving along the second direction is determined as the landing point of the climbing path. The movement trajectory of the capsule from the sampling point to the landing point is determined as the climbing path.
[0183] In step 204, the midpoint of the iteration is fed into the jump generator.
[0184] As an example, see Figure 4L , Figure 4L This is a schematic diagram illustrating the principle of the path construction method for a virtual scene provided in this application embodiment. After any iteration midpoint is fed into the jump generator, the jump generator generates a path in the following manner: At the sampling point P, the capsule is controlled to move for the first time along the second direction according to the jump step size; at the position after the first movement, the capsule is controlled to move in the opposite direction of the orientation, and in response to encountering an obstacle during the movement in the opposite direction of the orientation, at the position after the first movement, the capsule is controlled to move for the second time along the second direction according to the jump step size; at the position after the Mth jump, the capsule is controlled to move in the opposite direction of the orientation, and in response to not encountering an obstacle during the movement in the opposite direction of the orientation, the position after the Mth jump is determined as the landing point P2 of the jump path. The trajectory of the capsule from the sampling point to the landing point P2 is determined as the jump path.
[0185] In step 205, the generation results of the climbing generator and the jumping generator are uniformly filtered.
[0186] As an example, see Figure 4M , Figure 4M This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. Taking the climbing path AB as an example, the capsule is controlled to move from point A to point C, from point B to point D, and from point C to point D. When the capsule moves between points A, B, C, and D without encountering any obstacles, the climbing path AB passes the filter.
[0187] As an example, see Figure 4M Points C and D have the same height, and the heights of points C and D can be:
[0188] H=Max(A.Height,B.Height)+Heightconstant (2)
[0189] Where H represents the height of points C and D, A.Height represents the height of point A, B.Height represents the height of point B, Max(A.Height, B.Height) represents the maximum value of the heights of points A and B, and Heightconstant represents a fixed height.
[0190] In this way, through unified filtering, the capsule can move smoothly between the start and end points of the climbing path AB without collision, effectively avoiding movement failure.
[0191] In step 206, the path is generated.
[0192] As an example, see Figure 4N , Figure 4N This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. A climbing path 58 is generated.
[0193] As an example, see Figure 4O , Figure 4O This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. A jump path 59 is generated.
[0194] As an example, see Figure 4P , Figure 4P This is a schematic diagram illustrating the principle of the virtual scene path construction method provided in this application embodiment. It generates a large number of climbing paths 61, 64, and 65, and jumping paths 60, 62, and 63.
[0195] See Table 1 below, which is a schematic table illustrating the number of paths generated and the time consumed in the embodiments of this application.
[0196] Table 1
[0197] Number of paths Generation time (seconds) 338708 668.8
[0198] Thus, when the virtual scene path generation method provided in this application is applied to scenarios requiring the generation of a large number of paths, it can effectively save time in path generation and achieve effects such as virtual objects climbing upwards and scaling walls in the virtual scene. When applied to online game scenarios, it can automatically and batch-determine the starting points of paths to be generated in the virtual scene, automatically and batch-calculate the endpoints of the paths, and automatically and batch-verify the generated paths. This allows for the rapid generation of a large number of paths in the virtual scene, effectively improving the efficiency of online game development. It is applicable to large-scale virtual scenes and situations with frequent updates to virtual scenes, thereby enhancing the industrialization capabilities of games.
[0199] It is understood that, in the embodiments of this application, data related to virtual scenes and other data, when applied to specific products or technologies, requires user permission or consent, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0200] The following description continues to illustrate the exemplary structure of the virtual scene path construction device 255 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 construction device 255 stored in the memory 240 may include: an acquisition module 2551, used to acquire a first navigation patch and a second navigation patch of the virtual scene, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene; a first determination module 2552, used to determine the outer edge of the first navigation patch and the orientation of the outer edge based on the relative positional relationship between the first navigation patch and the second navigation patch, wherein the outer edge is the edge of the first navigation patch with navigation information on one side, and the orientation is the direction pointing to the side of the outer edge that does not have navigation information; a sampling module 2553, used to perform sampling processing from each outer edge to obtain multiple sampling points evenly distributed in the outer edge; and a second determination module 2554, used to determine a path corresponding to the movement type based on the sampling points and the orientation of the outer edge; wherein the path is used to control the virtual object to move between the first navigation patch and the second navigation patch according to the corresponding movement type.
[0201] In some embodiments, the first determining module 2552 is further configured to perform the following processing on any edge of the first navigation patch: determine the navigation information status on both sides of the edge, wherein the navigation information status indicates whether there is navigation information on both sides of the edge; in response to the navigation information status indicating that only one side of the edge has navigation information, determine the edge as an external edge; and determine the direction that is perpendicular to the external edge and points to the side with navigation information as the orientation of the external edge.
[0202] In some embodiments, the sampling module 2553 is further configured to perform the following processing on any external edge: determine the midpoint of the external edge as a sampling point; and perform k iterations of segmentation processing using the midpoint of the external edge as the midpoint of the first iteration segmentation to obtain the second sampling point of the external edge. k Segment by segment until the length of the segment is greater than the size of the virtual object, where k is a positive integer; the midpoint of each segment is determined as the sampling point.
[0203] In some embodiments, the movement type includes climbing movement, and the path includes a climbing path; the second determining module 2554 is further configured to control the virtual geometry to move toward the sampling point, wherein the virtual geometry is a data structure used to describe the collision volume of a virtual object; in response to the virtual geometry encountering an obstacle during its movement along the orientation, based on the sampling point and the orientation, the virtual geometry is controlled to simulate the virtual object climbing, and the connection structure formed during the climbing process of the virtual geometry is used as the climbing path.
[0204] In some embodiments, the above-mentioned second determination module 2554 is further configured to control the virtual geometric body to move multiple times from the sampling point according to the climbing step length along a first direction perpendicular to the orientation, and determine the position where the virtual geometric body reaches after the last movement as the end point of the climbing path; and use the connection structure of the virtual geometric body climbing from the sampling point to the end point as the climbing path.
[0205] In some embodiments, the above-mentioned second determination module 2554 is further configured to, at the sampling point, control the virtual geometric body to perform the (i - 1)th movement along the first direction according to the climbing step length; at the position where it is located after the (i - 1)th movement, control the virtual geometric body to move along the orientation, and in response to encountering an obstacle during the movement along the orientation, at the position where it is located after the (i - 1)th movement, control the virtual geometric body to perform the ith movement along the first direction according to the climbing step length; where 1 < i ≤ N, and N is the maximum number of movements when the virtual geometric body encounters an obstacle during the movement along the orientation; at the position where it is located after the (N + 1)th movement, control the virtual geometric body to move along the orientation, and in response to not encountering an obstacle during the movement along the orientation, control the virtual geometric body to move along a second direction perpendicular to the orientation, and determine the position where the virtual geometric body reaches after moving along the second direction as the end point of the climbing path.
[0206] In some embodiments, the movement type includes jump movement, and the path includes a jump path; the above-mentioned second determination module 2554 is further configured to control the virtual geometric body to move towards the orientation at the sampling point, where the virtual geometric body is a data structure for describing the collision volume of the virtual object; in response to not encountering an obstacle during the movement of the virtual geometric body along the orientation, based on the sampling point and the orientation, control the virtual geometric body to simulate the virtual object to jump, and use the connection structure formed during the jumping process of the virtual geometric body as the jump path.
[0207] In some embodiments, the above-mentioned second determination module 2554 is further configured to control the virtual geometric body to move multiple times from the sampling point according to the jump step length along a second direction perpendicular to the orientation, and determine the position where the virtual geometric body reaches after the last movement as the end point of the jump path; and use the connection structure of the virtual geometric body jumping from the sampling point to the end point as the jump path.
[0208] In some embodiments, the above-mentioned second determination module 2554 is further configured to, at a sampling point, control the virtual geometric body to move in the second direction for the (j - 1)-th time according to a jump step length; at the position where it is located after the (j - 1)-th move, control the virtual geometric body to move in the opposite direction of the orientation, and in response to encountering an obstacle during the movement in the opposite direction of the orientation, at the position where it is located after the (j - 1)-th move, control the virtual geometric body to move in the second direction for the j-th time according to the jump step length; where 1 < j ≤ M, and M represents the maximum number of moves when the virtual geometric body encounters an obstacle during the movement in the opposite direction of the orientation; at the position where it is located after the (M + 1)-th jump, control the virtual geometric body to move in the opposite direction of the orientation, and in response to not encountering an obstacle during the movement in the opposite direction of the orientation, determine the position where it is located after the (M + 1)-th jump as the end point of the jump path.
[0209] In some embodiments, the above-mentioned path construction device 255 of the virtual scene further includes: a verification module, configured to perform verification processing on the path in the following manner: controlling the virtual geometric body to move on the first connection structure, the second connection structure, and the third connection structure in sequence; where the first connection structure is the connection structure from the start point of the path to the first intermediate position, the second connection structure is the connection structure from the end point of the path to the second intermediate position, the third connection structure is the connection structure from the first intermediate position to the second intermediate position, and the first intermediate position and the second intermediate position have the same height; in response to the virtual geometric body not encountering an obstacle during the movement on the first connection structure, the second connection structure, and the third connection structure, determine that the verification of the path passes, and mark that the path can be used to control the virtual object to perform a movement of a movement type; in response to the virtual geometric body encountering an obstacle during the movement on the first connection structure, the second connection structure, and the third connection structure, determine that the verification of the path fails, and delete the path.
[0210] In some embodiments, the above-mentioned verification module is further configured to perform a comparison process on the height of the start point of the path and the height of the end point of the path to obtain a comparison result; in response to the comparison result indicating that the height of the start point of the path is greater than the height of the end point of the path, perform a summation process on the height of the start point of the path and the verification height, and determine the obtained first summation result as the height of the first intermediate position and the second intermediate position; in response to the comparison result indicating that the height of the start point of the path is less than the height of the end point of the path, perform a summation process on the height of the end point of the path and the verification height, and determine the obtained second summation result as the height of the first intermediate position and the second intermediate position.
[0211] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the virtual scene path construction method described above in this application.
[0212] 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 a path construction method for a virtual scene provided in this application. For example... Figure 3A The method for constructing paths in the virtual scene is shown.
[0213] 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.
[0214] 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.
[0215] 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).
[0216] As an example, executable instructions can be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0217] In summary, the embodiments of this application have the following beneficial effects:
[0218] (1) By determining multiple evenly distributed sampling points from the outer edges of the first navigation panel, and based on the sampling points and the outer edges, a path corresponding to the movement type is determined. The virtual object is then controlled to move between the first and second navigation panels according to the corresponding movement type. In this way, since the path generation process based on sampling points and outer edges does not require the developer to place the samples accordingly, and multiple sampling points can be directly batch-generated to generate paths corresponding to each sampling point, the efficiency of constructing paths for the virtual scene is effectively improved.
[0219] (2) By determining the navigation information of the edge, the outer edge and the orientation of the outer edge are determined, which makes it easier to determine the movement path of the virtual object between the first navigation panel and the second navigation panel according to the orientation of the outer edge.
[0220] (3) By sampling any external edge, multiple sampling points of the external edge are obtained, which facilitates the construction of the corresponding path at the sampling point. Since the length of the sub-segment is greater than the size of the virtual object, the density between sampling points is reasonable, and the virtual object is on one sampling point, rather than one virtual object on two sampling points.
[0221] (4) By simulating the movement of virtual objects through virtual geometry, the location of the endpoint of the jump path can be accurately determined. The jump path is automatically determined by taking the path of the virtual geometry from the sampling point to the endpoint. The determination process does not depend on the operation of the developer, which significantly improves the efficiency of constructing the jump path of the virtual scene and reduces the time cost of constructing the jump path.
[0222] (5) By simulating the movement of virtual objects through virtual geometry, the location of the end point of the climbing path can be accurately determined. The climbing path is automatically determined by taking the path of the virtual geometry from the sampling point to the end point. The determination process does not depend on the operation of the developer, which significantly improves the efficiency of constructing climbing paths in virtual scenes and reduces the time cost of constructing climbing paths.
[0223] (6) By controlling the virtual geometry to move in a three-segment path, that is, to move sequentially on the first connection structure, the second connection structure and the third connection structure, the path is effectively verified. If the path verification is successful, the path is marked as being able to control the virtual object to move in a movement-type manner; if the path verification fails, the path is deleted, thereby effectively preventing the use of paths that have failed verification to control the virtual object to move in a movement-type manner, which would cause the virtual object to be unable to move on the path.
[0224] 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 construction method in a virtual scene, characterized in that, The method includes: Obtain a first navigation patch and a second navigation patch of a virtual scene, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene; Based on the relative positional relationship between the first navigation patch and the second navigation patch, the outer edge of the first navigation patch and the orientation of the outer edge are determined, wherein the outer edge is the edge of the first navigation patch that has navigation information on one side, and the orientation is the direction pointing to the side of the outer edge that does not have the navigation information. Sampling is performed on each of the external edges to obtain multiple sampling points evenly distributed within the external edges. For any one of the sampling points, the following processing is performed: Based on the sampling points and the orientation of the external edges, determine the path corresponding to the movement type; The path is used to control the virtual object to move between the first navigation panel and the second navigation panel according to the movement type.
2. The method according to claim 1, characterized in that, Determining the outer edge of the first navigation patch and the orientation of the outer edge includes: Perform the following processing on any edge of the first navigation patch: Determine the navigation information on both sides of the edge, wherein the navigation information indicates whether the two sides of the edge have the navigation information; In response to the navigation information indicating that only one side of the edge has navigation information, the edge is defined as the outer edge; The direction perpendicular to the outer edge and pointing towards the side without the navigation information is determined as the orientation of the outer edge.
3. The method according to claim 1, characterized in that, The step of sampling from each of the outer edges to obtain multiple sampling points uniformly distributed in the outer edges includes: Perform the following processing on any of the aforementioned external edges: The midpoint of the outer edge is determined as the sampling point; Using the midpoint of the outer edge as the midpoint of the first iteration segmentation, perform k iterations of segmentation to obtain the second segment of the outer edge. k Line segments are formed until the length of the line segment is greater than the size of the virtual object, where k is a positive integer; The midpoint of each of the sub-segments is determined as the sampling point.
4. The method according to claim 1, characterized in that, The movement type includes climbing movement, and the path includes climbing paths; Determining the path corresponding to the movement type based on the sampling points and the orientation of the outer edges includes: The virtual geometry is controlled to move toward the direction at the sampling point, wherein the virtual geometry is a data structure used to describe the collision volume of the virtual object; In response to the virtual geometry encountering an obstacle while moving along the orientation, the virtual geometry is controlled to simulate the virtual object climbing based on the sampling point and the orientation, and the connection structure formed during the climbing process of the virtual geometry is used as the climbing path.
5. The method according to claim 4, characterized in that, The step of controlling the virtual geometry to simulate the climbing of the virtual object based on the sampling points and the orientation, and using the connection structure formed during the climbing process of the virtual geometry as the climbing path, includes: Along a first direction perpendicular to the orientation, the virtual geometry is controlled to move multiple times from the sampling point according to the climbing step length, and the position reached by the virtual geometry in the last movement is determined as the end point of the climbing path; The connection structure through which the virtual geometry climbs from the sampling point to the endpoint is used as the climbing path.
6. The method according to claim 5, characterized in that, The step of controlling the virtual geometry to move multiple times from the sampling point according to the climbing step length along a first direction perpendicular to the orientation, and determining the position reached by the virtual geometry in the last movement as the end point of the climbing path, includes: At the sampling point, the virtual geometry is controlled to move (i-1)th time along the first direction according to the climbing step length; At the position after the (i-1)th movement, control the virtual geometry to move along the orientation, and In response to encountering the obstacle during movement along the direction, at the position after the (i-1)th movement, the virtual geometry is controlled to move along the first direction for the ith time according to the climbing step length; Where 1 < i ≤ N, and N is the maximum number of times the virtual geometry encounters the obstacle during its movement along the orientation. At the position after the (N+1)th move, control the virtual geometry to move along the orientation, and In response to not encountering any obstacles during movement along the stated orientation, the virtual geometry is controlled to move along a second direction perpendicular to the stated orientation, and the position reached by the virtual geometry moving along the second direction is determined as the end point of the climbing path.
7. The method according to claim 1, characterized in that, The movement type includes jump movement, and the path includes jump path; Determining the path corresponding to the movement type based on the sampling points and the orientation of the outer edges includes: The virtual geometry is controlled to move toward the direction at the sampling point, wherein the virtual geometry is a data structure used to describe the collision volume of the virtual object; In response to the virtual geometry not encountering any obstacles during its movement along the orientation, the virtual geometry is controlled to simulate the virtual object jumping based on the sampling point and the orientation, and the connection structure formed during the virtual geometry's jump is used as the jump path.
8. The method according to claim 7, characterized in that, The step of controlling the virtual geometry to simulate the virtual object jumping based on the sampling points and the orientation, and using the connection structure formed during the jumping process of the virtual geometry as the jumping path, includes: Along a second direction perpendicular to the orientation, the virtual geometry is controlled to move multiple times from the sampling point according to the jump step size, and the position reached by the last movement of the virtual geometry is determined as the end point of the jump path; The connection structure that allows the virtual geometry to jump from the sampling point to the endpoint is used as the jump path.
9. The method according to claim 8, characterized in that, The step of controlling the virtual geometry to move multiple times from the sampling point along a second direction perpendicular to the orientation, according to the jump step size, and determining the position reached by the virtual geometry in the last movement as the end point of the jump path, includes: At the sampling point, the virtual geometry is controlled to move (j-1)th time along the second direction according to the jump step size; At the position after the (j-1)th move, control the virtual geometry to move in the opposite direction of the orientation, and In response to encountering the obstacle during movement in the opposite direction of the stated orientation, at the position after the (j-1)th movement, the virtual geometry is controlled to move j times along the second direction according to the jump step length; Where 1 < j ≤ M, M represents the maximum number of times the virtual geometry encounters the obstacle during its movement in the opposite direction of the orientation; At the location after the (M+1)th jump, control the virtual geometry to move in the opposite direction of the orientation, and In response to not encountering the obstacle during the movement in the opposite direction of the stated orientation, the position after the (M+1)th jump is determined as the end point of the jump path.
10. The method according to claim 1, characterized in that, After determining the path corresponding to the movement type based on the sampling points and the orientation of the outer edges, the method further includes: The path is verified using the following method: Control the virtual geometry to move sequentially on the first connection structure, the second connection structure, and the third connection structure; Wherein, the first connection structure is a connection structure from the starting point of the path to the first intermediate position, the second connection structure is a connection structure from the ending point of the path to the second intermediate position, and the third connection structure is a connection structure from the first intermediate position to the second intermediate position, wherein the first intermediate position and the second intermediate position are at the same height; In response to the fact that the virtual geometry does not encounter any obstacles during its movement on the first connection structure, the second connection structure, and the third connection structure, the path is determined to be verified and the path is marked as being usable to control the virtual object to perform the movement type. In response to the virtual geometry encountering the obstacle during its movement on the first connection structure, the second connection structure, and the third connection structure, it is determined that the path verification has failed, and the path is deleted.
11. The method according to claim 10, characterized in that, Before the controlled virtual geometry moves sequentially on the first connection structure, the second connection structure, and the third connection structure, the method further includes: The height of the starting point of the path and the height of the ending point of the path are compared to obtain the comparison result. In response to the comparison processing result indicating that the height of the starting point of the path is greater than the height of the ending point of the path, the height of the starting point of the path and the verification height are summed, and the first summation result is determined as the height of the first intermediate position and the second intermediate position. In response to the comparison processing result indicating that the height of the starting point of the path is less than the height of the ending point of the path, the height of the ending point of the path and the verification height are summed, and the resulting second summation result is determined as the height of the first intermediate position and the second intermediate position.
12. A path construction device in a virtual scene, characterized in that, The device includes: The acquisition module is used to acquire a first navigation patch and a second navigation patch of a virtual scene, wherein the first navigation patch and the second navigation patch are not adjacent to each other on the terrain of the virtual scene; The first determining module is used to determine the outer edge of the first navigation patch and the orientation of the outer edge based on the relative positional relationship between the first navigation patch and the second navigation patch, wherein the outer edge is the edge of the first navigation patch that has navigation information on one side, and the orientation is the direction pointing to the side of the outer edge that does not have the navigation information. A sampling module is used to perform sampling processing from each of the external edges to obtain multiple sampling points evenly distributed in the external edges; The second determining module is used to determine a path corresponding to the movement type based on the sampling point and the orientation of the external edge; wherein the path is used to control the virtual object to move between the first navigation panel and the second navigation panel corresponding to the movement type.
13. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; A processor, when executing executable instructions or computer programs stored in the memory, implements the path construction method in the virtual scene according to any one of claims 1 to 11.
14. A computer-readable storage medium storing executable instructions or a computer program, characterized in that, When the executable instructions are executed by the processor, they implement the path construction method in the virtual scene according to any one of claims 1 to 11.
15. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the path construction method in the virtual scene as described in any one of claims 1 to 11.