Game scene loading method, device, storage medium and equipment
By dividing scene blocks of different size levels in game scene loading and loading according to player position and perspective priority, the problems of long loading time and empty view are solved, and faster scene loading and better gaming experience are achieved.
Patent Information
- Application Number
- CN202211498007.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-25
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-11-25
AI Technical Summary
The existing game scene loading methods have problems with long loading time and empty vision, especially when non-essential content is loaded during scene jump.
By obtaining the bounding box and size of the game scene elements, dividing scene blocks of different size levels, and loading scene elements according to the player's position and perspective priority. Multiple division and intersection judgment methods are used to prioritize the loading of scene elements close to the player and within the target perspective.
Shorten the loading time of the game scene, avoid empty vision, and improve the gaming experience.
Smart Images

Figure CN115708958B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method, device, storage medium and equipment for loading game scenes. Background Art
[0002] With the continuous development of game technology, the display of game interfaces is becoming more and more refined, and the display of game scenes is also more realistic, enabling players to experience the visual impact brought by the game immersive, greatly improving the realism and experience of the game.
[0003] Currently, for the loading of game scenes, most use native scene loading without a strict loading time sequence; during the process of scene transition, full-scale loading of scene objects is performed, and there may be situations where the transition takes too long or non-essential content is preferentially loaded. This scene loading method not only requires a large amount of time to implement scene loading, but may also have the problem of a blank field of view during the transition. Summary of the Invention
[0004] Based on this, the present invention provides a method, device, storage medium and equipment for loading game scenes, which can shorten the time for loading game scenes and also avoid the occurrence of a blank field of view.
[0005] In a first aspect, the present invention provides a method for loading a game scene, including:
[0006] Obtain all scene elements in the game scene to be loaded and the initial position of the player;
[0007] Determine the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element;
[0008] Form the bounding box of the game scene to be loaded by combining all the scene element bounding boxes;
[0009] Divide the scene elements into different scene element size levels according to the size of the scene elements, and obtain the scene block size levels according to the scene element size levels, where the scene element size levels and the scene block size levels correspond one by one;
[0010] Divide the bounding box of the game scene to be loaded multiple times according to the scene block size levels, each division is performed according to the same size level, and at least one scene block bounding box is generated each time, and the sizes of the scene block bounding boxes generated each time are the same;
[0011] For the scene elements of the same scene element size level, determine whether the scene element bounding box of the scene elements of this scene element size level intersects with the scene block bounding boxes divided according to the corresponding scene block size level according to the size of the scene elements, the position of the scene elements, the scene block size level, and the position of the scene block;
[0012] If so, the scene block contains the scene element;
[0013] For the scene blocks divided by each scene block size level, with the scene block where the initial position is located as the center, the game scene to be loaded is divided into several loading levels. Taking the loading level of the scene block where the initial position is located as the starting loading level, the scene elements included in each scene block are loaded according to the loading level.
[0014] In a second aspect, the present invention provides a game scene loading device, including:
[0015] A scene acquisition module, configured to acquire all scene elements in the game scene to be loaded and the initial position of the player;
[0016] A size calculation module, configured to determine the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element;
[0017] A scene bounding box determination module, configured to form the bounding box of the game scene to be loaded by all the scene element bounding boxes;
[0018] A level division module, configured to divide the scene elements into different scene element size levels according to the size of the scene elements, and obtain the size levels of the scene blocks according to the scene element size levels, where the scene element size levels and the size levels of the scene blocks are in one-to-one correspondence;
[0019] A scene block division module, configured to divide the bounding box of the game scene to be loaded multiple times according to the scene size levels. Each division is performed according to the same size level, and at least one scene block bounding box is generated each time, and the sizes of the scene block bounding boxes generated each time are the same;
[0020] A scene block - element division module, configured to determine whether the bounding box of the scene elements of the same scene element size level intersects with the bounding box of the scene blocks divided according to the scene block size level according to the size of the scene elements, the position of the scene elements, the scene block size level, and the position of the scene blocks; if so, the scene block contains the scene element;
[0021] A scene element loading module, configured to divide the game scene to be loaded into several loading levels with the scene block where the initial position is located as the center for the scene blocks divided by each scene block size level. Taking the loading level of the scene block where the initial position is located as the starting loading level, the scene elements included in each scene block are loaded according to the loading level.
[0022] In a third aspect, the present invention provides a computer - readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the game scene loading methods in the first aspect are implemented.
[0023] In a fourth aspect, the present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it executes any one of the game scene loading methods in the first aspect.
[0024] The beneficial effects of adopting the above technical solution are as follows: According to the player's position, loading level, target perspective, and the size of the scene block, the present application loads the game scene according to different priorities, can load the scene closer to the player and within the target perspective faster, shorten the scene loading time, and avoid the situation of a blank field of view during the jump process of the player. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.
[0026] Figure 1 Schematic diagram of the game scene loading method in an embodiment of the present application;
[0027] Figure 2 Schematic diagram of the bounding box of scene elements in the game scene in an embodiment of the present application;
[0028] Figure 3 Schematic diagram of the loading level of the scene block in an embodiment of the present application; <s
[0029] Figure 4 Schematic diagram of the player's target perspective in an embodiment of the present application;
[0030] Figure 5 Schematic diagram of the loading level of the scene block after the player's position moves in an embodiment of the present application;
[0031] Figure 6 Schematic diagram of the game scene loading device in an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. In order to more specifically illustrate the present invention, the following will be specifically described with reference to the accompanying drawings provided by the present invention.
[0033] With the continuous development of game technology, during the game process, it is necessary to continuously load the game scene so that the game scene can jump as the game character moves, bringing a visual impact to the player to experience the game immersive; during the existing game scene jump, a full amount of scene elements are loaded, and the whole process takes a long time. However, most of the loaded scene elements are not needed after the scene jump, and loading a large number of scene elements is likely to cause problems such as too long jump or a blank field of view during the jump process.
[0034] The embodiment of the present application provides a specific application scenario of the game scene loading method. The application scenario includes a terminal device with a display screen provided by the embodiment, and the terminal device includes but is not limited to a smart phone and a computer device, where the computer device can be at least one of devices such as a desktop computer, a portable computer, a laptop computer, a tablet computer, etc. The user operates the terminal device, and the terminal device executes the scene loading method of the present invention and displays the loaded scene interface on the display screen. For the specific process, please refer to the embodiment of the scene loading method.
[0035] Based on this, the embodiment of the present invention provides a game scene loading method. Taking the method applied to a terminal device as an example for illustration, combined with the Figure 1 schematic diagram of the game scene loading method shown in the attached drawings.
[0036] Step S101: Obtain all scene elements in the game scene to be loaded and the initial position of the player.
[0037] A large number of scene elements in the game scene to be loaded, such as buildings appearing in the game scene, trees by the roadside, street furnishings, and even grass on the ground, all belong to the scene elements in the game scene to be loaded. The sizes and positions of each scene element to be loaded are different.
[0038] The initial position of the player can be determined according to the setting of the camera in the specific game perspective. In the game scene of the first-person perspective, the camera is placed inside the player-controlled character, and the field of view range is generally in front of the controlled character, with a relatively narrow field of view range and a strong game immersion. In the game scene of the third-person perspective, the camera is placed behind the player-controlled character, and the field of view range is generally around the controlled character, with a relatively wide field of view range. In the embodiment of the present invention, the specific placement position of the camera is not distinguished, and the coordinate position where the player is located at the start time of the game is used as the initial position of the player.
[0039] Step S102: Determine the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element.
[0040] Specifically, in the embodiments of the present invention, the size of the bounding box of the scene element is used as a measure of the size of the scene element. The steps of representing the size of the scene element according to the size of the bounding box of the scene element are as follows:
[0041] Step S201: According to the coordinate values of all vertices of the scene element, filter the maximum coordinate value and the minimum coordinate value in each dimension;
[0042] Step S202: Calculate the difference between the maximum coordinate value and the minimum coordinate value in each dimension to obtain the size of the bounding box of the scene element;
[0043] Step S203: Calculate the size of the scene element according to the size of the bounding box of the scene element.
[0044] Taking the scene element as a three-dimensional element as an example, in combination with the attached Figure 2 As shown, this scene element is composed of multiple vertices connected to form triangular faces. Without considering the vertex connection, the vertex coordinate values of this scene element are obtained, which are vertex A(-1, 1, 0), vertex B(0, -1, 0), and vertex C(1, 0.5, 0) respectively; filter the maximum coordinate value of the X-axis 1, the minimum coordinate value of the X-axis -1, the maximum coordinate value of the Y-axis 1, the minimum coordinate value of the Y-axis -1, the maximum coordinate value of the Z-axis 0, and the minimum coordinate value of the Z-axis 0 of the scene element, and record the maximum coordinate of this scene element as (1, 1, 0) and the minimum coordinate of this scene element as (-1, -1, 0); calculate the difference between the maximum coordinate value and the minimum coordinate value in each dimension to obtain the size of the bounding box of the scene element as (2, 2, 0); and the modulus of the size of the bounding box of the scene element is the size of the scene element, and the size of this scene element is 2.
[0045] Step S103: Combine all the bounding boxes of the scene elements to form the bounding box of the game scene to be loaded.
[0046] Since the bounding box of the scene element can be obtained through the vertices of the scene element, and the scene elements are distributed in various regions of the game scene to be loaded, all the bounding boxes of the scene elements can be used to form a larger bounding box to represent the volume of the game scene to be loaded.
[0047] Step S104: According to the size of the scene element, divide the scene elements into different scene element size levels, and obtain the scene block size levels according to the scene element size levels, and the scene element size levels correspond one-to-one with the size levels of the scene blocks.
[0048] Specifically, according to the size range of the scene elements, N levels of scene element size levels are divided in a descending order, and the scene elements are divided into different scene element size levels; and based on the N levels of scene element size levels, N levels of scene block size levels are correspondingly set. For example, according to the size range of the scene elements, three scene element size levels are divided, namely large, medium, and small; according to the specific sizes of the respective scene elements, the scene elements are divided into three scene element size levels; and based on the three scene element size levels, three levels of scene block sizes are correspondingly set, namely huge, medium, and small. Then the scene elements with relatively larger sizes will be divided into the large scene element size level, and the large scene element size level corresponds to the huge-level scene block size level.
[0049] Step S105: The bounding box of the game scene to be loaded is divided multiple times according to the scene block size levels. Each division is performed according to the same size level, and at least one scene block bounding box is generated each time, and the sizes of the scene block bounding boxes generated each time are the same.
[0050] For example, there are three scene block size levels, namely huge, medium, and small. The huge scene block size level is 80*80, the medium scene block size level is 40*40, and the small scene block size level is 20*20. The bounding box of the game scene to be loaded is divided multiple times according to the above three scene block size levels to obtain the bounding boxes of at least one scene block. When the bounding box of the game scene to be loaded is divided according to the huge scene block size level, the obtained scene block bounding boxes are all 80*80; when the bounding box of the game scene to be loaded is divided according to the medium scene block size level, the obtained scene block bounding boxes are all 40*40; when the bounding box of the game scene to be loaded is divided according to the small scene block size level, the obtained scene block bounding boxes are all 20*20.
[0051] Step S106: For the scene elements of the same scene element size level, determine whether the bounding box of the scene elements of this scene element size level intersects with the scene block bounding boxes divided according to the corresponding scene block size level according to the size of the scene elements, the position of the scene elements, the scene block size, and the position of the scene block. If so, the scene block contains the scene element.
[0052] Among them, the loading of the scene elements in the scene blocks divided by each scene block size level is loaded in parallel at different frequencies.
[0053] For example, the game scene to be loaded includes several grass, several boxes, and several buildings. The size of one grass is 2, the size of one box is 25, and the size of one building is 80. According to the size ranges of the above scene elements, three scene element size levels are divided as (0, 20, 40), where [0, 20] is the size range of the small-size scene element level, [20, 40] is the size range of the medium-size scene element level, and [40, +∞) is the size range of the large-size scene element level; the corresponding scene block levels for the above scene element size levels are (20, 40, 80). The size level of the small scene block corresponding to the small-size scene element level is 20*20, the size level of the medium scene block corresponding to the medium-size scene element level is 40*40, and the size level of the large scene block corresponding to the large-size scene element level is 80*80; then the size level of the scene block corresponding to one grass is 20*20, the size level of the scene block corresponding to one box is 40*40, and the size level of the scene block corresponding to one building is 80*80.
[0054] For the scene elements of the small-size scene element level, according to the size of the scene element (for example, the size of one grass is 2), the position coordinates of the scene element, the size level of the scene block (specifically 20*20), and the position coordinates of the scene block, determine whether the bounding box of the scene element of this scene element size level intersects with the bounding box of the scene block divided by this small scene block size level. If so, this scene block contains this scene element.
[0055] And so on, for the scene elements of the medium-size scene element level, according to the size of the scene element (for example, the size of one box is 25), the position coordinates of the scene element, the size level of the scene block (specifically 40*40), and the position coordinates of the scene block, determine whether the bounding box of the scene element of this scene element size level intersects with the bounding box of the scene block divided by this medium scene block size level. If so, this scene block contains this scene element.
[0056] For the scene elements of the large-size scene element level, according to the size of the scene element (for example, the size of one building is 80), the position coordinates of the scene element, the size level of the scene block (specifically 80*80), and the position coordinates of the scene block, determine whether the bounding box of the scene element of this scene element size level intersects with the bounding box of the scene block divided by this large scene block size level. If so, this scene block contains this scene element.
[0057] Further, since large-scale scene elements generally do not change significantly during scene loading, while small-scale scene elements change significantly in the surrounding field of view, setting different loading frequencies according to the size of the loaded scene elements can reduce unnecessary loading of game scene elements while maintaining the display quality of the game scene. Specifically, the loading frequency of the scene elements included in the large-size level scene block is 30 FPS, the loading frequency of the scene elements included in the medium-size level scene block is 40 FPS, and the loading frequency of the scene elements included in the small-size level scene block is 60 FPS. The loading frequencies of the three size-level scene blocks are different, and the three size-level scene blocks can be set to be loaded in parallel without affecting each other.
[0058] Step S107: For the scene blocks divided by each scene block size level, with the scene block where the initial position is located as the center, divide the game scene to be loaded into several loading levels, and use the loading level of the scene block where the initial position is located as the starting loading level, and load the scene elements included in each scene block according to the loading level.
[0059] As shown in the appendix Figure 3 As shown, use the loading level of the scene block where the player's initial position is located as the starting loading level, denoted as LoadLevel 0, the loading level of the scene blocks in a circle around the central scene block is denoted as LoadLevel 1, and the loading level of the scene blocks in the next outer circle is denoted as LoadLevel2. During scene loading, first load the scene elements of the LoadLevel 0 scene block, then load the scene elements of the LoadLevel 1 scene block, and then load the scene elements of the LoadLevel2 scene block. That is to say, during scene element loading, with the scene block where the player's initial position is located as the center, load outward continuously in turn to ensure that the scene where the player is located and its surroundings are preferentially loaded.
[0060] The embodiment of the present invention performs scene loading according to different priorities based on the player's position, loading level, the size of the scene elements appearing in the scene, and the size of the scene block, can load the scene elements that change relatively fast, and at the same time load the scene elements closer to the player faster, reduce the loading of unnecessary scene elements, shorten the game scene loading time, and avoid the situation of empty field of view during the player's jump.
[0061] The above embodiment of the present application is for setting the priority of scene element loading in a general game scene, but during the scene element loading process, it will also be affected by the player's position movement and the player's perspective. The further improved embodiments for this part are as follows:
[0062] Combined with the appendix Figure 4 , for the influence of the player's perspective, the game scene loading method further includes:
[0063] Step S301: Obtain the target perspective of the player.
[0064] In the embodiment of the present invention, the perspective of the camera is used as the target perspective of the player. Taking Unity as an example, the three-dimensional vector of the player's target perspective is obtained by calling Camera.transform.forward.
[0065] Step S302: In the same loading level, preferentially load the scene elements included in the scene blocks within the target perspective.
[0066] Starting from the scene block where the player is located and with the player's target perspective as the direction, as shown by the arrow in the attachment, the direction of the arrow is the direction of the player's target perspective. In each loading level, preferentially load the scene blocks in the direction of the player's target perspective, and then start polling to load the surrounding scene blocks. Figure 4 The above setting realizes loading according to the player's target perspective and there is no setting of pre-loading. Considering that in an actual game, the player's target perspective and position may change at any time, it only ensures that within the same loading level, the scene elements within the target perspective are preferentially loaded to better avoid the visual blank during the game process.
[0067] For example, the fixed loading order of the game is from north to south. However, when the player quickly rotates the perspective to the south after entering the scene, if loaded according to the fixed loading order, there will inevitably be many visual flaws. However, under the adjustment of the above solution, on the basis of the fixed loading order, the scene elements within the player's target perspective can be preferentially loaded to reduce the occurrence of visual flaws. Another example is that the small-sized scene elements in the scene to be loaded need to be loaded more times because the corresponding scene block size is smaller and are relatively updated slower. In the case of preferentially loading within the target perspective, the small-sized scene elements within the player's target perspective can appear faster, which is beneficial to improving the player's gaming experience.
[0068] Regarding the influence of the player's position movement, this game scene loading method further includes:
[0069] Step S401: When the player's position moves, determine whether the scene block where the player is located has changed.
[0070] [[ID=B]]
[0071] Step S402: If the scene block where the player is located has changed, obtain the code of the scene block where the player is located after moving.
[0072] Among them, the code of the scene block includes a horizontal code and a vertical code.
[0073] Step S403: Calculate the difference between the code of the scene block where the player is located after moving and the code of the scene block where the player's initial position is located.
[0074] Step S404: Perform a translation adjustment on the loading level according to the difference.
[0075] Specifically, the size of the scene block where the player is located is m, and the player's position moves. When the scene block where the player is located changes, for example, the code of the scene block where the player's initial position (x1, y1) is located is (a1, b1), and the code of the scene block where the player is located after moving (x2, y2) is (a2, b2). Among them, the code of the scene block is obtained by rounding up the division of the player's position coordinates by the size of the scene block where they are located; calculate and compare |a1 - a2| and |b1 - b2|, and select the maximum value of |a1 - a2| and |b1 - b2| as the difference. Perform a subtraction operation on the difference and the original scene block loading level to obtain the translated and adjusted loading level.
[0076] For example, when the player's position moves, it is judged that the scene block where the player is located has changed, in combination with Attachment Figure 3 and Attachment Figure 5 , where Attachment Figure 3 represents the loading level of the scene block at the player's initial position, and Attachment Figure 5 represents the loading level of the scene block after the player's position moves; taking the first point at the lower left corner of the map as (0, 0), the player's initial position is (50, 50), the player's position after moving is (70, 50), the size of the scene block where the player is located is 20, and the code of the scene block where the player's initial position is located is
[0077] [50 / 2, 50 / 2], that is, (3, 3), and the code of the scene block where the player is located after moving is
[0078] [70 / 20, 50 / 20], that is, (4, 3); that is to say, the scene block where the player is located moves from the scene block in the third row and third column to the scene block in the fourth row and third column. Then calculate the difference in the scene block code as 1, and perform a translation adjustment on the loading level according to the difference. That is, before the player's position moves, take the loading level of the scene block with the code (3, 3) as LoadLevel0, and the loading levels of the first circle of scene blocks extended around are LoadLevel 1, and the loading levels of the second circle of scene blocks extended around are LoadLevel2; after the player's position moves, perform a translation adjustment on the loading level according to the difference of 1. Take the loading level of the scene block with the code (4, 3) as LoadLevel 0, then the loading level of the scene block with the code (3, 3) is LoadLevel|0 - 1|, that is, LoadLevel 1, and the translated loading levels of other scene blocks can be obtained by analogy.
[0079] The above game scene loading method is faster than the general game scene reading speed, accelerating the scene loading speed, enhancing the game experience, reducing the visual blank, and reducing the pressure on the game scene loading when the grading is reasonable and the number of scene blocks is reasonable.
[0080] It should be understood that although each step in the attached Figure 1 flowchart is shown in sequence according to the arrow indication, these steps are not necessarily executed in the order indicated by the arrow. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the attached Figure 1 can include multiple sub-steps or sub-stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0081] In the above embodiments disclosed in the present invention, the scene loading method is described in detail. For the above method disclosed in the present invention, it can be implemented by various forms of devices. Therefore, the present invention also discloses a game scene loading device corresponding to the above method. Combining the attached Figure 6 , specific embodiments are given below for detailed description.
[0082] A scene acquisition module 601 is used to acquire all scene elements in the game scene to be loaded and the initial position of the player.
[0083] A size calculation module 602 is used to determine the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element.
[0084] A scene bounding box determination module 603 is used to form the bounding box of the game scene to be loaded by combining all the scene element bounding boxes.
[0085] A level division module 604 is used to divide the scene elements into different scene element size levels according to the size of the scene elements, and obtain the size levels of the scene blocks according to the scene element size levels, and the scene element size levels correspond one-to-one with the size levels of the scene blocks.
[0086] A scene block division module 605 is used to divide the bounding box of the game scene to be loaded multiple times according to the scene size levels. Each division is performed according to the same size level, and at least one scene block bounding box is generated each time, and the sizes of the scene block bounding boxes generated each time are the same.
[0087] A scene block - element division module 606, configured to, for scene elements of the same scene - element size level, determine whether the bounding box of the scene elements of this scene - element size level intersects with the bounding box of the scene blocks divided according to the scene - block size level, based on the size of the scene elements, the position of the scene elements, the scene - block size level, and the position of the scene blocks; if so, the scene block contains the scene elements.
[0088] A scene - element loading module 607, configured to, for the scene blocks divided according to each scene - block size level, with the scene block where the initial position is located as the center, divide the game scene to be loaded into several loading levels, and starting from the loading level of the scene block where the initial position is located, load the scene elements included in each scene block according to the loading level.
[0089] Further, when the player's perspective changes, the game - scene loading device further includes:
[0090] A perspective - acquisition module, configured to acquire the target perspective of the player.
[0091] A perspective - loading module, configured to, within the same loading level, preferentially load the scene elements included in the scene blocks within the target perspective.
[0092] In addition, when the player's position changes, the game - scene loading device further includes:
[0093] A scene - block change - judgment module, configured to, when the player's position moves, judge whether the scene block where the player is located changes;
[0094] An encoding - acquisition module, configured to, if the scene block where the player is located changes, acquire the encoding of the scene block where the player is located after moving;
[0095] A difference - calculation module, configured to calculate the difference between the encoding of the scene block where the player is located after moving and the encoding of the scene block where the player's initial position is located;
[0096] A loading - level adjustment module, configured to perform a translation adjustment on the loading level according to the difference.
[0097] For the specific limitations of the game - scene loading device, reference can be made to the limitations on the method in the above text, which will not be elaborated here. Each module in the above device can be implemented in whole or in part through software, hardware, and their combination. The above - mentioned modules can be embedded in the processor of the terminal device in hardware form or be independent of it, or can be stored in the memory of the terminal device in software form, so that the processor can call and execute the operations corresponding to the above - mentioned modules.
[0098] In one embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the game scene loading method in the above first aspect are implemented.
[0099] The computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM (erasable programmable read-only memory), a hard disk, or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has a storage space for program codes for executing any method steps in the above method. These program codes can be read out from or written into one or more computer program products, and the program codes can be compressed in a suitable form.
[0100] In one embodiment, the present invention provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the game scene loading method are executed.
[0101] The computer device includes a memory, a processor, and one or more computer programs, where one or more computer programs can be stored in the memory and configured to be executed by one or more processors, and one or more application programs are configured to execute the above game scene loading method.
[0102] The processor may include one or more processing cores. The processor utilizes various interfaces and circuits to connect various parts within the entire computer device. By running or executing instructions, programs, code sets, or instruction sets stored in the memory, and by invoking data stored in the memory, it performs various functions of the computer device and processes data. Optionally, the processor may be implemented in at least one of the hardware forms of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor may integrate one or a combination of several of the central processing unit (CPU), the reporting validator for buried point data (Graphics Processing Unit, GPU), and the modem, etc. Among them, the CPU mainly processes the operating system, user interface, application programs, etc.; the GPU is responsible for rendering and drawing the displayed content; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor and may be implemented separately through a communication chip.
[0103] The memory may include random access memory (RAM) and may also include read-only memory. The memory can be used to store instructions, programs, code, code sets, or instruction sets. The memory may include a program storage area and a data storage area. Among them, the program storage area may store instructions for implementing the operating system, instructions for implementing at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created during the use of the terminal device.
[0104] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for loading a game scene, characterized in that, Including: Obtain all scene elements in the scene to be loaded in the game and the initial position of the player; Determine the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element; Form the bounding box of the scene to be loaded in the game by combining all the scene element bounding boxes; Divide the scene elements into different scene element size levels according to the size of the scene elements, and obtain the scene block size levels according to the scene element size levels, where the scene element size levels and the scene block size levels correspond one by one; Divide the bounding box of the scene to be loaded in the game multiple times according to the scene block size levels, each division is performed according to the same size level, and at least one scene block bounding box is generated each time, and the sizes of the scene block bounding boxes generated each time are the same; For the scene elements of the same scene element size level, determine whether the scene element bounding box of the scene elements of this scene element size level intersects with the scene block bounding boxes divided by the corresponding scene block size level according to the size of the scene elements, the position of the scene elements, the scene block size level, and the position of the scene block; If so, the scene block contains the scene element; For the scene blocks divided by each scene block size level, with the scene block where the initial position is located as the center, divide the scene to be loaded in the game into several loading levels, and use the loading level of the scene block where the initial position is located as the starting loading level, and load the scene elements included in each scene block according to the loading level.
2. The game scene loading method according to claim 1, wherein, Also including: The scene elements in the scene blocks divided by each scene block size level are loaded in parallel at different frequencies.
3. The game scene loading method according to claim 1, characterized in that Also including: Obtain the target perspective of the player; In the same loading level, preferentially load the scene elements included in the scene blocks within the target perspective.
4. The game scene loading method according to claim 3, wherein, Also including: When the position of the player changes, determine whether the scene block where the player is located changes; If the scene block where the player is located changes, obtain the code of the scene block where the player is located after moving; Calculate the difference between the code of the scene block where the player is located after moving and the code of the scene block where the player's initial position is located; Perform a translation adjustment on the loading level according to the difference.
5. The game scene loading method according to claim 1, characterized in that The determining the size of the scene element bounding box and the size of the scene element according to the vertices of each scene element includes: According to the coordinate values of all vertices of the scene element, filter the maximum coordinate value and the minimum coordinate value in each dimension; Calculate the difference between the maximum coordinate value and the minimum coordinate value in each dimension to obtain the size of the scene element bounding box; Calculate the size of the scene element according to the size of the scene element bounding box.
6. A game scene loading device, characterized in that, Including: A scene acquisition module for obtaining all scene elements in the scene to be loaded in the game and the initial position of the player; A size calculation module for determining the scene element bounding box, the size of the scene element bounding box, and the size of the scene element according to the vertices of each scene element; A scene bounding box determination module for forming the bounding box of the scene to be loaded in the game by combining all the scene element bounding boxes; A level division module, configured to divide scene elements into different scene element size levels according to the sizes of the scene elements, and obtain the size levels of scene blocks according to the scene element size levels, where the scene element size levels and the size levels of scene blocks are in one-to-one correspondence; A scene block division module, configured to divide the bounding box of the game scene to be loaded multiple times according to the scene size levels, with each division being performed according to the same size level, and generating at least one scene block bounding box each time, and the sizes of the scene block bounding boxes generated each time being the same; A scene block - element division module, configured to determine whether the bounding box of the scene elements of the same scene element size level intersects with the scene block bounding boxes divided according to the size level of the scene block according to the sizes of the scene elements, the positions of the scene elements, the size level of the scene block, and the position of the scene block; if so, the scene block contains the scene elements; A scene element loading module, configured to divide the game scene to be loaded into several loading levels with the scene block where the initial position is located as the center for the scene blocks divided by each scene block size level, and start loading from the loading level of the scene block where the initial position is located, and load the scene elements contained in each scene block according to the loading level.
7. The game scene loading device according to claim 6, characterized in that, It further includes: A perspective acquisition module, configured to acquire the target perspective of the player; A perspective loading module, configured to preferentially load the scene elements contained in the scene blocks within the target perspective in the same loading level.
8. The game scene loading device according to claim 7, wherein, It further includes: A scene block change judgment module, configured to judge whether the scene block where the player is located has changed when the player's position moves; A center coordinate acquisition module, configured to, if the scene block where the player is located has changed, acquire the code of the scene block where the player is located after moving; A movement value calculation module, configured to calculate the difference between the code of the scene block where the player is located after moving and the code of the scene block where the player's initial position is located; A loading level adjustment module, configured to perform a translation adjustment on the loading level according to the difference.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the game scene loading method according to any one of claims 1 - 5.
10. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it executes the game scene loading method according to any one of claims 1 - 5.
Citation Information
Patent Citations
C3 game map dynamic loading method
CN103257876A
Virtual reality education system and method thereof
CN114675814A