Game scene generation method, device, storage medium and electronic device
By determining the road-seeking baseline and target geometric area of the sub-virtual objects in the game scene generation, the problem that virtual game characters cannot find the way effectively is solved, and the normal operation of the way-seeking system and the diversity of game scenes are achieved.
Patent Information
- Application Number
- CN202210675156.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-06-15
AI Technical Summary
When generating game scenes, the existing technology cannot guarantee that virtual game characters can find their way, resulting in the pathfinding system not working normally in the spliced scene.
By obtaining the road finding map of multiple sub-virtual objects, multiple reference lines for each sub-virtual object are determined, and target geometric areas are determined in the road finding map based on these reference lines, and multiple sub-virtual objects are spliced according to the target geometric areas to generate a game scene.
Ensure that the pathfinding system in the generated game scene works normally, realizes effective pathfinding pathfinding, and improves the diversity and randomness of the game scene.
Smart Images

Figure CN115120980B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of games, and in particular to a method, device, storage medium and electronic device for generating a game scene. Background Art
[0002] At present, game scenes are an important part of the game, among which the quantity and quality of game scenes will directly affect the player's gaming experience.
[0003] When generating a game scene, the entire scene is pre-divided into squares. Then, a new game scene is generated by loading the squares into a specific location to ensure randomness in the game scene generation. However, this method only splices the scene resources of the game scene, not the terrain resources of the game scene. This results in the virtual game character being unable to properly find its way through the generated game scene, resulting in a technical problem of not being able to guarantee effective pathfinding when generating the game scene.
[0004] Regarding the technical problem of being unable to ensure effective pathfinding when generating the aforementioned game scenes, no effective solution has yet been proposed. Summary of the Invention
[0005] At least some embodiments of the present invention provide a method, device, storage medium, and electronic device for generating a game scene, so as to at least solve the technical problem of being unable to ensure effective pathfinding when generating a game scene.
[0006] According to one embodiment of the present invention, a method for generating a game scene is provided. The method may include: obtaining a pathfinding graph for each of a plurality of sub-virtual objects, wherein the pathfinding graph is used to guide a virtual game character to pathfind on the terrain of the corresponding sub-virtual object; determining a plurality of baselines in the pathfinding graph for each sub-virtual object, wherein the baselines are used to enable the virtual game character to pathfind from the terrain of each sub-virtual object to the terrain of a sub-virtual object other than each sub-virtual object; determining at least one target geometric area in the pathfinding graph based on the plurality of baselines; and splicing the plurality of sub-virtual objects according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, wherein the virtual game character pathfinds on the terrain of the game scene.
[0007] Optionally, determining multiple baselines of the path-finding graph of each sub-virtual object includes: determining the multiple baselines based on a local coordinate system where the path-finding graph is located.
[0008] Optionally, based on the local coordinate system where the path-finding graph is located, multiple baselines are determined, including: taking the origin of the coordinate system as a reference, determining a baseline perpendicular to the first coordinate axis for each target size interval along the first coordinate axis of the coordinate system, and determining a baseline perpendicular to the second coordinate axis for each target size interval along the second coordinate axis of the coordinate system, to obtain multiple baselines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
[0009] Optionally, the target size is negatively correlated with the stitching accuracy of the multiple virtual sub-objects.
[0010] Optionally, the origin of the local coordinate system where the terrain of each sub-virtual object is located is determined as the origin of the coordinate system where the pathfinding graph is located.
[0011] Optionally, determining at least one target geometric area in the path-finding map based on multiple baselines includes: dividing the path-finding map into multiple square areas based on multiple baselines; and determining at least one target square area in the multiple square areas, wherein the at least one target geometric area includes at least one target square area.
[0012] Optionally, determining at least one target square area among the multiple square areas includes: determining at least one square area located at an edge position of each corresponding sub-virtual object among the multiple square areas as the at least one target square area.
[0013] Optionally, multiple sub-virtual objects are spliced according to at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, including: based on the association relationship between the first sub-virtual object and the second sub-virtual object, at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object is overlapped with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain the game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among the multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
[0014] Optionally, at least one target geometric area corresponding to the first sub-virtual object's pathfinding map is overlapped with at least one target geometric area corresponding to the second sub-virtual object's pathfinding map to obtain a game scene, including: determining at least one first sub-pathfinding map on the corresponding at least one target geometric area in the pathfinding map of the first sub-virtual object; determining at least one second sub-pathfinding map on the corresponding at least one target geometric area in the pathfinding map of the second sub-virtual object; overlapping the at least one first sub-pathfinding map and the at least one second sub-pathfinding map to obtain a target pathfinding map, wherein the pathfinding map is within an area defined by multiple baselines; and generating a game scene based on the target pathfinding map.
[0015] Optionally, based on a first current position in the world space of at least one target geometric area corresponding to the first sub-virtual object's pathfinding graph and a second current position in the world space of at least one target geometric area corresponding to the second sub-virtual object's pathfinding graph, orientation adjustment information of the second sub-virtual object in the world space is determined, wherein the first current orientation and the second current orientation are randomly determined orientations, and the orientation adjustment information is used to represent information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the direction of the second sub-virtual object in the world space; based on the orientation adjustment information, the current position of the second sub-virtual object in the world space is adjusted so that the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object coincides with the at least one target geometric area corresponding to the pathfinding graph of the adjusted second sub-virtual object.
[0016] Optionally, the method further includes: reading the first sub-virtual object and the second sub-virtual object, and the association relationship in a configuration relationship table, wherein the configuration relationship table includes identifiers of multiple sub-virtual objects, and includes an association relationship between every two sub-virtual objects in the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrain of every two sub-virtual objects.
[0017] Optionally, respectively obtaining a pathfinding map for a plurality of sub-virtual objects includes: generating a pathfinding resource for each sub-virtual object based on a terrain resource of each sub-virtual object; and generating a pathfinding map for each sub-virtual object based on the pathfinding resource of each sub-virtual object, wherein the pathfinding map is composed of polygonal patches of each sub-virtual object.
[0018] According to one embodiment of the present invention, a device for generating a game scene is also provided. The device may include: an acquisition unit, configured to respectively acquire a pathfinding map of multiple sub-virtual objects, wherein the pathfinding map is used to guide a virtual game character to find a path on the terrain of the corresponding sub-virtual object; a first determination unit, configured to determine multiple baselines in the pathfinding map of each sub-virtual object, wherein the baselines are used to enable the virtual game character to find a path from the terrain of each sub-virtual object to the terrain of a sub-virtual object other than each sub-virtual object; a second determination unit, configured to determine at least one target geometric area in the pathfinding map based on the multiple baselines; and a splicing unit, configured to splice the multiple sub-virtual objects according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, wherein the virtual game character finds a path on the terrain of the game scene.
[0019] According to one embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method for generating a game scene according to an embodiment of the present invention when executed by a processor.
[0020] According to one embodiment of the present invention, an electronic device is provided. The electronic device may include a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method for generating a game scene according to an embodiment of the present invention.
[0021] In at least some embodiments of the present invention, a plurality of sub-virtual objects' pathfinding maps are obtained respectively; a plurality of baselines of the pathfinding map of each sub-virtual object are determined; at least one target geometric area is determined in the pathfinding map based on the plurality of baselines; and the plurality of sub-virtual objects are spliced together according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene. In other words, the embodiments of the present invention determine the target geometric area corresponding to each sub-virtual object in the pathfinding map based on the plurality of baselines of the pathfinding map of each sub-virtual object, and then splice the plurality of sub-virtual objects according to the target geometric area to obtain a game scene, and the spliced pathfinding map is still valid in the game scene, thereby achieving the purpose of ensuring the normal operation of the terrain pathfinding system and solving the technical problem of being unable to ensure effective pathfinding when generating a game scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0023] Figure 1 1 is a hardware structure block diagram of a mobile terminal according to a method for generating a game scene according to an embodiment of the present invention;
[0024] Figure 2 is a flowchart of a method for generating a game scene according to one embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of determining a target square area according to an embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of a game scene formed by splicing island components according to an embodiment of the present invention;
[0027] Figure 5 is a schematic diagram of an island tree according to an embodiment of the present invention;
[0028] Figure 6 is a schematic diagram of a coordinate system of a three-dimensional scene according to an embodiment of the present invention;
[0029] Figure 7 is a schematic diagram of an island component according to an embodiment of the present invention within a region expanded by the positive directions of the x-axis and the z-axis;
[0030] FIG8(a) is a diagram of a larger size of a 1 according to an embodiment of the present invention. tile Schematic diagram of the corresponding number of pathfinding graph segments;
[0031] FIG8( b ) is a diagram of a smaller size of an embodiment of the present invention. tile Schematic diagram of the corresponding number of pathfinding graph segments;
[0032] Figure 9 is a schematic diagram of a Tile area in a pathfinding resource according to an embodiment of the present invention;
[0033] Figure 10 is a schematic diagram of a slot according to an embodiment of the present invention;
[0034] Figure 11 is a schematic diagram of a square grid according to an embodiment of the present invention;
[0035] Figure 12 A device for generating a game scene according to one embodiment of the present invention;
[0036] Figure 13 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] First, some nouns or terms that appear in the description of the embodiments of the present invention are subject to the following explanations:
[0040] An island is a game scene composed of multiple island components spliced together according to certain rules. Island components can include a main island, secondary islands, and connectors. An island can be composed of a main island, multiple secondary islands, and multiple connectors.
[0041] Island components are the smallest-scale scene art resources. The main island component and sub-island components in the island component can be spliced with connectors, and connectors can be spliced with main island components or sub-island components.
[0042] The main island component, i.e., the main island, may be a necessary component to form a complete island, and in terms of quantity, a complete island may require one main island, which is relatively large in size and has a relatively complex terrain;
[0043] The connector may be an island component for connecting the main island and the auxiliary island, and each end of the connector has a slot;
[0044] The secondary island component, also known as the secondary island, is the end of the island and can only define one slot for splicing with the connector. Its size is relatively small;
[0045] A slot is a square area (Tile) covering an island component. Its purpose is to achieve splicing between island components. For example, there will be a slot at each end of the connector, and a slot on the flat area of the secondary island. If the slots between two island components overlap, they can be logically spliced together.
[0046] Transform is used in the gaming and 3D scene design industries to describe the position and rotation of 3D objects. It is essentially a 4x3 matrix that is applicable to matrix operations. Using Transform to represent position and rotation facilitates the calculation of relative and world positions.
[0047] The coordinate system may be a coordinate system (x, y, z) used to represent positional relationships in a three-dimensional game scene.
[0048] According to one embodiment of the present invention, an embodiment of a method for generating a game scene is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0049] The method embodiment can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smartphone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, a game console, or other terminal devices. Figure 1 FIG is a hardware structure block diagram of a mobile terminal according to a method for generating a game scene according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (the processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field-programmable logic device (FPGA), a neural network processor (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may further include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0050] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for generating a game scene in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the method for generating the game scene described above. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0051] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the mobile terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0052] Inputs to the input / output devices 108 can come from a variety of human interface devices (HIDs). Examples include keyboards and mice, game controllers, and other specialized game controllers (e.g., steering wheels, fishing rods, dance mats, remote controls, etc.). Some HIDs provide not only input but also output, such as force feedback and vibration on game controllers and audio output on controllers.
[0053] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display"). The LCD may enable a user to interact with the user interface of the mobile terminal. In some embodiments, the mobile terminal may have a graphical user interface (GUI), and the user may interact with the GUI by finger contacts and / or gestures on the touch-sensitive surface. The human-computer interaction functions herein may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.
[0054] In one embodiment of the present invention, the method for generating a game scene can be run on a local terminal device or a server. When the method for generating a game scene is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0055] In an optional embodiment, various cloud applications, such as cloud gaming, can be run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operation mode, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the game scene generation method are completed on the cloud gaming server. The role of the client device is to receive and send data and present the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, TV, computer, PDA, etc.; however, it is the cloud gaming server in the cloud that performs information processing. When playing the game, the player operates the client device to send operation instructions to the cloud gaming server. The cloud gaming server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0056] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading and installing the game program through an electronic device and running it. The local terminal device can provide the graphical user interface to the player in a variety of ways, for example, it can be rendered and displayed on the terminal's display screen, or provided to the player through holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present the graphical user interface, the graphical user interface includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0057] In one possible implementation, an embodiment of the present invention provides a method for generating a game scene, providing a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or it can be a client device in the cloud interaction system mentioned above. Figure 2 FIG. 1 is a flow chart of a method for generating a game scene according to one embodiment of the present invention. Figure 2 As shown, the method may include the following steps:
[0058] Step S202: Obtain pathfinding graphs of multiple virtual sub-objects respectively.
[0059] In the technical solution provided in the above step S202 of the present invention, the pathfinding maps of multiple sub-virtual objects can be obtained respectively according to the pathfinding resources of multiple sub-virtual objects, wherein the sub-virtual objects can be terrain components that need to be spliced, such as the main island, sub-island and connectors in the island component. The pathfinding map can be used to guide the virtual game character to find the path on the terrain of the corresponding sub-virtual object. Therefore, the pathfinding map is strongly related to the terrain of the sub-virtual object, and the virtual game character can be a virtual character in the game scene.
[0060] Optionally, the navigation graph can be a navigation grid (NavMesh). The navigation grid is a polygonal grid composed of polygons. The navigation grid is divided into squares, and each small square area obtained can be called a square (Tile) area, or a Tile grid. That is to say, the small square area can be a navigation tile. For example, the navigation graph is generated by the navigation resource of the island component. The navigation graph is a polygonal grid. It is divided into squares, and each square area obtained is a navigation tile (Tile area), which is essentially a square area on the island component.
[0061] Optionally, a complete sub-virtual object can contain both terrain resources and pathfinding resources. Terrain resources represent the scene's terrain style and can be referred to as scene terrain resources or terrain model resources. Pathfinding resources correspond to terrain resources and are generated by the editor based on the sub-virtual object's terrain resources. These resources abstract the game scene into a specific mathematical model, representing the scene structure, obstacle information, and feasible area information. It should be noted that while these terrain resources can be spliced arbitrarily, pathfinding resources must be spliced on a tile-by-tile basis.
[0062] Optionally, the pathfinding resources of sub-virtual objects can be spliced based on Tile. The Tile function in the game engine can be used to divide the pathfinding map of sub-virtual objects in the game scene into squares to obtain multiple Tile areas, and these Tile areas are saved. When the game scene is actually entered, the positions and orientations of multiple sub-virtual objects are randomly generated. Therefore, when loading a new pathfinding map, the previously stored Tile areas need to be spliced in pre-calculated positions to achieve the purpose of ensuring the diversity of the game scene while ensuring the normal operation of the pathfinding system.
[0063] Optionally, the pathfinding graph of each sub-virtual object may include multiple pathfinding files, and the number of the pathfinding files may be the same as the number of Tile areas divided by the sub-virtual object, and the two have a one-to-one correspondence. For example, the pathfinding NavMesh of each island component is generated according to the Tile area division, and the pathfinding graph produced by each island component is multiple pathfinding files, and the number of the pathfinding files is the same as the number of Tile areas divided by the island component, and the two have a one-to-one correspondence.
[0064] Optionally, the plurality of sub-virtual objects may be pre-made by an editor, wherein the editor may be a scene designer or a scene editor, which is not specifically limited here.
[0065] Step S204: determining multiple baselines of the pathfinding graph of each sub-virtual object.
[0066] In the technical solution provided in step S204 of the present invention, each sub-virtual object's pathfinding graph has multiple baselines, and the multiple baselines of the pathfinding graph of each sub-virtual object are determined separately, wherein the baseline can be a line determined at every grid size along two mutually perpendicular coordinate axes with the terrain origin of each sub-virtual object as the origin.
[0067] Optionally, the baseline can be used to represent pre-set constraints for splicing the pathfinding graph of each sub-virtual object, for example, only the pathfinding graph that needs to be spliced is spliced according to the Tile area determined by the baseline.
[0068] Step S206 , determining at least one target geometric area in the path-finding graph based on the plurality of reference lines.
[0069] In the technical solution provided in the above step S206 of the present invention, multiple target geometric areas can be determined based on the multiple baselines of the pathfinding map of each sub-virtual object, and at least one of the multiple target geometric areas can be spliced with the target geometric areas of the pathfinding maps of other sub-virtual objects, wherein the target geometric area can be a slot of the sub-virtual object, and the slot can be a square grid at the edge of the pathfinding map of the sub-virtual object, which is essentially the above-mentioned Tile area.
[0070] Optionally, since at least one of the multiple target geometric areas of a sub-virtual object can be spliced with the target geometric areas of the pathfinding graph of other sub-virtual objects, that is, the sub-virtual objects can be reused, the purpose of reducing the total amount of art resources and reducing the workload of artists can be achieved.
[0071] Step S208 : According to at least one target geometric area corresponding to each sub-virtual object, multiple sub-virtual objects are spliced together to obtain a game scene.
[0072] In the technical solution provided in the above step S208 of the present invention, each sub-virtual object has corresponding multiple target geometric areas. The geometric areas corresponding to multiple sub-virtual objects that can be matched are spliced to obtain a game scene, and the virtual game character can find its way on the terrain of the game scene.
[0073] Optionally, when splicing multiple sub-virtual objects, if the target geometric areas of the sub-virtual objects can directly overlap, the splicing of the pathfinding maps of the multiple sub-virtual objects can be achieved; if the target geometric areas of the sub-virtual objects cannot directly overlap, the sub-virtual objects can be rotated and translated until the target geometric areas of the multiple sub-virtual objects overlap, so as to achieve the splicing of the pathfinding maps of the multiple sub-virtual objects. Since the splicing between the pathfinding maps is based on a square grid, when the sub-virtual object is rotated, the rotation angle can be an integer multiple of 90°, and when the sub-virtual object is translated, the translation amount can be an integer multiple of the side length of the square area.
[0074] Optionally, the game scene of this embodiment is obtained by splicing together multiple sub-virtual objects, so that each time the game application is entered, the generated game scene may be different depending on the splicing method. For example, in the island scene, due to the differences in the splicing methods of the main island, sub-island and connecting parts in the island components, the position, distribution and shape of the generated island will also be different, and the resulting game scene may also be different, thereby achieving the purpose of creating randomness in the game scene.
[0075] It should be noted that the above-mentioned sub-virtual objects in this embodiment can be island components, dungeon components, maze components, etc., and no specific restrictions are made here.
[0076] In this embodiment, the generation of the game scene can be analyzed from the whole to the part, or from the part to the whole, and the game scene can be generated by splicing sub-virtual objects. In the analysis scheme from the whole to the part, in response to the input operation instructions acting on the graphical user interface, each sub-virtual object in the game scene to be generated can be analyzed, and the entire game scene can be logically split into multiple sub-virtual objects. For example, the game scene to be generated can be an island community scene. Each island in the island community scene is analyzed, and each island is logically split into a main island, several connecting parts and several sub-islands. The final island components are determined based on the island components obtained from the analysis; in the analysis scheme from the local to the overall, the input operation instructions acting on the graphical user interface can be responded to, and the type, quantity and style of each sub-virtual object can be pre-determined according to the design style of the game scene to be generated, and various sub-virtual objects can be made. Then, according to the size and style of the overall game scene, the sub-virtual objects are spliced to obtain the final game scene. For example, according to the design style of the island community scene, the type, quantity and style of each island component needs to be determined in advance, and various types of island components are made. Then, according to the size and style of the overall island community, the island components are spliced to obtain the final island community.
[0077] It should be noted that no matter which of the above analysis schemes is adopted in this embodiment, it is necessary to output each sub-virtual object according to certain specifications, and then define the target area for splicing on each sub-virtual object. For example, the slots of each island component are defined to realize the splicing of each sub-virtual object, reduce the workload and resources of art, and at the same time output richly shaped game scenes.
[0078] Optionally, when splicing multiple sub-virtual objects, it is necessary to first splice the pathfinding maps of the sub-virtual objects, and then determine the position of the actual terrain to ensure that the spliced pathfinding map and the terrain still have a strong correlation, that is, the spliced pathfinding map and the terrain are still closely fitted.
[0079] In this embodiment, a feasible, efficient, and low-workload game scene production process is particularly important. The game scene of this embodiment can be a large-scale game scene that meets certain constraints. Optionally, when the first sub-virtual object is an island component, the above-mentioned game scene can be a vast sea with multiple islands, and the multiple islands can be random and irregular island communities. That is, the game scene can be an island community scene, where random and irregular can refer to the diversity of multiple islands within a certain range, thereby ensuring the diversity of the game scene.
[0080] Through the above-mentioned steps S202 to S208 of the present invention, a pathfinding map of multiple sub-virtual objects is obtained respectively; multiple baselines of the pathfinding map of each sub-virtual object are determined; at least one target geometric area is determined in the pathfinding map based on the multiple baselines; and the multiple sub-virtual objects are spliced according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene. In other words, the embodiment of the present invention determines the target geometric area corresponding to each sub-virtual object in the pathfinding map based on the multiple baselines of the pathfinding map of each sub-virtual object, and then splices the multiple sub-virtual objects according to the matching target geometric areas to obtain a game scene. In this game scene, the spliced pathfinding map is still valid, thereby achieving the purpose of ensuring the normal operation of the terrain pathfinding system and solving the technical problem of not being able to ensure effective pathfinding when generating a game scene.
[0081] The above method of this embodiment is further introduced below.
[0082] As an optional implementation, step S204, determining multiple baselines of the path-finding graph of each sub-virtual object, includes: determining the multiple baselines based on the local coordinate system where the path-finding graph is located.
[0083] In this embodiment, multiple baselines of the sub-virtual object's pathfinding graph can be determined through the local coordinate system where the sub-virtual object's pathfinding graph is located, wherein the local coordinate system can be the partial coordinate system where the sub-virtual object's pathfinding graph is located in the entire pathfinding graph coordinate system of the game scene.
[0084] Optionally, the pathfinding graph of the sub-virtual object can be viewed in the negative direction of the y-axis in the three-dimensional coordinate system, and the area expanded in the positive direction of the x-axis and the positive direction of the z-axis can be determined as the local coordinate system where the pathfinding graph of the sub-virtual object is located.
[0085] As an optional implementation, multiple baselines are determined based on the local coordinate system where the path-finding graph is located, including: taking the origin of the coordinate system as a reference, determining a baseline perpendicular to the first coordinate axis for each target size interval along the first coordinate axis of the coordinate system, and determining a baseline perpendicular to the second coordinate axis for each target size interval along the second coordinate axis of the coordinate system, to obtain multiple baselines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
[0086] In this embodiment, taking the origin of the local coordinate system where the pathfinding graph of the sub-virtual object is located as a reference, a reference line perpendicular to the first coordinate axis is determined at each target size interval along the first coordinate axis of the local coordinate system, and a reference line perpendicular to the second coordinate axis is determined at each target size interval along the second coordinate axis of the coordinate system, thereby obtaining multiple reference lines. The area defined by the reference lines perpendicular to the first coordinate axis and the reference lines perpendicular to the second coordinate axis can be the target geometric area of the sub-virtual object, wherein the first coordinate axis can be the x-axis in the three-dimensional coordinate system, the second coordinate axis can be the z-axis in the three-dimensional coordinate system, and the target size can be the Tile grid size (l tile ), such as the side length of the Tile grid.
[0087] Optionally, the origin of the local coordinate system where the sub-virtual object's path-finding graph is located can be the coordinate origin of the coordinate system where the entire path-finding graph is located in the game scene, or it can be the coordinate origin reset in the local coordinate system where the sub-virtual object's path-finding graph is located. The coordinate origin can be expressed as (0,0,0), which is not specifically limited here.
[0088] As an optional implementation manner, the target size is negatively correlated with the stitching accuracy of multiple virtual sub-objects.
[0089] In this embodiment, the selection of the target size will affect the stitching accuracy of multiple sub-virtual objects. The target size is negatively correlated with the stitching accuracy of multiple sub-virtual objects, that is, the larger the target size, the lower the stitching accuracy, where the stitching accuracy can be the pathfinding accuracy.
[0090] Optionally, the smaller the target size, the more pathfinding resource files are required, and the higher the splicing accuracy of multiple sub-virtual objects is; while the larger the target size, the smaller the pathfinding resource files are required, and the lower the splicing accuracy of multiple sub-virtual objects is.
[0091] Optionally, the actual value of the target size may be an empirical value determined according to project conditions, which is not specifically limited here.
[0092] As an optional implementation, the origin of the local coordinate system where the terrain of each sub-virtual object is located is determined as the origin of the coordinate system where the path-finding graph is located.
[0093] In this embodiment, the pathfinding map of each sub-virtual object and the terrain of each sub-virtual object are strongly associated, and the geometric shapes of the terrain and the pathfinding map are almost the same. Therefore, the origin of the local coordinate system where the terrain of each sub-virtual object is located can also be determined as the origin of the coordinate system where the pathfinding map is located. The local coordinate system where the terrain of the sub-virtual object is located can be the partial coordinate system where the terrain of the sub-virtual object is located in the entire terrain coordinate system of the game scene.
[0094] Optionally, the origin of the local coordinate system where the terrain of the sub-virtual object is located can be the coordinate origin of the coordinate system where the entire terrain in the game scene is located, or it can be the coordinate origin reset in the local coordinate system where the terrain of the sub-virtual object is located. The coordinate origin can be expressed as (0,0,0), which is not specifically limited here.
[0095] As an optional implementation, step S206, determining at least one target geometric area in the path-finding map based on multiple baselines, includes: dividing the path-finding map into multiple square areas based on multiple baselines; determining at least one target square area in the multiple square areas, wherein the at least one target geometric area includes at least one target square area.
[0096] In this embodiment, the pathfinding maps of multiple sub-virtual objects can be spliced through a target geometric area. A target geometric area includes at least one target square area. Multiple baselines perpendicular to the first coordinate axis and multiple baselines perpendicular to the second coordinate axis can divide the pathfinding map of the sub-virtual object into multiple square areas. The target square area is determined among the multiple square areas. The target square area can be a baseline grid for splicing the pathfinding maps of multiple sub-virtual objects.
[0097] As an optional implementation, determining at least one target square area among the multiple square areas includes: determining at least one square area located at an edge position of each corresponding sub-virtual object among the multiple square areas as the at least one target square area.
[0098] In this embodiment, the path-finding graph of the child virtual object is divided into a plurality of square areas. Among the plurality of square areas, the square area at the edge position of each child virtual object can be determined as the target square area. Figure 3 is a schematic diagram of determining a target square area according to an embodiment of the present invention. Figure 3 As shown, multiple baselines perpendicular to the x-axis and multiple baselines perpendicular to the z-axis can be used to divide the pathfinding graph of the sub-virtual object into multiple square areas, as shown in the black boxes in the figure, and the square area at the edge position of the sub-virtual object is determined as the target square area.
[0099] It should be noted that the actual sub-virtual object can be represented as an irregular image in the coordinate system, and the edge of the path-finding graph of the sub-virtual object is not necessarily a square area.
[0100] As an optional implementation, step S208, according to at least one target geometric area corresponding to each sub-virtual object, multiple sub-virtual objects are spliced to obtain a game scene, including: based on the association relationship between the first sub-virtual object and the second sub-virtual object, at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object is overlapped with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain the game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among the multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
[0101] In this embodiment, association information between the first sub-virtual object and the second sub-virtual object is obtained, and based on the association information, at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object is overlapped with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain a game scene, wherein the association information can be used to represent the connection relationship between the target geometric areas in the pathfinding map of the sub-virtual objects when splicing, the first sub-virtual object can be one of the sub-virtual objects that need to be spliced, and the second sub-virtual object can be the other sub-virtual object that needs to be spliced, and the target area can be used to realize the area where the two sub-virtual objects are spliced.
[0102] For example, a target geometric area is determined on the main island pathfinding map in the island component, and a target geometric area is determined on the sub-island pathfinding map in the island component. The associated information can be used to represent the connection relationship between the main island pathfinding map and the sub-island pathfinding map. By overlapping the target geometric area on the main island pathfinding map and the target geometric area on the sub-island pathfinding map, a game scene in which the main island and the sub-island are spliced together can be realized, and the virtual game character can find the path on the terrain of the game scene.
[0103] For another example, the main island and the secondary island in the island component can also be connected through the connector component, and the association information can be used to indicate the relationship between the main island's navigation map and the secondary island's navigation map and the connector's navigation map (main island + connector + secondary island), and determine a target geometric area on the connector component's navigation map that is spliced with the target geometric area on the main island's navigation map and a target geometric area on the secondary island's navigation map that is spliced with the target geometric area on the secondary island's navigation map. By splicing the main island and the secondary island through the two target geometric areas of the connector component, a game scene in which the main island and the secondary island are spliced together can be realized.
[0104] For another example, only one target geometric area can be determined on the path-finding map of the connector component to be spliced with the target geometric area on the path-finding map of the main island. The associated information can then be used to represent the connection relationship between the path-finding map of the main island and the path-finding map of the connector. By splicing the connector component with the main island, the game scene of the broken bridge can be realized.
[0105] Optionally, when multiple sub-virtual objects are spliced based on the association relationship to obtain a game scene, the splicing order of the multiple sub-virtual objects can be determined based on the object tree. The splicing order can be used to represent the connection order of the multiple sub-virtual objects when splicing, so as to obtain a game scene by splicing the multiple sub-virtual objects. For example, if the sub-virtual object is an island component, the splicing order can be the order of main island + connector + auxiliary island. The main island and connector can be spliced first in this order. After the position of the connector is determined, the auxiliary island can be spliced to the connector.
[0106] It should be noted that the above-described splicing sequence of main island + connector + sub-island is merely an example of an embodiment of the present disclosure and is not limited to the above-described splicing sequence. For example, the main island and sub-island can be directly connected without the ends of the connectors being connected to the sub-island, such as when creating a broken bridge on an island. Any sequence that can be used to splice multiple sub-virtual objects is within the scope of the embodiments of the present disclosure and will not be further illustrated here.
[0107] As an optional implementation, at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object is overlapped with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain a game scene, including: determining at least one first sub-pathfinding map on the corresponding at least one target geometric area in the pathfinding map of the first sub-virtual object; determining at least one second sub-pathfinding map on the corresponding at least one target geometric area in the pathfinding map of the second sub-virtual object; overlapping the at least one first sub-pathfinding map and the at least one second sub-pathfinding map to obtain a target pathfinding map, wherein the pathfinding map is within an area defined by multiple baselines; and generating a game scene based on the target pathfinding map.
[0108] In this embodiment, in the pathfinding graph of the first sub-virtual object, a first sub-pathfinding graph on the target geometric area is determined, and in the pathfinding graph of the second sub-virtual object, a second sub-pathfinding graph on the target geometric area is determined, the first sub-pathfinding graph and the second sub-pathfinding graph are overlapped to obtain a target pathfinding graph, and a game scene is generated based on the target pathfinding graph. The first sub-pathfinding graph can be a pathfinding mesh (NavMesh) for scene pathfinding corresponding to each grid on the target geometric area in the pathfinding graph of the first sub-virtual object, and the second sub-pathfinding graph can be a NavMesh for scene pathfinding corresponding to each grid on the target geometric area in the pathfinding graph of the second sub-virtual object. The target pathfinding graph can be a pathfinding graph on the target geometric area spliced by the first sub-virtual object and the second sub-virtual object.
[0109] Optionally, in the game scene generated based on the target pathfinding graph, the pathfinding graphs of multiple sub-virtual objects can be spliced together, thereby achieving the purpose of ensuring the normal operation of the pathfinding system when the game scene changes.
[0110] As an optional implementation, step S208 determines the orientation adjustment information of the second sub-virtual object in the world space based on the first current orientation of at least one target geometric area in the pathfinding graph of the first sub-virtual object and the second current orientation of at least one target geometric area in the world space corresponding to the pathfinding graph of the second sub-virtual object, wherein the first current orientation and the second current orientation are randomly determined orientations, and the orientation adjustment information is used to represent information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the direction of the second sub-virtual object in the world space; based on the orientation adjustment information, the current orientation of the second sub-virtual object in the world space is adjusted so that the at least one target geometric area in the pathfinding graph of the first sub-virtual object coincides with the at least one target geometric area in the pathfinding graph of the adjusted second sub-virtual object.
[0111] In this embodiment, the splicing of multiple sub-virtual objects can be achieved based on the Transform of each sub-virtual object in the world space. That is, the orientation adjustment information of the second sub-virtual object in the world space can be determined based on the first current orientation of the target geometric area in the pathfinding map of the first sub-virtual object and the second current orientation of the target geometric area in the pathfinding map of the second sub-virtual object. The current orientation of the second sub-virtual object in the world space is adjusted according to the orientation adjustment information, so that the corresponding target geometric area in the pathfinding map of the first sub-virtual object coincides with the corresponding target geometric area in the pathfinding map of the adjusted second sub-virtual object. The first current orientation can be the position information of the target geometric area in the pathfinding map of the first sub-virtual object in the world space, the second current orientation can be the position information of the target geometric area in the pathfinding map of the second sub-virtual object in the world space, and the orientation adjustment information can be information on the need to adjust the current position or direction of the target geometric area in the pathfinding map of the second sub-virtual object in the world space, such as translation or rotation.
[0112] Optionally, when achieving the overlap of the target area in the path-finding map on each two adjacent sub-virtual objects, it is necessary to comply with the stitching scale of the target area. For example, when stitching island components, it is necessary to comply with the stitching scale of the polygonal mesh and align the terrain mesh. For translation, the translation amount is an integer multiple of the side length of the square, so the x and z direction values of the translation can only be integer multiples of the side length of the terrain mesh. Since the target area is a square area, according to its rotation invariance, the rotation of the two sub-virtual objects can be an integer multiple of 90°, that is, in theory, stitching in four directions is supported.
[0113] For example, the first sub-virtual object is the main island component. Based on the position of the main island component, the connecting parts and the sub-island components are spliced onto the main island. The second sub-virtual object can be the connecting parts and the sub-island components. When splicing, each island component must be rotated and translated to the appropriate position to complete the splicing, that is, the connecting parts and the sub-island components must be translated and rotated until they are successfully connected to the main island component.
[0114] Optionally, this embodiment may not consider the translation and rotation of a sub-virtual object first, and may determine the translation and rotation of other sub-virtual objects after splicing, and then rotate and translate the entire spliced sub-virtual object based on the translation and rotation of the above sub-virtual object. The correspondence between each sub-virtual object can be defined through a configuration table.
[0115] For example, consider a child virtual object, such as an island component. Using the main island component's position as a reference, connectors and sub-island components are then attached to the main island component. During this process, each island component must be rotated and translated to the appropriate position to complete the splicing. This approach allows you to ignore the translation and rotation of the main island component and calculate the translation and rotation of each connector and sub-island component after splicing. Then, based on the translation and rotation of the main island component, the entire spliced island is rotated and translated. The corresponding slots for each connector, sub-island component, and main island component can be defined using a configuration table.
[0116] Optionally, in this embodiment, the editor can select from the island component library and programmatically generate the required first target virtual object by configuring a table, for example, generating the required island.
[0117] As an optional implementation, step S208 reads the first sub-virtual object and the second sub-virtual object, as well as the association relationship, in the configuration relationship table, wherein the configuration relationship table includes the identifiers of multiple sub-virtual objects and includes the association relationship between every two sub-virtual objects in the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrain of every two sub-virtual objects.
[0118] In this embodiment, the configuration relationship table may include identifiers of multiple sub-virtual objects and an association relationship between every two sub-virtual objects in the multiple sub-virtual objects. Before splicing the sub-virtual objects, the association relationship between the first sub-virtual object and the second sub-virtual object and the association relationship between the first sub-virtual object and the second sub-virtual object may be read in the configuration relationship table. The identifiers of the sub-virtual objects and the association relationship between every two sub-virtual objects in the sub-virtual objects may be used to characterize attribute information of the sub-virtual objects. The attribute information may include information of the corresponding sub-virtual objects themselves, such as the type of the sub-virtual objects, the position of the sub-virtual objects, and the target area for splicing the sub-virtual objects. In order to limit the complexity of the splicing, the types of sub-virtual objects may be defined, such as main island components, sub-island components, and connectors.
[0119] Optionally, the attribute information may also include information about other sub-virtual objects that are allowed to be spliced with the sub-virtual object, for example, it may include which sub-virtual object the sub-virtual object corresponds to, and which sub-virtual object is used for connection. For example, when the sub-virtual object is a main island component, the attribute information of the main island component may include information about a connector that is allowed to be spliced with the main island component. For another example, when the sub-virtual object is a connector, the attribute information of the connector may include information about a sub-island component that is allowed to be spliced with the connector.
[0120] Optionally, the attribute information may further include the number of child virtual objects of the same type.
[0121] Optionally, the configuration relationship table can be customized by the game project, and its main function is to provide sub-virtual object splicing information. For example, if the sub-virtual object is a main island component, the configuration relationship table can provide the position of the main island component. If there are multiple slots on the main island component, the configuration relationship table can also provide which sub-island component each slot corresponds to and which connector to use. The configuration relationship table is mainly used for mass production.
[0122] Alternatively, in this embodiment, all sub-virtual objects to be joined can be identified by reading a configuration relationship table, reading the translation position of the corresponding target area on the sub-virtual object and the corresponding sub-virtual objects on the target area, and then joining the sub-virtual objects based on their own world-space transforms. The following describes the joining algorithm using sub-virtual objects as island components.
[0123] In this embodiment, let the main island component be A, the secondary island component be B, and the connector be X. The Transform of these three components in the world space can be T A 、T B and T X The Transform of the main island component's slot relative to the main island component itself is T JA , the Transform of the slot of the sub-island component relative to the sub-island component itself is T JB The Transform of the two slots of the connector corresponding to the main island component slot and the sub-island component slot relative to the connector itself is T JX1 and T JX2 .
[0124] This embodiment can determine the Transform of the connected parts in the world space based on the Transform of the slot of the main island component. JX1 ·T X =T JA , we can get According to the relative position relationship, the world transform of the slot on the other side of the connector can be determined to be T JX2 ·T X This embodiment can determine the world transform of the sub-island component after splicing based on the world transform of the slot on the other side of the connector. JB ·T B =T JX2 ·T X , we can get The purpose of all connecting parts and auxiliary island components being spliced on the main island is achieved.
[0125] In this embodiment, considering the translation and rotation of the main island component itself, the island component can be translated and rotated as a whole based on the relative position relationship, and all T JA Item T JA ·T A Make the replacement and get the final result: the world transform of the connector: World Transform of the sub-island component: Thus achieving the goal of making the final island.
[0126] As an optional implementation, step S202 obtains the pathfinding maps of multiple sub-virtual objects respectively, including: generating the pathfinding resources of each sub-virtual object based on the terrain resources of each sub-virtual object; generating the pathfinding map of each sub-virtual object based on the pathfinding resources of each sub-virtual object, wherein the pathfinding map is composed of polygonal faces of each sub-virtual object.
[0127] In this embodiment, each sub-virtual object may include terrain resources and pathfinding resources. The pathfinding resources are generated by the editor based on the terrain resources of each sub-virtual object. The pathfinding resources of each sub-virtual object are divided according to polygonal grids to generate a pathfinding graph for each sub-virtual object, wherein the pathfinding graph may be composed of polygonal patches of each sub-virtual object, that is, a NavMesh composed of polygons.
[0128] Optionally, the terrain resources of the sub-virtual objects can be spliced arbitrarily, and the only difference is whether the splicing effect is beautiful. However, in actual applications, when splicing sub-virtual objects, the splicing of terrain resources also needs to meet design requirements. The target area can be required to cover a relatively complete area as much as possible. This is only an example and is not specifically limited.
[0129] It should be noted that since the pathfinding resources in this embodiment are generated by terrain resources, the target areas in the polygonal meshes on each two adjacent sub-virtual objects can be overlapped in a priority manner according to the splicing order, so that the sub-virtual objects where the terrain resources corresponding to the pathfinding resources are located are naturally spliced together.
[0130] The above technical solution of the embodiment of the present invention is further illustrated below in combination with preferred implementation methods, specifically taking the game scene as an island community scene as an example.
[0131] Game scenes are a crucial component of any game, and their quantity and quality directly impact the player's gaming experience. With the development of 3D open-world games and increasing player demand for game content, existing game scenes are becoming increasingly larger and more sophisticated, leading to a corresponding increase in the size of game installation packages. Finding an efficient method to generate large game scenes with minimal artistic effort is a key concern within the gaming industry.
[0132] For naval combat games, a large number of island community art resources need to be produced, including both terrain resources and pathfinding resources. Furthermore, to enhance the diversity of the experience, the island generation follows certain random rules. However, the difficulty of scene generation lies in finding a workflow that simultaneously meets the requirements of low art workload, scene randomness, and a manageable size of the game installation package.
[0133] In the related art, there is already an idea of programmatically generating art resources. Procedural content generation (PCG) is an algorithm in computer science that allows a program to automatically generate a type of data. An ideal programmatic generation solution is to generate a complete game scene that meets certain constraints with one click. In the related art, the way to realize the island community scene is usually as follows: in an offline state, the art scene editor builds the island community scene in advance; in an offline state, the island community scene is completed by programmatic generation software, and then imported into the game engine; at runtime, the algorithm is used to implement simple polygons to build areas and generate the island community scene.
[0134] When processing terrain resources, the corresponding pathfinding resources also need to be processed. There are many ways to represent the scene map of the pathfinding resources, such as the two-dimensional grid method, the path point method, the navigation mesh method, etc. Among them, the two-dimensional grid method divides the scene into two-dimensional grids of equal size. Each two-dimensional grid can be marked as an obstacle. The pathfinding path is based on the grid and bypasses the grids marked as obstacles; the path point method abstracts the scene into a series of path points. The positions and connectivity of these path points can be designed manually, and the character can move according to the designer's ideas when finding the path; the navigation mesh method (NavMesh) uses a set of convex polygons of different shapes and sizes to represent the entire scene, and uses polygons to cover the walkable area in the scene. Compared with the first two methods, the navigation mesh method is more flexible. For pathfinding in complex scenes, the navigation mesh is often the preferred method.
[0135] In this embodiment, the game scene can be a vast ocean with multiple islands, which is random, meaning that the location, distribution, and shape of the islands may be different each time the game is entered. Therefore, the game scene generation and pathfinding methods in related technologies still have some problems. For example, if the editor builds all the scenes in advance to create a pseudo-random effect, the workload of the artist and the volume of art resources will increase exponentially. If programmatic generation software is used to create the game scene, the controllability of the terrain details of the game scene is poor, and it cannot effectively reflect the aesthetic style of the artist. The method of randomly generating the game scene through algorithms at runtime is more suitable for game scenes with low precision and less terrain details. For game scenes with higher precision requirements, the runtime random calculation method cannot be used.
[0136] The existing methods for generating game scenes fail to achieve a balance between randomness and the artist's aesthetic style, ensuring both randomness and scene reuse. Regarding the representation of pathfinding resources, the two-dimensional grid and waypoint methods are more suitable for simple game scenes. While the navigation mesh method is suitable for pathfinding in complex scenes, it fails to account for randomness.
[0137] In order to achieve the purpose of randomly generating irregular island community scenes, this embodiment can design an art workflow so that the volume of art resources can be controlled, the workload of art personnel can be controlled, the appearance modeling can be enriched, and more random combinations can be supported. In this way, with less art engineering and resource volume, richer and different terrain resources can be achieved, thereby ensuring the normal operation of the terrain pathfinding system.
[0138] In order to solve the above problems, this embodiment provides a method for generating a game scene, which can generate random irregular island community scenes based on modularization. Figure 4 Schematic diagram of a game scene formed by splicing island components according to an embodiment of the present invention. Figure 4 As shown, the island community scene to be output can be abstractly disassembled and classified into multiple island components, such as main island component 401, secondary island component 402, secondary island component 403, and connector 404. Multiple slots can be defined on the island components to enable splicing between island components. When producing the island community scene, these island components can be reused for splicing. The main island component 401 and secondary island component 402 can be spliced together through connector 404, directly without connector 404, or without any secondary island components at the end of connector 404, for example, to create a broken bridge on an island. This reduces the amount of resources and workload.
[0139] Figure 5Schematic diagram of an island tree according to an embodiment of the present invention. Figure 5 As shown, the process of stitching a complete island can be abstracted into the construction of an island tree. The root node of the island tree is the main island component 501. The root node can have many child nodes, or no child nodes. The child nodes of the root node can represent connectors 502, 503, and 504. The nodes corresponding to the connectors can also have child nodes, which can be used to represent sub-island components 505, 506, and 507.
[0140] In this embodiment, during the splicing of island components, in addition to considering the splicing of island components corresponding to terrain resources, the splicing of island components corresponding to pathfinding resources must also be considered. The pathfinding splicing solution that can be used in this embodiment is tile-based navigation grid splicing. Among them, scene pathfinding can be divided into square areas of fixed length. Therefore, when splicing island components, it is also necessary to comply with the splicing scale of the navigation grid, that is, it can only be translated according to integer multiples of the square grid and can only be rotated by 90°.
[0141] The purpose of this embodiment is to reduce the amount of art work and resources, while outputting a richly shaped island community. Because this embodiment uses the idea of splicing island components, scene designers can analyze the game scene from the overall to the details, or from the details to the overall.
[0142] In the overall and detailed analysis, scenario designers need to analyze each island in the final island community scene. They can logically split each island into a main island component, multiple connecting parts, and multiple sub-island components, and analyze whether there are any reusable island components. Based on the results of the analysis, each island component is created.
[0143] In this analysis, from the details to the whole, scenario designers can predetermine the type, quantity, and style of each island component based on the design style and create each type of island component. They can then combine the island components based on the size and style of the overall island cluster, ultimately creating the island cluster scene. Regardless of the approach adopted, scenario designers must output the island components according to certain specifications and define the slots for each island component.
[0144] The method for generating a game scene in this embodiment may include the following steps.
[0145] Step 1: Design the scene terrain style of the island component.
[0146] Scene designers can produce terrain resources for each island component according to design requirements.
[0147] Step 2: Determine the terrain origin of the island component.
[0148] Figure 6 is a schematic diagram of a coordinate system of a three-dimensional scene according to an embodiment of the present invention, such as Figure 6 As shown, the game scene is a three-dimensional scene. The terrain origin in the game scene, that is, the coordinate point (0, 0, 0), can determine the position of the (0, 0, 0) point of the local coordinate system of the island component. Figure 7 is a schematic diagram of an island component according to an embodiment of the present invention within a region expanded by the positive directions of the x-axis and the z-axis, as shown in FIG. Figure 7 As shown, the position is at a corner of the circumscribed rectangle of the island component, and the island component is within the area expanded by the positive directions of the x-axis and the z-axis.
[0149] In this embodiment, a complete island component may include two types of resources: scene terrain resources and pathfinding resources.
[0150] In this embodiment, the splicing of the island components corresponding to the terrain resources and the island components corresponding to the pathfinding resources are carried out simultaneously. Generally speaking, there are terrain resources first, and then the editor is used to generate pathfinding resources one by one based on the terrain resources. From the perspective of splicing, terrain resources can be spliced arbitrarily (the only question is whether it looks good), while pathfinding resources are polygonal meshes and cannot be spliced arbitrarily. Therefore, when actually splicing the island components corresponding to the pathfinding resources, since the splicing of the island components corresponding to the pathfinding resources is more restricted, it is necessary to determine the splicing scheme of all resources by splicing the island components corresponding to the pathfinding resources.
[0151] In this embodiment, a specific method for splicing the island components corresponding to the path-finding resources may be the following Tile splicing method, that is, cutting the path-finding resources into squares and splicing them based on the squares.
[0152] In this embodiment, the pathfinding resources can be generated based on the terrain resources. Since the island components need to be spliced in the subsequent steps, and the splicing rules of the island components corresponding to the pathfinding resources and the splicing rules of the island components corresponding to the terrain resources are different, the island components corresponding to the terrain resources can be spliced arbitrarily, but the island components corresponding to the pathfinding resources are spliced based on the Tile area. Therefore, it is necessary to standardize the terrain resources produced in the first step. For example, looking in the negative direction of the y-axis, the terrain body is in the area expanded in the positive x-direction and the positive z-direction in the terrain space, such as Figure 7 shown.
[0153] Step 3: Determine the Tile grid size l tile , defining slots based on the Tile grid.
[0154] In this embodiment, the pathfinding resource is based on the tile area, which is logically equivalent to gridding the top view of the scene and finally outputting the scene pathfinding NavMesh corresponding to each grid. Considering the splicing between multiple island components, a suitable tile grid size must be selected. tile Figure 8 (a) is a larger size l according to an embodiment of the present invention. tile 8(b) is a diagram of a smaller size according to an embodiment of the present invention. tile Schematic diagram of the corresponding number of pathfinding graph segments. Figure 8(a) and 8(b) As shown, l tile The larger it is, the more pathfinding resources can be saved, but the lower the splicing accuracy is. tile The larger the value, the more pathfinding resources are consumed, but the higher the splicing accuracy.
[0155] In this embodiment, slots are designated tile areas on an island component. Figure 9 Schematic diagram of a Tile area in a pathfinding resource according to an embodiment of the present invention. Figure 9 As shown in the figure, the square block surrounded by thick lines can be a Tile area, where the Tile area refers to the adjacent square blocks in the navigation grid. The square blocks here only represent the area, not the location. That is, the Tile area is a designated square area of the navigation resource on the island component. When splicing, this area coincides with the Tile areas of other island components, which represents the logical splicing. It should be noted that the Tile area here refers to the slot, such as Figure 10 As shown, Figure 10 This is a schematic diagram of a slot according to an embodiment of the present invention. The black solid squares are slots on the island components used for splicing, and the black hollow squares are slots that overlap when the island components are spliced. When two island components are spliced, one slot on each island component must completely overlap.
[0156] In this embodiment, since the Tile area is a square area, it theoretically supports splicing in four directions. When the island components are spliced according to the Tile rule, the splicing of the island components corresponding to the terrain resources must also meet the design requirements, which requires the slot to cover a relatively complete island area as much as possible. At the same time, as shown in Figure 8(a), since the side length of the slot is also l tile , so l tile The larger it is, the lower the stitching accuracy. tile The final determination requires scene designers to make certain trade-offs.
[0157] In this embodiment, the side length of the slot can be the side length of the square grid. A smaller side length means a larger file size of pathfinding resources, which can improve pathfinding accuracy. A larger side length means a smaller file size of pathfinding resources, which can reduce pathfinding accuracy. Furthermore, the side length of the slot and the side length of the square grid can be the same. The actual value can be an empirical value based on the project's specific circumstances.
[0158] In this embodiment, the pathfinding can be represented as a square grid, such as Figure 11 As shown, Figure 11 This is a schematic diagram of a square grid according to an embodiment of the present invention. The scene pathfinding is divided into a square grid by thick lines. The actual pathfinding resources are aligned with the terrain and are simply cut into squares.
[0159] Step 4: Output pathfinding resources based on the Tile grid.
[0160] In this embodiment, the terrain and pathing resources for each island component have been determined, and a pathing NavMesh for each island component can be generated based on the tile division. The pathing graph generated by each island component can be multiple pathing files, and the number of pathing files can be the same as the number of tiles divided into the island component, with a one-to-one correspondence between the two.
[0161] Step 5: Assemble the island components.
[0162] In this embodiment, after the island components corresponding to the terrain resources and the pathfinding resources are produced, a certain mechanism is required to allow the various island components to be spliced together as needed. The island components are divided into main island components, sub-island components, and connectors. In this embodiment, multiple slots can be defined on the main island component, one slot on the sub-island component, and one slot at the head and tail of the connector. The splicing result can be the main island component + connector + sub-island component, where the main island can define its own translation and rotation. Since the grid of the pathfinding tile needs to be aligned, the x and z direction values of the translation can be l tile The rotation angle can be an integer multiple of 90°.
[0163] Optionally, in this embodiment, the translation and rotation of the main island assembly may not be considered first, and the connector and the auxiliary island assembly may be spliced first, such as Figure 10As shown, the solid black boxes represent the slots for island components. The first island component can be a connector, which has two slots. The next two island components can be a main island component and a secondary island component, each with one slot. When each island component is loaded into the scene, the connector and secondary island components can be attached to the main island component, using the main island component's position as a reference. The hollow boxes with bold black lines in the figure represent the slots where the main and secondary island components overlap with the connector. During assembly, the connector and secondary island components must be rotated and translated to the appropriate position. For rotation, since the assembly is based on a square, the rotation angle is an integer multiple of 90 degrees, while the translation amount is an integer multiple of the square side length. After the connector and secondary island components are attached to the main island component, the entire assembled island is rotated and translated, taking into account the translation and rotation of the main island component. The correspondence between connectors, secondary island components, and main island component slots can be defined using a configuration table.
[0164] It should be noted that the island component can include a square area (Tile area), but the island component is not equivalent to a square area. Figure 10 The connectors, main island components and auxiliary island components shown can all include multiple square areas, but Figure 10 For illustration purposes only, the island component can be divided into multiple square areas, but the actual island component is irregular.
[0165] The island stitching algorithm of this embodiment is further introduced below.
[0166] Step 1: Read the configuration table to obtain all island components to be spliced.
[0167] In this embodiment, the configuration table is project-defined, primarily providing island layout information. For example, this information could include the location of the main island. If the main island has multiple slots, the information could also indicate which secondary island component corresponds to each slot and which connector to use. This configuration table is primarily used during mass production.
[0168] This embodiment can read the translation position of the corresponding slot on the main island component, the corresponding connector on the slot, and the sub-island component corresponding to the connector.
[0169] In this embodiment, the main island component can be A, the secondary island component can be B, and the connector can be X. The Transforms of the three in the world space can be T A 、T B and T X , and the Transform of the main island component's slot relative to the main island component itself is T JA, the Transform of the slot of the sub-island component relative to the sub-island component itself can be T JB The two slots of the connector corresponding to the main island component slot and the sub-island component slot can be T JX1 and T JX2 .
[0170] Optionally, in this embodiment, the editor can select from the island component library and programmatically generate the required islands using the above configuration table.
[0171] Step 2: According to the Transform of the slot of the main island component, determine the Transform of the spliced connector in the world space. JX1 ·T X =T JA , we can get In this embodiment, the world transform of the slot on the other side of the connector can be determined to be T according to the relative position relationship. JX2 ·T X .
[0172] Step 3: The world transform of the connected sub-island component can be determined based on the world transform of the slot on the other side of the connector. JB ·T B =T JX2 ·T X , we can get
[0173] At this point, all connectors and sub-island components have been spliced onto the main island components.
[0174] Step 4: Considering the translation and rotation of the main island component itself, the spliced island can be translated and rotated as a whole according to the relative position relationship to obtain the final desired island. JA Item T JA ·T A After replacing, we get the following final result:
[0175] The world transform of this connector:
[0176] World Transform of the sub-island component:
[0177] Step 6: Construct the required scene by stitching islands together.
[0178] At this point, the splicing process for an island has ended.
[0179] It should be noted that this embodiment can generate random terrain based on modular irregular plots, which is not only applicable to island splicing, but can also be extended to the splicing of dungeon and maze scenes. Examples will not be given here one by one.
[0180] This embodiment proposes a method for generating random, irregular island communities. Scenario designers can select from a library of island components and programmatically generate the desired islands using a configuration table. This process significantly increases the reusability of island components, significantly reducing the workload of artists and the overall amount of art resources. In this embodiment, large environments and randomly generated levels are key features and crucial for enriching gameplay. This method ensures a certain level of scene diversity, allowing players to encounter different island locations and types each time they enter the game, thus enriching the game's scenarios.
[0181] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including multiple instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0182] In this embodiment, a device for generating a game scene is also provided. The device is used to implement the above-mentioned embodiments and preferred embodiments, and the details already described will not be repeated. As used below, the term "unit" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0183] Figure 12 This is a device for generating a game scene according to one embodiment of the present invention. Figure 12 As shown, the game scene generating device 12 includes: an acquisition unit 1201 , a first determination unit 1202 , a second determination unit 1203 and a splicing unit 1204 .
[0184] The acquisition unit 1201 is used to respectively acquire pathfinding maps of multiple sub-virtual objects, wherein the pathfinding maps are used to guide the virtual game character to find a path on the terrain of the corresponding sub-virtual objects.
[0185] The first determining unit 1202 is used to determine multiple baselines of the path-finding graph of each sub-virtual object, wherein the baselines are used to enable the virtual game character to path from the terrain of each sub-virtual object to the terrain of sub-virtual objects other than each sub-virtual object among the multiple sub-virtual objects.
[0186] The second determining unit 1203 is configured to determine at least one target geometric area in the path-finding graph based on a plurality of reference lines.
[0187] The splicing unit 1204 is configured to splice multiple sub-virtual objects according to at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, wherein the virtual game character finds a path on the terrain of the game scene.
[0188] Optionally, the first determination unit may include: a first determination module, configured to determine a plurality of baselines based on a local coordinate system where the path-finding graph is located.
[0189] Optionally, the first determination module may include: a first determination sub-module, used to determine a baseline perpendicular to the first coordinate axis for each target size interval along the first coordinate axis of the coordinate system, with the origin of the coordinate system as a reference, and to determine a baseline perpendicular to the second coordinate axis for each target size interval along the second coordinate axis of the coordinate system, to obtain multiple baselines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
[0190] Optionally, the target size is negatively correlated with the stitching accuracy of the multiple virtual sub-objects.
[0191] Optionally, the first determining unit may include: a second determining module, configured to determine the origin of the local coordinate system where the terrain of each sub-virtual object is located as the origin of the coordinate system where the pathfinding graph is located.
[0192] Optionally, the second determination unit may include: a division module for dividing the pathfinding map into multiple square areas based on multiple baselines; a third determination module for determining at least one target square area among the multiple square areas, wherein the at least one target geometric area includes at least one target square area.
[0193] Optionally, the third determining module may include: a second determining submodule, configured to determine at least one square area located at an edge position of each corresponding sub-virtual object among the multiple square areas as at least one target square area.
[0194] Optionally, the splicing unit may include: an overlap module, used to overlap at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object based on the association relationship between the first sub-virtual object and the second sub-virtual object, to obtain a game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
[0195] Optionally, the overlap module may include: a third determination submodule, used to determine at least one first sub-navigation graph on the corresponding at least one target geometric area in the navigation map of the first sub-virtual object; a fourth determination submodule, used to determine at least one second sub-navigation graph on the corresponding at least one target geometric area in the navigation map of the second sub-virtual object; an overlap submodule, used to overlap at least one first sub-navigation graph and at least one second sub-navigation graph to obtain a target navigation graph, wherein the navigation graph is within an area defined by multiple baselines; and generating a game scene based on the target navigation graph.
[0196] Optionally, the stitching unit may further include: a third determination unit, for determining orientation adjustment information of the second sub-virtual object in the world space based on a first current orientation of at least one target geometric area corresponding to the first sub-virtual object in the pathfinding map and a second current orientation of at least one target geometric area corresponding to the second sub-virtual object in the pathfinding map, wherein the first current orientation and the second current orientation are randomly determined orientations, and the orientation adjustment information is used to represent information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the direction of the second sub-virtual object in the world space; an adjustment unit, for adjusting the current orientation of the second sub-virtual object in the world space based on the orientation adjustment information, so that the at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object coincides with the at least one target geometric area corresponding to the pathfinding map of the adjusted second sub-virtual object.
[0197] Optionally, the device may also include: a reading unit, configured to read the first sub-virtual object and the second sub-virtual object, and the association relationship in a configuration relationship table, wherein the configuration relationship table includes identifiers of multiple sub-virtual objects, and includes an association relationship between every two sub-virtual objects in the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrain of each two sub-virtual objects.
[0198] Optionally, the acquisition unit may include: a first generation module, used to generate pathfinding resources for each sub-virtual object based on the terrain resources of each sub-virtual object; a second generation module, used to generate a pathfinding graph for each sub-virtual object based on the pathfinding resources of each sub-virtual object, wherein the pathfinding graph is composed of polygonal patches of each sub-virtual object.
[0199] It should be noted that the above-mentioned units can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above-mentioned units are all located in the same processor; or the above-mentioned units are located in different processors in any combination.
[0200] In the device for generating a game scene in this embodiment, an acquisition unit is used to respectively acquire the path-finding maps of multiple sub-virtual objects; a first determination unit is used to determine multiple baselines of the path-finding map of each sub-virtual object; a second determination unit is used to determine at least one target geometric area in the path-finding map based on the multiple baselines; and a splicing unit is used to splice the multiple sub-virtual objects according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, thereby achieving the purpose of ensuring the normal operation of the terrain path-finding system and solving the technical problem of being unable to ensure effective path-finding when generating a game scene.
[0201] An embodiment of the present invention further provides a non-volatile storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.
[0202] Optionally, in this embodiment, the above-mentioned non-volatile storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0203] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0204] Optionally, in this embodiment, the non-volatile storage medium may be configured to store a computer program for executing the following steps:
[0205] S1, respectively obtaining a pathfinding map of a plurality of sub-virtual objects, wherein the pathfinding map is used to guide a virtual game character to find a path on a terrain corresponding to the sub-virtual object;
[0206] S2, determining a plurality of baselines of a pathfinding graph for each sub-virtual object, wherein the baselines are used to enable the virtual game character to path from a terrain of each sub-virtual object to a terrain of a sub-virtual object other than each sub-virtual object among the plurality of sub-virtual objects;
[0207] S3, determining at least one target geometric area in the pathfinding graph based on the plurality of reference lines;
[0208] S4, according to at least one target geometric area corresponding to each sub-virtual object, multiple sub-virtual objects are spliced to obtain a game scene, wherein the virtual game character finds a path on the terrain of the game scene.
[0209] Optionally, the processor may also be configured to execute the following steps through a computer program: determining a plurality of baselines based on a local coordinate system where the pathfinding graph is located.
[0210] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: taking the origin of the coordinate system as a reference, determining a baseline perpendicular to the first coordinate axis for each target size interval along the first coordinate axis of the coordinate system, and determining a baseline perpendicular to the second coordinate axis for each target size interval along the second coordinate axis of the coordinate system, to obtain multiple baselines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
[0211] Optionally, the target size is negatively correlated with the stitching accuracy of the multiple virtual sub-objects.
[0212] Optionally, the processor may also be configured to execute the following steps through a computer program: determining the origin of the local coordinate system where the terrain of each sub-virtual object is located as the origin of the coordinate system where the pathfinding map is located.
[0213] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: dividing the pathfinding map into multiple square areas based on multiple baselines; determining at least one target square area among the multiple square areas, wherein at least one target geometric area includes at least one target square area.
[0214] Optionally, the processor may be further configured to execute the following steps through a computer program: determining at least one square area located at an edge position of each corresponding sub-virtual object among the multiple square areas as at least one target square area.
[0215] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: based on the association relationship between the first sub-virtual object and the second sub-virtual object, overlap at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain a game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
[0216] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: in the pathfinding map of the first sub-virtual object, determine at least one first sub-pathfinding map on the corresponding at least one target geometric area; in the pathfinding map of the second sub-virtual object, determine at least one second sub-pathfinding map on the corresponding at least one target geometric area; overlap the at least one first sub-pathfinding map and the at least one second sub-pathfinding map to obtain a target pathfinding map, wherein the pathfinding map is within the area defined by multiple baselines; and generate a game scene based on the target pathfinding map.
[0217] Optionally, the processor may also be configured to perform the following steps through a computer program: determining orientation adjustment information of the second sub-virtual object in the world space based on a first current position in the world space of at least one target geometric area corresponding to the first sub-virtual object's pathfinding graph and a second current position in the world space of at least one target geometric area corresponding to the second sub-virtual object's pathfinding graph, wherein the first current orientation and the second current orientation are randomly determined orientations, and the orientation adjustment information is used to represent information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the direction of the second sub-virtual object in the world space; adjusting the current orientation of the second sub-virtual object in the world space based on the orientation adjustment information so that the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object coincides with the at least one target geometric area corresponding to the pathfinding graph of the adjusted second sub-virtual object.
[0218] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: reading the first sub-virtual object and the second sub-virtual object, and the association relationship in the configuration relationship table, wherein the configuration relationship table includes the identifiers of multiple sub-virtual objects, and includes the association relationship between every two sub-virtual objects in the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrain of each two sub-virtual objects.
[0219] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: generating pathfinding resources for each sub-virtual object based on the terrain resources of each sub-virtual object; generating a pathfinding graph for each sub-virtual object based on the pathfinding resources of each sub-virtual object, wherein the pathfinding graph is composed of polygonal patches of each sub-virtual object.
[0220] In the non-volatile storage medium of this embodiment, a technical solution for generating a game scene is provided. The solution determines the target geometric area corresponding to each sub-virtual object in the path-finding map based on multiple baselines of the path-finding map of each sub-virtual object, and then splices multiple sub-virtual objects according to the target geometric area to obtain a game scene. In the game scene, the spliced path-finding map is still valid, ensuring the normal operation of the terrain path-finding system, thereby achieving the technical effect of ensuring effective path-finding when generating the game scene, and further solving the technical problem of not being able to ensure effective path-finding when generating the game scene.
[0221] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present invention.
[0222] In the exemplary embodiments of the present application, a computer-readable storage medium stores a program product capable of implementing the above-described method of the present embodiment. In some possible implementations, various aspects of the present embodiment may also be implemented in the form of a program product, which includes program code. When the program product is executed on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the "Exemplary Method" section above.
[0223] According to an embodiment of the present invention, a program product for implementing the above method can be a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present invention is not limited thereto. In the embodiment of the present invention, the computer-readable storage medium can be any tangible medium containing or storing a program, and the program can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0224] The program product may be implemented in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0225] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any appropriate combination of the above.
[0226] An embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0227] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0228] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0229] S1, respectively obtaining a pathfinding map of a plurality of sub-virtual objects, wherein the pathfinding map is used to guide a virtual game character to find a path on a terrain corresponding to the sub-virtual object;
[0230] S2, determining a plurality of baselines of a pathfinding graph for each sub-virtual object, wherein the baselines are used to enable the virtual game character to path from a terrain of each sub-virtual object to a terrain of a sub-virtual object other than each sub-virtual object among the plurality of sub-virtual objects;
[0231] S3, determining at least one target geometric area in the pathfinding graph based on the plurality of reference lines;
[0232] S4, according to at least one target geometric area corresponding to each sub-virtual object, multiple sub-virtual objects are spliced to obtain a game scene, wherein the virtual game character finds a path on the terrain of the game scene.
[0233] Optionally, the processor may also be configured to execute the following steps through a computer program: determining a plurality of baselines based on a local coordinate system where the pathfinding graph is located.
[0234] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: taking the origin of the coordinate system as a reference, determining a baseline perpendicular to the first coordinate axis for each target size interval along the first coordinate axis of the coordinate system, and determining a baseline perpendicular to the second coordinate axis for each target size interval along the second coordinate axis of the coordinate system, to obtain multiple baselines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
[0235] Optionally, the target size is negatively correlated with the stitching accuracy of the multiple virtual sub-objects.
[0236] Optionally, the processor may also be configured to execute the following steps through a computer program: determining the origin of the local coordinate system where the terrain of each sub-virtual object is located as the origin of the coordinate system where the pathfinding map is located.
[0237] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: dividing the pathfinding map into multiple square areas based on multiple baselines; determining at least one target square area among the multiple square areas, wherein at least one target geometric area includes at least one target square area.
[0238] Optionally, the processor may be further configured to execute the following steps through a computer program: determining at least one square area located at an edge position of each corresponding sub-virtual object among the multiple square areas as at least one target square area.
[0239] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: based on the association relationship between the first sub-virtual object and the second sub-virtual object, overlap at least one target geometric area corresponding to the pathfinding map of the first sub-virtual object with at least one target geometric area corresponding to the pathfinding map of the second sub-virtual object to obtain a game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
[0240] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: in the pathfinding map of the first sub-virtual object, determine at least one first sub-pathfinding map on the corresponding at least one target geometric area; in the pathfinding map of the second sub-virtual object, determine at least one second sub-pathfinding map on the corresponding at least one target geometric area; overlap the at least one first sub-pathfinding map and the at least one second sub-pathfinding map to obtain a target pathfinding map, wherein the pathfinding map is within the area defined by multiple baselines; and generate a game scene based on the target pathfinding map.
[0241] Optionally, the processor may also be configured to perform the following steps through a computer program: determining orientation adjustment information of the second sub-virtual object in the world space based on a first current position in the world space of at least one target geometric area corresponding to the first sub-virtual object's pathfinding graph and a second current position in the world space of at least one target geometric area corresponding to the second sub-virtual object's pathfinding graph, wherein the first current orientation and the second current orientation are randomly determined orientations, and the orientation adjustment information is used to represent information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the direction of the second sub-virtual object in the world space; adjusting the current orientation of the second sub-virtual object in the world space based on the orientation adjustment information so that the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object coincides with the at least one target geometric area corresponding to the pathfinding graph of the adjusted second sub-virtual object.
[0242] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: reading the first sub-virtual object and the second sub-virtual object, and the association relationship in the configuration relationship table, wherein the configuration relationship table includes the identifiers of multiple sub-virtual objects, and includes the association relationship between every two sub-virtual objects in the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrain of each two sub-virtual objects.
[0243] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: generating pathfinding resources for each sub-virtual object based on the terrain resources of each sub-virtual object; generating a pathfinding graph for each sub-virtual object based on the pathfinding resources of each sub-virtual object, wherein the pathfinding graph is composed of polygonal patches of each sub-virtual object.
[0244] In the electronic device of this embodiment, a technical solution for generating a game scene is provided. This solution determines the target geometric area corresponding to each sub-virtual object in the path-finding map based on multiple baselines of the path-finding map of each sub-virtual object, and then splices multiple sub-virtual objects according to the target geometric area to obtain a game scene. In the game scene, the spliced path-finding map is still valid, ensuring the normal operation of the terrain path-finding system, thereby achieving the technical effect of ensuring effective path-finding when generating the game scene, and further solving the technical problem of not being able to ensure effective path-finding when generating the game scene.
[0245] Figure 13 FIG is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 13 As shown, the electronic device 1300 is only an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0246] like Figure 13 As shown, electronic device 1300 is implemented as a general-purpose computing device. Components of electronic device 1300 may include, but are not limited to, at least one processor 1310, at least one memory 1320, a bus 1330 connecting various system components (including memory 1320 and processor 1310), and a display 1340.
[0247] The memory 1320 stores program codes, which can be executed by the processor 1310 , so that the processor 1310 executes the steps according to various exemplary embodiments of the present invention described in the method section of the embodiment of the present application.
[0248] The memory 1320 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 13201 and / or a cache memory unit 13202, and may further include a read-only memory unit (ROM) 13203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0249] In some examples, memory 1320 may also include a program / utility 13204 having a set (at least one) of program modules 13205. Such program modules 13205 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 1320 may further include memory remotely located relative to processor 1310. These remote memories may be connected to electronic device 1300 via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0250] The bus 1330 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a local bus to the processor 1310, or any of a variety of bus architectures.
[0251] The display 1340 may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 1300 .
[0252] Optionally, the electronic device 1300 may also communicate with one or more external devices 1400 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 1300, and / or any device that enables the electronic device 1300 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication may be performed through an input / output (I / O) interface 1350. Furthermore, the electronic device 1300 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 1360. Figure 13 As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 via the bus 1330. Figure 13 Not shown, other hardware and / or software modules may be used in conjunction with electronic device 1300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0253] The electronic device 1300 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.
[0254] It can be understood by those skilled in the art that Figure 13 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 13 More or fewer components than shown, or with Figure 1 The memory 1320 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the [Title] method in the embodiment of the present invention. The processor 1310 executes the computer program stored in the memory 1320 to perform various functional applications and data processing, thereby implementing the above-mentioned method for generating a game scene.
[0255] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0256] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0257] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, and can be electrical or other forms.
[0258] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0259] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0260] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0261] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, multiple improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for generating a game scene, characterized in that: include: Obtaining pathfinding graphs for each of the plurality of virtual child objects, wherein the pathfinding graphs are used to guide a virtual game character to pathfind on a terrain corresponding to the virtual child objects, the virtual child objects comprising terrain resources and pathfinding resources, the terrain resources being used to represent a terrain style of a game scene, and the pathfinding resources being used to represent at least one of the following: a scene structure of the game scene, information about obstacles, and information about a feasible area; Determining a plurality of reference lines of a pathfinding graph for each sub-virtual object, wherein the reference lines are used to enable the virtual game character to path from a terrain of each sub-virtual object to a terrain of a sub-virtual object other than each sub-virtual object among the plurality of sub-virtual objects; determining at least one target geometric area in the pathfinding graph based on the plurality of reference lines; The plurality of sub-virtual objects are spliced according to the at least one target geometric area corresponding to each sub-virtual object to obtain the game scene, wherein the virtual game character finds a path on the terrain of the game scene.
2. The method according to claim 1, characterized in that Determine multiple baselines for the pathfinding graph of each child virtual object, including: The multiple baselines are determined based on the local coordinate system of the path-finding graph.
3. The method according to claim 2, characterized in that Determining the plurality of reference lines based on a local coordinate system of the pathfinding graph includes: Taking the origin of the coordinate system as a reference, a reference line perpendicular to the first coordinate axis is determined at each target size interval along the first coordinate axis of the coordinate system, and a reference line perpendicular to the second coordinate axis is determined at each target size interval along the second coordinate axis of the coordinate system, to obtain the multiple reference lines, wherein the first coordinate axis and the second coordinate axis are perpendicular to each other.
4. The method according to claim 3, characterized in that The target size is negatively correlated with the stitching accuracy of the multiple virtual sub-objects.
5. The method according to claim 2, characterized in that The method further comprises: The origin of the local coordinate system where the terrain of each sub-virtual object is located is determined as the origin of the coordinate system where the pathfinding graph is located.
6. The method according to claim 1, characterized in that Determining at least one target geometric area in the pathfinding graph based on the plurality of reference lines includes: Dividing the pathfinding graph into a plurality of square areas based on the plurality of reference lines; At least one target square area is determined among the multiple square areas, wherein the at least one target geometric area includes the at least one target square area.
7. The method according to claim 6, characterized in that Determining at least one target square area among the plurality of square areas includes: At least one square area among the multiple square areas that is located at the edge of each corresponding sub-virtual object is determined as the at least one target square area.
8. The method according to claim 1, characterized in that According to the at least one target geometric area corresponding to each sub-virtual object, the plurality of sub-virtual objects are spliced together to obtain a game scene, comprising: Based on the association relationship between the first sub-virtual object and the second sub-virtual object, the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object is overlapped with the at least one target geometric area corresponding to the pathfinding graph of the second sub-virtual object to obtain the game scene, wherein the first sub-virtual object and the second sub-virtual object are any two sub-virtual objects among the multiple sub-virtual objects, and the association relationship is used to indicate that the virtual game character is allowed to find a path between the terrain of the first sub-virtual object and the terrain of the second sub-virtual object.
9. The method according to claim 8, characterized in that Overlapping the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object with the at least one target geometric area corresponding to the pathfinding graph of the second sub-virtual object to obtain the game scene includes: Determining, in the pathfinding graph of the first sub-virtual object, at least one first sub-pathfinding graph corresponding to the at least one target geometric area; Determining, in the pathfinding graph of the second virtual sub-object, at least one second sub-pathfinding graph corresponding to the at least one target geometric area; Overlapping the at least one first sub-pathfinding graph and the at least one second sub-pathfinding graph to obtain a target pathfinding graph, wherein the pathfinding graph is within an area defined by the plurality of reference lines; The game scene is generated based on the target path-finding graph.
10. The method according to claim 8, characterized in that The method further comprises: Determining, based on a first current position in world space of the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object and a second current position in the world space of the at least one target geometric area corresponding to the pathfinding graph of the second sub-virtual object, orientation adjustment information for the second sub-virtual object in the world space, wherein the first current position and the second current position are randomly determined positions, and the orientation adjustment information is used to indicate information for adjusting the position of the second sub-virtual object in the world space and / or information for adjusting the orientation of the second sub-virtual object in the world space; Based on the orientation adjustment information, the current orientation of the second sub-virtual object in the world space is adjusted so that the at least one target geometric area corresponding to the pathfinding graph of the first sub-virtual object coincides with the at least one target geometric area corresponding to the adjusted pathfinding graph of the second sub-virtual object.
11. The method according to claim 8, characterized in that The method further comprises: The first sub-virtual object and the second sub-virtual object, as well as the association relationship, are read in a configuration relationship table, wherein the configuration relationship table includes identifiers of the multiple sub-virtual objects and includes an association relationship between every two sub-virtual objects among the multiple sub-virtual objects, and the association relationship between every two sub-virtual objects is used to indicate that the virtual game character is allowed to find a path between the terrains of every two sub-virtual objects.
12. The method according to any one of claims 1 to 11, characterized in that Get the pathfinding graphs of multiple sub-virtual objects separately, including: generating pathfinding resources for each sub-virtual object based on the terrain resources of each sub-virtual object; Based on the pathfinding resources of each sub-virtual object, the pathfinding graph of each sub-virtual object is generated, wherein the pathfinding graph is composed of polygonal patches of each sub-virtual object.
13. A device for generating a game scene, characterized in that: include: an acquisition unit, configured to respectively acquire pathfinding graphs of a plurality of sub-virtual objects, wherein the pathfinding graphs are used to guide a virtual game character to find a path on a terrain corresponding to the sub-virtual objects, the sub-virtual objects comprising terrain resources and pathfinding resources, the terrain resources being used to represent a terrain style of a game scene, and the pathfinding resources being used to represent at least one of the following: a scene structure of the game scene, information about obstacles, and information about feasible areas; a first determining unit, configured to determine a plurality of baselines of a pathfinding graph for each sub-virtual object, wherein the baselines are used to enable the virtual game character to pathfind from a terrain of each sub-virtual object to a terrain of a sub-virtual object other than the sub-virtual object among the plurality of sub-virtual objects; a second determining unit, configured to determine at least one target geometric area in the pathfinding graph based on the plurality of reference lines; The splicing unit is used to splice the multiple sub-virtual objects according to the at least one target geometric area corresponding to each sub-virtual object to obtain a game scene, wherein the virtual game character finds a path on the terrain of the game scene.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 12 when executed by a processor.
15. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Game scene generation method, device, computer readable medium and electronic equipment
CN111135574A