Resource loading method, device and equipment of game map and readable storage medium
Patent Information
- Application Number
- CN202310195639.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-02-22
AI Technical Summary
[0003]在现有技术中,由于游戏地图对应的游戏场景越来越宏大,而导致需加载的游戏资源的资源量越来越大,若想要同时将游戏地图所需的游戏资源全部加载,则需耗费大量的时间,从而导致游戏地图所需的游戏资源的加载效率较低
[0015]本申请实施例中,获取虚拟角色在游戏地图中的角色运动参数,上述游戏地图由多个地图块组成,每一上述地图块的游戏场景对象被划分为多种类型,每一种类型的游戏场景对象配置有一优先级,每一优先级对应设置有一可视范围,优先级越高,可视范围越大,从而通过为不同类型的游戏场景对象配置优先级,以明确不同优先级的游戏场景对象对应的可视范围,进而促使优先级越高的游戏场景对象的资源越先被加载。然后,可基于上述角色运动参数确定上述游戏地图中的待加载的地图块,从而仅需对游戏地图中的待加载的地图块进行资源加载,并确定上述待加载的地图块中的各类型的游戏场景对象对应的可视范围,以基于上述待加载的地图块中的各类型的游戏场景对象对应的可视范围,依次对上述待加载的地图块中的各类型的游戏场景对象进行资源加载,从而针对待加载的地图块中不同类型的游戏场景对象对应的可视范围,可以促使在加载游戏地图中的待加载地图块时优先加载对游戏画面贡献较高的游戏场景对象,优化了游戏地图的加载流程,以提高对游戏地图中需加载的游戏资源的加载效率。
Smart Images

Figure CN116196614B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of resource loading technology, specifically to a method, apparatus, electronic device, and computer-readable storage medium for loading resources for a game map. Background Technology
[0002] The rise of the internet and the continuous development and evolution of hardware and software technologies have spurred the emergence of smart devices and software. Simultaneously, a large number of games of various themes have sprung up to meet user needs, and with the vigorous development of various technologies in the gaming industry, game maps and their corresponding game scenes have become increasingly expansive.
[0003] In existing technologies, as game scenes corresponding to game maps become increasingly large, the amount of game resources that need to be loaded also increases. If all the game resources required for the game map are loaded at the same time, it will take a lot of time, resulting in low loading efficiency of game resources required for the game map. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and computer-readable storage medium for loading resources into a game map, which can improve the loading efficiency of game resources that need to be loaded into the game map.
[0005] In a first aspect, embodiments of this application provide a method for loading resources for a game map, the method comprising:
[0006] Obtain the character movement parameters of the virtual character in the game map. The game map consists of multiple map tiles. The game scene objects of each map tile are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0007] Based on the above character motion parameters, determine the map tiles to be loaded in the above game map, and determine the visible range of each type of game scene object in the above map tiles to be loaded.
[0008] Based on the visible range of each type of game scene object in the map tiles to be loaded, resources are loaded sequentially for each type of game scene object in the map tiles to be loaded.
[0009] Secondly, embodiments of this application also provide a resource loading device for a game map, the device comprising:
[0010] The parameter acquisition module is used to acquire the character movement parameters of the virtual character in the game map. The game map consists of multiple map blocks. The game scene objects of each map block are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0011] The range determination module is used to determine the map tiles to be loaded in the game map based on the above character motion parameters, and to determine the visible range of each type of game scene object in the above map tiles to be loaded.
[0012] The resource loading module is used to load resources for each type of game scene object in the map tile to be loaded, based on the visible range of each type of game scene object in the map tile to be loaded.
[0013] Thirdly, embodiments of this application also provide an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute steps in any of the game map resource loading methods provided in embodiments of this application.
[0014] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the resource loading methods for a game map provided in embodiments of this application.
[0015] In this embodiment, the movement parameters of the virtual character in the game map are obtained. The game map is composed of multiple map blocks. The game scene objects of each map block are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range. By configuring priorities for different types of game scene objects, the visible range corresponding to different priority game scene objects is clarified, thereby prompting the resources of game scene objects with higher priorities to be loaded first. Then, based on the aforementioned character movement parameters, the map tiles to be loaded in the game map can be determined. Thus, only the map tiles to be loaded in the game map need to be loaded with resources, and the visible range corresponding to each type of game scene object in the map tiles to be loaded is determined. Based on the visible range corresponding to each type of game scene object in the map tiles to be loaded, resources are loaded sequentially for each type of game scene object in the map tiles to be loaded. This allows for prioritizing the loading of game scene objects that contribute more to the game screen when loading map tiles to be loaded in the game map, optimizing the game map loading process and improving the loading efficiency of game resources to be loaded in the game map. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the resource loading scene of the game map provided in the embodiments of this application;
[0018] Figure 2 This is a schematic flowchart of one embodiment of the game map resource loading method provided in this application;
[0019] Figure 3 This is a schematic diagram of map tile division provided in the embodiments of this application;
[0020] Figure 4 This is a schematic diagram of the building area provided in the embodiments of this application;
[0021] Figure 5 This is a schematic diagram of a map block to be loaded provided in an embodiment of this application;
[0022] Figure 6 This is another schematic diagram of the map block to be loaded provided in the embodiments of this application;
[0023] Figure 7a This is a schematic diagram of the target map block provided in an embodiment of this application;
[0024] Figure 7b This is a schematic diagram of the filtered target map tiles provided in the embodiments of this application;
[0025] Figure 8 This is a schematic diagram of a parachute test provided in the embodiments of this application;
[0026] Figure 9 This is a schematic diagram of the structure of the resource loading device for the game map provided in this application embodiment;
[0027] Figure 10 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] Before providing a detailed explanation of the embodiments of this application, some terms involved in the embodiments of this application will be explained.
[0030] In the description of the embodiments of this application, the terms "first," "second," etc., may be used herein to describe various concepts, but unless specifically stated otherwise, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. 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 explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0031] This application provides a method, apparatus, electronic device, and computer-readable storage medium for loading resources into a game map. Specifically, the method for loading resources into a game map according to this application can be executed by an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0032] For example, such as Figure 1 As shown, the electronic device is illustrated using terminal 10 as an example. This terminal can obtain the character movement parameters of a virtual character in a game map. The game map consists of multiple map tiles, and the game scene objects in each map tile are divided into multiple types. Each type of game scene object is configured with a priority, and each priority corresponds to a visible range. The higher the priority, the larger the visible range. Based on the character movement parameters, the map tiles to be loaded in the game map are determined, and the visible ranges corresponding to each type of game scene object in the map tiles to be loaded are determined. Based on the visible ranges corresponding to each type of game scene object in the map tiles to be loaded, resources are loaded sequentially for each type of game scene object in the map tiles to be loaded.
[0033] To address the aforementioned issues, this application provides a method, apparatus, electronic device, and computer-readable storage medium for loading resources into a game map, which can improve the loading efficiency of game resources that need to be loaded into the game map.
[0034] The following is a detailed description in conjunction with the accompanying drawings. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown in the drawings.
[0035] In this embodiment, a terminal is used as an example for illustration. This embodiment provides a method for loading resources for a game map, such as... Figure 2 As shown, the specific process of loading resources for this game map can be described as follows:
[0036] 201. Obtain the character movement parameters of the virtual character in the game map. The game map consists of multiple map blocks. The game scene objects of each map block are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0037] In this embodiment, the aforementioned character motion parameters are used to indicate relevant parameters when the virtual character moves within the game map. By obtaining the virtual character's motion parameters within the game map, the movement state of the virtual character within the game map can be clearly determined, thereby facilitating the identification of which map tiles in the game map require resource loading, i.e., which map tiles are within the virtual character's line of sight and can be seen by the virtual character. These character motion parameters include, but are not limited to, character movement speed, character position, and character movement direction.
[0038] Understandably, since the game map requires a large amount of game resources, it would be very time-consuming to calculate and process each game resource one by one. Therefore, in this embodiment, map blocks are introduced to divide the game map into multiple map blocks. The game map is composed of multiple game map blocks to support the block loading of map blocks in the game map.
[0039] Specifically, the terminal can divide the game map into equally sized map tiles, or it can divide the game map into unequal-sized map tiles. For example, as... Figure 3 As shown, in Figure 3 The terminal divides the game map into equally sized map tiles. The specific division can be based on the type of game and related needs. For example, the game map can be divided into a certain number of rectangular map tiles, or it can be divided into a certain number of cubic map tiles in three-dimensional space.
[0040] Among them, since there are many game scene objects in the game map, these game scene objects are the entity units required to make up the game scene, such as stones, grass, trees, rivers, buildings, lights, sound effect balls or vehicles, etc.
[0041] Understandably, because the game map is very large and the size of different game scene objects varies, the virtual character will not see all game scene objects in the game map. For example, the virtual character may be blocked by a game scene object, preventing it from seeing game scene objects behind that object, or the virtual character may be unable to see game scene objects in a distant location due to the distance.
[0042] In this embodiment, the game scene objects in each map tile can be divided into different types by multi-dimensional segmentation. This facilitates configuring different priorities for different types of game scene objects and setting corresponding visible ranges for different priorities. The set visible ranges can also be adjusted to adjust priorities. This allows for delayed loading of game scene objects in a map tile that are not perceived by the virtual character, meaning loading only begins when the virtual character is "about to" see them. Furthermore, game scene objects that contribute significantly to the game's visuals within a map tile can be loaded first, preventing lower-contribution objects from competing for I / O resources, thus optimizing the loading process. Higher priorities indicate greater contribution to the game's visuals, resulting in larger visible ranges and faster loading.
[0043] The aforementioned visible range refers to the area within which a virtual character can see a certain type of game scene object on a certain map tile. In other words, when the virtual character is within this visible range, the corresponding type of game scene object in the map tile to which the visible range belongs needs to be loaded. Furthermore, when the virtual character leaves the visible range, the corresponding type of game scene object in the map tile to which the visible range belongs can be deleted, or the corresponding type of game scene object in the map tile to which the visible range belongs can be placed in a buffer pool so that it can be directly retrieved from the buffer pool when the game scene object needs to be loaded later.
[0044] Specifically, the aforementioned visible range can be a cubic range, i.e., a range composed of length, width, and height; or it can be a spherical range, i.e., a range composed of diameter. The specific range can be set according to the requirements and is not limited here.
[0045] In some embodiments, the aforementioned visible range can be set with the map tile where the game scene object is located as the center.
[0046] For example, if a map tile contains grass, trees, and a building area consisting of multiple building area outline components and multiple building area internal objects, then the grass and trees can be classified as grass vegetation, the multiple building area outline components can be classified as building outline, and the multiple building area internal objects can be classified as building internal objects. This allows for different priorities to be configured for the above three types of game scene objects, and corresponding visible ranges to be set for different priorities.
[0047] Accordingly, when configuring priorities for the three types of game scenes mentioned above, since game scenes have a wide field of view, it's necessary to see grass and trees in the distance. However, since items inside buildings are generally obscured by the building's outer outline, their contribution to the game screen is the lowest. Therefore, grass and vegetation game scene objects contribute more to the screen than building outline game scene objects, which in turn contribute more than building interior game scene objects. In other words, grass and vegetation game scene objects have the highest priority, followed by building outline game scene objects, and then building interior game scene objects have the lowest priority. For example, the terminal might set the visible area for grass and vegetation game scene objects to 700*700*100, the visible area for building outline game scene objects to 300*300*500, and the visible area for building interior game scene objects to 300*300*200.
[0048] Among them, such as Figure 4 As shown, Figure 4 The area shown in region A is the aforementioned building area. Figure 4 The area shown in region B is the outer outline component of the aforementioned building area. Figure 4 The items shown in area C are those inside the aforementioned building area.
[0049] For example, if game scene objects of the same type within a map tile form a game sub-scene (denoted as Level) in one dimension, then the game scene corresponding to that map tile is composed of multiple overlapping Levels in different dimensions. The visible range (denoted as Level Volume Box) corresponding to the priority configured for Levels in different dimensions can be implemented using bounding box technology, such as the AABB bounding box. This bounding box can be used as an attribute of Level. By setting different Level Volume Boxes for Levels in different dimensions, resources of multiple Levels in different dimensions can be loaded sequentially in a corresponding order.
[0050] In some embodiments, the terminal can directly obtain a game map that has been divided into multiple map tiles, and the game scene object of each map tile in the game map has been divided into multiple types, and each type of game scene object is configured with a priority, and each priority is set with a visible range.
[0051] In some embodiments, the terminal can acquire an undivided game map, then scan all game scene objects in the game map, and determine the object type and location of each game scene object in the game map. Then, based on the object type of each game scene object in the game map, the game scene objects are divided into multiple types, and the game map is divided into map tiles of a specific size. Then, the visible range corresponding to the same type of game scene object in the same map tile is set.
[0052] The game map is divided into map blocks, and the size of the blocks can be set according to requirements. For example, an 8000m*8000m 8k map can be divided into 100*100 map blocks.
[0053] 202. Based on the above character motion parameters, determine the map tiles to be loaded in the above game map, and determine the visible range of each type of game scene object in the above map tiles to be loaded.
[0054] The aforementioned map tiles to be loaded are map tiles in the game map that require resource loading, specifically the map tiles corresponding to the game scene that the virtual character can see during its current movement. In this embodiment, the movement state of the virtual character can be predicted using character movement parameters to obtain the map tiles corresponding to the game scene that the virtual character can see in the future, i.e., the aforementioned map tiles to be loaded. Therefore, only map tiles within a small area around the virtual character need to be loaded to meet the virtual character's needs. The terminal can place the identified map tiles to be loaded into a pre-loading pool for resource pre-loading.
[0055] Understandably, by determining the visible range of each type of game scene object in the map tile to be loaded, the terminal can clearly determine at what moment to trigger resource loading for the corresponding type of game scene object in the map tile to be loaded.
[0056] In some embodiments, the character motion parameters include character movement speed, character position, and character movement direction. Determining the map tiles to be loaded in the game map based on the character motion parameters includes: determining the farthest movement distance of the virtual character in the game map based on the character movement speed, and determining the line-of-sight length of the virtual character in the game map based on the farthest movement distance; determining at least two target map tiles within the line-of-sight range of the virtual character in the game map based on the character position, the character movement direction, and the line-of-sight length, and determining the at least two target map tiles as the map tiles to be loaded.
[0057] Wherein, the aforementioned line-of-sight length is the distance between the virtual character and the farthest game scene object seen by the virtual character in the game map.
[0058] Understandably, based on the virtual character's movement speed in the game map, the farthest horizontal movement distance of the virtual character can be determined. Based on this farthest movement distance, the line-of-sight length between the virtual character's current position and the position corresponding to the farthest movement distance can be determined. Thus, starting from the character's position and the direction of the character's movement, the target map tile within the line-of-sight length range, excluding the already loaded map tiles, can be determined. This target map tile is the map tile to be loaded.
[0059] In some embodiments, determining the line-of-sight length of the virtual character in the game map based on the maximum movement distance includes: if the maximum movement distance is greater than a preset maximum loading distance, then the maximum loading distance is determined as the line-of-sight length; if the maximum movement distance is less than the maximum loading distance but greater than a preset minimum loading distance, then the maximum movement distance is determined as the line-of-sight length; if the maximum movement distance is less than the minimum loading distance, then the minimum loading distance is determined as the line-of-sight length. The maximum and minimum loading distances can be set according to requirements, for example, setting the maximum loading distance to 500 and the minimum loading distance to 300.
[0060] For example, such as Figure 7a As shown, if the map tile where the virtual character is located, as well as the map tiles adjacent to the map tile where the virtual character is located, need to be loaded during the map tile loading process, and the virtual character is in... Figure 7a At position A, the minimum loading distance is Figure 7a The maximum loading distance is the distance between positions A and B. Figure 7a The distance between positions A and C, and the maximum movement distance of the virtual character. Figure 7a The distance between positions A and D. By comparison, we know that the distance between positions A and C is less than the distance between positions A and D, meaning the maximum loading distance is less than the maximum movement distance. Therefore, the maximum loading distance needs to be determined as the aforementioned line-of-sight length. The target map tiles within this line-of-sight length, excluding already loaded map tiles, are... Figure 7a The map tile in the shaded area between positions B and C.
[0061] In some embodiments, since the virtual character has a field of view angle during its movement in the game map, that is, the angle corresponding to the line of sight that the virtual character can see in the game map, the map blocks to be loaded can be further limited based on the virtual character's field of view angle, so as to improve the resource loading efficiency of the map blocks required by the virtual character while meeting the needs of the virtual character.
[0062] Specifically, the above-mentioned determination of the map blocks to be loaded in the game map based on the above-mentioned character motion parameters may further include: calculating the field of view angle of the virtual character in the game map based on the above-mentioned line of sight length and the preset minimum loading distance; filtering out target map blocks that are not within the above-mentioned field of view angle and whose relative distance to the virtual character is greater than the above-mentioned minimum loading distance from at least two target map blocks, and determining the filtered target map blocks as the map blocks to be loaded.
[0063] The formula for calculating the field of view angle of the virtual character in the game map is as follows:
[0064] Field of view angle = 2 * tan(minimum loading distance / line of sight length)
[0065] For example, such as Figure 7b As shown above, Figure 7a As shown in the corresponding example, the aforementioned line-of-sight length is the maximum loading distance, i.e., the distance between position A and position C, while the distance between position C and the edge of the character's line of sight is the minimum loading distance. The angle between the edges of the character's line of sight is the field of view angle. Therefore, target map tiles that are not within the aforementioned field of view angle and whose relative distance to the virtual character is greater than the minimum loading distance need to be filtered out. The filtered target map tiles, excluding the already loaded map tiles, within the line-of-sight length range, are... Figure 7b The map tile in the shaded area between positions B and C.
[0066] In some embodiments, there may be scenarios where the virtual character is not within the visible range of various types of game scene objects in the map tiles to be loaded. This can prevent the game resources required for the map tiles from being loaded in a timely manner, thus hindering the rendering of the game scene visible to the virtual character. For example, if the virtual character is currently in a parachute scenario in a battle royale shooting game, the number of map tiles to be loaded increases exponentially when the virtual character enters the game map perpendicular to it. Furthermore, due to the limitations of the mechanical hard drive's I / O performance, the game resources required for the map tiles cannot be loaded in time before the virtual character lands. The terminal can set a maximum loading height. When the virtual character's current height in the game map is less than or equal to this maximum loading height, it is necessary to determine whether the visible range of various types of game scene objects in the map tiles to be loaded needs to be adjusted based on the map tiles to be loaded. This maximum loading height can be set as needed, for example, to 1300.
[0067] For example, such as Figure 5 As shown, when a virtual character moves from map tile a to map tile b in the game map, map tiles c1, d1, and e1 are the aforementioned map tiles to be loaded. And as... Figure 6 As shown, when a virtual character enters the game map in a direction perpendicular to the game map, nine map tiles need to be loaded simultaneously. Figure 6 The nine map tiles in the image are the map tiles to be loaded mentioned above, which is an exponential multiple of the number of map tiles required to be loaded when entering horizontally.
[0068] To address this, the terminal can adjust the visible range of at least one type of game scene object in the map tile to be loaded based on a preset dynamic adjustment strategy. This allows for dynamic loading of the adjusted type of game scene object within the map tile, ensuring the virtual character is within the adjusted visible range. This enables the adjusted type of game scene object to load resources earlier, increasing its resource loading tolerance time and preventing situations where game resources required for the map tile cannot be loaded in time. This avoids situations where the game scene visible to the virtual character cannot be rendered in a timely manner, thus optimizing game performance. For example, the visible range of the adjusted type of game scene object can be adjusted from 300*300*500 to 500*500*1300.
[0069] Specifically, determining the visible range of each type of game scene object in the map block to be loaded may include: obtaining the visible range of each type of game scene object in the map block to be loaded; if the virtual character is not within the visible range of each type of game scene object in the map block to be loaded, then adjusting the visible range of at least one type of game scene object in the map block to include the virtual character.
[0070] Specifically, the adjustment range of the visible range corresponding to the type of game scene object that needs to be adjusted in the map tile to be loaded can be determined based on the character position in the character movement parameters of the virtual character.
[0071] In some embodiments, the above-mentioned adjustment of the visible range of at least one type of game scene object in the map block to be loaded to include the virtual character by means of a dynamic adjustment strategy may include: adjusting the visible range of a preset number of game scene objects of the corresponding type with the highest priority in the map block to be loaded, wherein the preset number may be one, two or more.
[0072] In some embodiments, the map tiles to be loaded in the game map can also be determined based on the scene features in the game map. For example, if the scene features of the game map are complex, that is, the scene is complex and there are a lot of trees, mountains, etc., which cause the virtual character's field of vision to be obstructed by the scene, then the map tile where the virtual character is located and the map tiles adjacent to the map tile where the virtual character is located can be loaded. That is, the map tile where the virtual character is located and the map tiles adjacent to the map tile where the virtual character is located are determined as the map tiles to be loaded. If the scene features of the game map are open, that is, the scene is open and the character's field of vision is far away, then in addition to loading the map tile where the virtual character is located and the map tiles adjacent to the map tile where the virtual character is located, it is also necessary to load map tiles that are farther away from the character's field of vision. That is, the map tile where the virtual character is located, the map tiles adjacent to the map tile where the virtual character is located, and the map tiles that are farther away from the character's field of vision are determined as the map tiles to be loaded.
[0073] In general, map tiles that are further away from the character's line of sight can be replaced with proxy map tiles, which are simplified map tiles, thus reducing the performance pressure on the game. However, for the "telescope" function in the game, such as games equipped with telescopes, where the virtual character can see distant map tiles through the telescope, map tiles within the telescope's field of view need to be loaded to enhance the telescope's performance in order to meet the requirements of scene detail.
[0074] For example, when faced with game maps with complex features, such as Figure 5 As shown, when a virtual character moves from map tile a to map tile b in the game map, map tiles c1, d1, and e1 are the map tiles to be loaded. Map tiles c1, d1, and e1 need to be loaded into the scene. Alternatively, map tiles c, d, and e can be deleted from memory, or they can be placed in a buffer pool so that they can be retrieved directly from the buffer pool when the map tile needs to be loaded later.
[0075] 203. Based on the visible range of each type of game scene object in the above-mentioned map blocks to be loaded, load resources for each type of game scene object in the above-mentioned map blocks to be loaded in sequence.
[0076] In this embodiment, based on the visible range of each type of game scene object in the map block to be loaded, the terminal can load the resources of the corresponding type of game scene object when the virtual character triggers the visible range, thereby realizing the sequential loading of each type of game scene object in the map block to be loaded with a specific priority.
[0077] In some embodiments, the above-mentioned loading of resources for each type of game scene object in the map block to be loaded, based on the visible range corresponding to each type of game scene object in the map block to be loaded, may include: determining the target visible range where the virtual character is currently located based on the visible range corresponding to each type of game scene object in the map block to be loaded, and loading resources for the game scene object to which the target visible range belongs.
[0078] In some embodiments, since the amount of resources required to load when the game map is loaded is very large, in order to avoid a situation where a virtual character has already spawned in a certain map tile in the game map, but the game resources required for that map tile have not been fully loaded, resulting in the inability to render the game scene that the virtual character can see in time, in this embodiment, the terminal can arrange the underlying disk resources to optimize the organization structure of each resource file in the map resource package through resource arrangement, reduce the seek time spent finding the game resources to be loaded, and reduce the I / O time of resource loading.
[0079] Specifically, the above-mentioned sequential loading of resources for each type of game scene object in the map block to be loaded may include: obtaining resource files corresponding to each type of game scene object in the map block to be loaded from at least one preset map resource package, wherein the game map is divided into multiple map regions, each map resource package corresponds to one map region, and the resource files of adjacent game scene objects in each map region are located in adjacent positions in the map resource package corresponding to the map region; and loading resources for each type of game scene object in the map block to be loaded sequentially based on the resource files corresponding to each type of game scene object in the map block to be loaded.
[0080] In this embodiment, the terminal divides the game map into multiple map regions and stores the resource files of each map region in a map resource package. Furthermore, it places the resource files of adjacent game scene objects within each map region in adjacent positions within the map resource package. This ensures that the resource files to be loaded are read sequentially during resource loading, thereby improving resource loading speed. For example, if the terminal is currently reading resources via a hard drive, this improves the read / write speed of the hard drive's tracks.
[0081] Understandably, since a game scene object may have multiple interconnected resource files, such as a stone in a game map, this stone can use the model resource file corresponding to the model resource, the material resource file corresponding to the material resource, and the material resource file can also reference the texture resource file corresponding to the texture resource. Therefore, when storing multiple resource files for a game scene object, the terminal can store these files in adjacent locations within the map resource package. This ensures that related resources are placed in adjacent disk locations as much as possible. This allows for sequential reading of resource files when loading various types of game scene objects within the map tiles to be loaded, significantly reducing seek time compared to random access.
[0082] Specifically, the aforementioned map resource package can adopt an MPK package body, which is a large file package body formed by splicing together multiple small files.
[0083] In some embodiments, before obtaining the resource files corresponding to each type of game scene object in the map block to be loaded from at least one preset map resource package, the resource files corresponding to each game scene object in the game map need to be stored in the map resource package.
[0084] Specifically, the resource file storage process may include: traversing each game scene object in each of the aforementioned map regions to obtain the file storage path of the resource files used by each game scene object in each of the aforementioned map regions, and obtaining the resource files used by each game scene object based on the file storage path. Then, the resource files used by the traversed game scene objects are stored in the map resource package corresponding to the map region where the traversed game scene object is located; if a target resource file is used by at least two target game scene objects, then the target resource file is stored in the map resource package corresponding to the map region where the first traversed target game scene object is located.
[0085] In the process of traversing each game scene object in the above map area, the traversal can be performed sequentially based on the position of each game scene object in the map area, so that the resource files used by adjacent game scene objects can be stored in adjacent positions in a map resource package.
[0086] For example, the terminal can equally divide an 8K large map into 8 map regions, each region being 2000m*2000m in size. It can then traverse each game scene object within these 8 map regions to obtain the resource files used by each game scene object, such as model resource files, material resource files, and sound effect resource files. These resource files are then stored in the map resource package corresponding to the map region where the traversed game scene object is located, resulting in 8 map resource packages. If a resource file is used by two game scene objects, and these two game scene objects are, in traversal order, the first game scene object and the second game scene object, then the resource file is stored in the corresponding position within the map resource package corresponding to the map region where the first game scene object is located. This corresponding position is the storage location of the first game scene object within the map resource package.
[0087] For example, the above method can greatly reduce the resource loading time when loading game resources required for the game map, thereby improving the loading efficiency of game resources that need to be loaded in the game map. In this example, parachute tests were conducted in three areas: the apartment, the abandoned station, and the river bend area. Figure 8 As shown, Figure 8 The vertical axis indicates the time required for all game resources to be fully loaded on the game map when the parachute altitude is 300 meters. This time is measured in seconds. Figure 8 The horizontal axis represents the parachute jumping area. Figure 8 The left bar chart for the three maps indicates the loading time before optimization, and the right bar chart indicates the loading time after optimization. Figure 8As can be seen, the above method can greatly reduce the time required for resource loading and improve the efficiency of resource loading.
[0088] As can be seen from the above, by obtaining the character movement parameters of the virtual character in the game map, the game map is composed of multiple map tiles. The game scene objects in each of these map tiles are divided into multiple types, each type of game scene object is configured with a priority, and each priority corresponds to a visible range. The higher the priority, the larger the visible range. Therefore, by configuring priorities for different types of game scene objects, the visible range corresponding to different priorities is clearly defined, thus ensuring that the resources of higher-priority game scene objects are loaded first. Then, based on the aforementioned character movement parameters, the map tiles to be loaded in the game map can be determined, and the visible range corresponding to each type of game scene object in the map tiles to be loaded can be determined. Based on the visible range corresponding to each type of game scene object in the map tiles to be loaded, resources of each type of game scene object in the map tiles to be loaded are loaded sequentially. This allows for prioritizing the loading of game scene objects that contribute more to the game visuals when loading map tiles to be loaded, optimizing the game map loading process and improving the loading efficiency of game resources in the game map.
[0089] To better implement the above methods, this application also provides a resource loading device for a game map. This resource loading device can be integrated into an electronic device, such as a computer device, which can be a terminal, server, or other such device.
[0090] The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0091] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the integration of a game map resource loading device into the terminal as an example. This embodiment provides a game map resource loading device, such as... Figure 9 As shown, the resource loading device for the game map may include:
[0092] The parameter acquisition module 901 is used to acquire the character movement parameters of the virtual character in the game map. The game map is composed of multiple map blocks. The game scene object of each map block is divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0093] The range determination module 902 is used to determine the map tiles to be loaded in the game map based on the above-mentioned character motion parameters, and to determine the visible range of each type of game scene object in the above-mentioned map tiles to be loaded.
[0094] The resource loading module 903 is used to load resources for each type of game scene object in the map block to be loaded in sequence, based on the visible range of each type of game scene object in the map block to be loaded.
[0095] In some embodiments, the aforementioned character motion parameters include character movement speed, character position, and character movement direction, and the aforementioned range determination module 902 is specifically used for:
[0096] Based on the character's movement speed, the farthest movement distance of the virtual character in the game map is determined, and based on the farthest movement distance, the line-of-sight length of the virtual character in the game map is determined.
[0097] Based on the aforementioned character position, the aforementioned character movement direction, and the aforementioned line of sight length, at least two target map tiles within the aforementioned virtual character's line of sight are determined from the aforementioned game map, and these at least two target map tiles are determined as the aforementioned map tiles to be loaded.
[0098] In some embodiments, the range determination module 902 is further specifically used for:
[0099] Based on the aforementioned line-of-sight length and the preset minimum loading distance, the field-of-sight angle of the aforementioned virtual character in the aforementioned game map is calculated;
[0100] From at least two of the aforementioned target map tiles, target map tiles that are not within the aforementioned field of view and whose relative distance to the aforementioned virtual character is greater than the aforementioned minimum loading distance are filtered out, and the filtered target map tiles are determined as the aforementioned map tiles to be loaded.
[0101] In some embodiments, the range determination module 902 is further specifically used for:
[0102] If the maximum moving distance is greater than the preset maximum loading distance, then the maximum loading distance is determined as the line of sight length.
[0103] If the farthest moving distance is less than the maximum loading distance and greater than the preset minimum loading distance, then the farthest moving distance is determined as the line of sight length.
[0104] If the maximum moving distance is less than the minimum loading distance, then the minimum loading distance is determined as the line-of-sight length.
[0105] In some embodiments, the range determination module 902 is specifically used for:
[0106] Obtain the visible range of each type of game scene object in the map tile to be loaded;
[0107] If the aforementioned virtual character is not within the visible range of the various types of game scene objects in the aforementioned map block to be loaded, then the visible range of at least one type of game scene object in the aforementioned map block to be loaded will be adjusted to include the aforementioned virtual character.
[0108] In some embodiments, the resource loading module 903 is specifically used for:
[0109] Based on the visible range of each type of game scene object in the map tiles to be loaded, the target visible range where the virtual character is currently located is determined, and resources are loaded for the game scene objects to which the target visible range belongs.
[0110] In some embodiments, the resource loading module 903 is specifically used for:
[0111] The resource files corresponding to the various types of game scene objects in the map blocks to be loaded are obtained from at least one preset map resource package. The game map is divided into multiple map regions, each map resource package corresponds to one map region, and the resource files of adjacent game scene objects in each map region are located in adjacent positions in the map resource package corresponding to the map region.
[0112] Based on the resource files corresponding to the various types of game scene objects in the map blocks to be loaded, the resources of the various types of game scene objects in the map blocks to be loaded are loaded sequentially.
[0113] In some embodiments, the resource loading device for the game map further includes a file storage module, which is specifically used for:
[0114] Iterate through each game scene object in each of the above map regions and store the resource files used by the iterated game scene objects in the map resource package corresponding to the map region where the iterated game scene objects are located.
[0115] If a target resource file is used by at least two target game scene objects, then the target resource file is stored in the map resource package corresponding to the map region where the first traversed target game scene object is located.
[0116] As can be seen from the above, the resource loading device of the game map in this embodiment obtains the character movement parameters of the virtual character in the game map through the parameter acquisition module 901. The game map is composed of multiple map blocks. The game scene objects of each map block are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range. By configuring priorities for different types of game scene objects, the visible range corresponding to game scene objects with different priorities is clarified, thereby prompting the resources of game scene objects with higher priorities to be loaded first. Then, the range determination module 902 can determine the map tiles to be loaded in the game map based on the aforementioned character movement parameters, and determine the visible range corresponding to each type of game scene object in the map tiles to be loaded. The resource loading module 903 can then load resources for each type of game scene object in the map tiles to be loaded sequentially based on the visible range corresponding to each type of game scene object in the map tiles to be loaded. This allows for prioritizing the loading of game scene objects that contribute more to the game screen when loading map tiles to be loaded in the game map, thus optimizing the game map loading process and improving the loading efficiency of game resources to be loaded in the game map.
[0117] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Figure 10 As shown, Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 100 includes a processor 101 with one or more processing cores, a memory 102 with one or more computer-readable storage media, and a computer program stored on the memory 102 and executable on the processor. The processor 101 and the memory 102 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0118] The processor 101 is the control center of the electronic device 100. It connects various parts of the electronic device 100 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 102, and calling data stored in the memory 102, it performs various functions of the electronic device 100 and processes data, thereby monitoring the electronic device 100 as a whole.
[0119] In this embodiment, the processor 101 in the electronic device 100 loads the instructions corresponding to the processes of one or more applications into the memory 102 according to the following steps, and the processor 101 runs the applications stored in the memory 102 to realize various functions:
[0120] Obtain the character movement parameters of the virtual character in the game map. The game map consists of multiple map tiles. The game scene objects of each map tile are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0121] Based on the above character motion parameters, determine the map tiles to be loaded in the above game map, and determine the visible range of each type of game scene object in the above map tiles to be loaded.
[0122] Based on the visible range of each type of game scene object in the map tiles to be loaded, resources are loaded sequentially for each type of game scene object in the map tiles to be loaded.
[0123] In some embodiments, the character motion parameters include character movement speed, character position, and character movement direction. Determining the map tiles to be loaded in the game map based on the character motion parameters includes:
[0124] Based on the character's movement speed, the farthest movement distance of the virtual character in the game map is determined, and based on the farthest movement distance, the line-of-sight length of the virtual character in the game map is determined.
[0125] Based on the aforementioned character position, the aforementioned character movement direction, and the aforementioned line of sight length, at least two target map tiles within the aforementioned virtual character's line of sight are determined from the aforementioned game map, and these at least two target map tiles are determined as the aforementioned map tiles to be loaded.
[0126] In some embodiments, determining the map tiles to be loaded in the game map based on the character motion parameters further includes:
[0127] Based on the aforementioned line-of-sight length and the preset minimum loading distance, the field-of-sight angle of the aforementioned virtual character in the aforementioned game map is calculated;
[0128] From at least two of the aforementioned target map tiles, target map tiles that are not within the aforementioned field of view and whose relative distance to the aforementioned virtual character is greater than the aforementioned minimum loading distance are filtered out, and the filtered target map tiles are determined as the aforementioned map tiles to be loaded.
[0129] In some embodiments, determining the line-of-sight length of the virtual character in the game map based on the farthest movement distance includes:
[0130] If the maximum moving distance is greater than the preset maximum loading distance, then the maximum loading distance is determined as the line of sight length.
[0131] If the farthest moving distance is less than the maximum loading distance and greater than the preset minimum loading distance, then the farthest moving distance is determined as the line of sight length.
[0132] If the maximum moving distance is less than the minimum loading distance, then the minimum loading distance is determined as the line-of-sight length.
[0133] In some embodiments, determining the visible range corresponding to each type of game scene object in the map tile to be loaded includes:
[0134] Obtain the visible range of each type of game scene object in the map tile to be loaded;
[0135] If the aforementioned virtual character is not within the visible range of the various types of game scene objects in the aforementioned map block to be loaded, then the visible range of at least one type of game scene object in the aforementioned map block to be loaded will be adjusted to include the aforementioned virtual character.
[0136] In some embodiments, the above-mentioned loading of resources for each type of game scene object in the map tile to be loaded, based on the visible range corresponding to each type of game scene object in the map tile to be loaded, includes:
[0137] Based on the visible range of each type of game scene object in the map tiles to be loaded, the target visible range where the virtual character is currently located is determined, and resources are loaded for the game scene objects to which the target visible range belongs.
[0138] In some embodiments, the above-mentioned sequential loading of resources for each type of game scene object in the map tile to be loaded includes:
[0139] The resource files corresponding to the various types of game scene objects in the map blocks to be loaded are obtained from at least one preset map resource package. The game map is divided into multiple map regions, each map resource package corresponds to one map region, and the resource files of adjacent game scene objects in each map region are located in adjacent positions in the map resource package corresponding to the map region.
[0140] Based on the resource files corresponding to the various types of game scene objects in the map blocks to be loaded, the resources of the various types of game scene objects in the map blocks to be loaded are loaded sequentially.
[0141] In some embodiments, before obtaining the resource files corresponding to the various types of game scene objects in the map tiles to be loaded from at least one preset map resource package, the method further includes:
[0142] Iterate through each game scene object in each of the above map regions and store the resource files used by the iterated game scene objects in the map resource package corresponding to the map region where the iterated game scene objects are located.
[0143] If a target resource file is used by at least two target game scene objects, then the target resource file is stored in the map resource package corresponding to the map region where the first traversed target game scene object is located.
[0144] Therefore, the electronic device 100 provided in this embodiment can bring the following technical effects: improve the loading efficiency of game resources that need to be loaded in the game map.
[0145] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0146] Optional, such as Figure 10 As shown, the electronic device 100 also includes: a touch display screen 103, a radio frequency circuit 104, an audio circuit 105, an input unit 106, and a power supply 107. The processor 101 is electrically connected to the touch display screen 103, the radio frequency circuit 104, the audio circuit 105, the input unit 106, and the power supply 107. Those skilled in the art will understand that... Figure 10 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0147] The touch display screen 103 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 103 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 101. It can also receive and execute commands from the processor 101. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 101 to determine the type of touch event. Subsequently, the processor 101 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 103 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 103 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 103 can also be used as part of the input unit 106 to achieve input functions.
[0148] The radio frequency circuit 104 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0149] Audio circuit 105 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuit 105 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 105, converted back into audio data, and then processed by processor 101 before being transmitted via radio frequency circuit 104 to, for example, another electronic device, or output to memory 102 for further processing. Audio circuit 105 may also include an earphone jack to provide communication between peripheral headphones and electronic devices.
[0150] The input unit 106 can be used to receive input numbers, character information or user feature information (such as fingerprints, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0151] Power supply 107 is used to supply power to various components of electronic device 100. Optionally, power supply 107 can be logically connected to processor 101 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 107 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0152] although Figure 10 As not shown in the diagram, the electronic device 100 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0153] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0154] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0155] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute steps in any of the game map resource loading methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0156] Obtain the character movement parameters of the virtual character in the game map. The game map consists of multiple map tiles. The game scene objects of each map tile are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range.
[0157] Based on the above character motion parameters, determine the map tiles to be loaded in the above game map, and determine the visible range of each type of game scene object in the above map tiles to be loaded.
[0158] Based on the visible range of each type of game scene object in the map tiles to be loaded, resources are loaded sequentially for each type of game scene object in the map tiles to be loaded.
[0159] In some embodiments, the character motion parameters include character movement speed, character position, and character movement direction. Determining the map tiles to be loaded in the game map based on the character motion parameters includes:
[0160] Based on the character's movement speed, the farthest movement distance of the virtual character in the game map is determined, and based on the farthest movement distance, the line-of-sight length of the virtual character in the game map is determined.
[0161] Based on the aforementioned character position, the aforementioned character movement direction, and the aforementioned line of sight length, at least two target map tiles within the aforementioned virtual character's line of sight are determined from the aforementioned game map, and these at least two target map tiles are determined as the aforementioned map tiles to be loaded.
[0162] In some embodiments, determining the map tiles to be loaded in the game map based on the character motion parameters further includes:
[0163] Based on the aforementioned line-of-sight length and the preset minimum loading distance, the field-of-sight angle of the aforementioned virtual character in the aforementioned game map is calculated;
[0164] From at least two of the aforementioned target map tiles, target map tiles that are not within the aforementioned field of view and whose relative distance to the aforementioned virtual character is greater than the aforementioned minimum loading distance are filtered out, and the filtered target map tiles are determined as the aforementioned map tiles to be loaded.
[0165] In some embodiments, determining the line-of-sight length of the virtual character in the game map based on the farthest movement distance includes:
[0166] If the maximum moving distance is greater than the preset maximum loading distance, then the maximum loading distance is determined as the line of sight length.
[0167] If the farthest moving distance is less than the maximum loading distance and greater than the preset minimum loading distance, then the farthest moving distance is determined as the line of sight length.
[0168] If the maximum moving distance is less than the minimum loading distance, then the minimum loading distance is determined as the line-of-sight length.
[0169] In some embodiments, determining the visible range corresponding to each type of game scene object in the map tile to be loaded includes:
[0170] Obtain the visible range of each type of game scene object in the map tile to be loaded;
[0171] If the aforementioned virtual character is not within the visible range of the various types of game scene objects in the aforementioned map block to be loaded, then the visible range of at least one type of game scene object in the aforementioned map block to be loaded will be adjusted to include the aforementioned virtual character.
[0172] In some embodiments, the above-mentioned loading of resources for each type of game scene object in the map tile to be loaded, based on the visible range corresponding to each type of game scene object in the map tile to be loaded, includes:
[0173] Based on the visible range of each type of game scene object in the map tiles to be loaded, the target visible range where the virtual character is currently located is determined, and resources are loaded for the game scene objects to which the target visible range belongs.
[0174] In some embodiments, the above-mentioned sequential loading of resources for each type of game scene object in the map tile to be loaded includes:
[0175] The resource files corresponding to the various types of game scene objects in the map blocks to be loaded are obtained from at least one preset map resource package. The game map is divided into multiple map regions, each map resource package corresponds to one map region, and the resource files of adjacent game scene objects in each map region are located in adjacent positions in the map resource package corresponding to the map region.
[0176] Based on the resource files corresponding to the various types of game scene objects in the map blocks to be loaded, the resources of the various types of game scene objects in the map blocks to be loaded are loaded sequentially.
[0177] In some embodiments, before obtaining the resource files corresponding to the various types of game scene objects in the map tiles to be loaded from at least one preset map resource package, the method further includes:
[0178] Iterate through each game scene object in each of the above map regions and store the resource files used by the iterated game scene objects in the map resource package corresponding to the map region where the iterated game scene objects are located.
[0179] If a target resource file is used by at least two target game scene objects, then the target resource file is stored in the map resource package corresponding to the map region where the first traversed target game scene object is located.
[0180] As can be seen, the computer program can be loaded by the processor to execute the steps in any of the game map resource loading methods provided in the embodiments of this application, thereby bringing about the following technical effects: improving the loading efficiency of game resources that need to be loaded in the game map.
[0181] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0182] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0183] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the game map resource loading methods provided in the embodiments of this application, the beneficial effects that any of the game map resource loading methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0184] The resource loading method, apparatus, electronic device, and computer-readable storage medium for a game map provided in the embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for loading resources into a game map, characterized in that, The method includes: The game map is composed of multiple map tiles. The game scene objects of each map tile are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range. The character movement parameters are used to indicate the movement state of the virtual character in the game map. Based on the character's motion parameters, map tiles to be loaded in the game map are determined, and the map tiles to be loaded are those within the virtual character's line of sight. Obtain the visible range of each type of game scene object in the map tile to be loaded; When the character height of the virtual character is less than or equal to the preset maximum loading height, if the virtual character is not within the visible range of each type of game scene object in the map block to be loaded, then based on the character position of the virtual character, the visible range of at least one type of game scene object in the map block to be loaded will be adjusted to include the virtual character. Based on the visible range of each type of game scene object in the map tile to be loaded, resources are loaded sequentially for each type of game scene object in the map tile to be loaded.
2. The resource loading method for a game map as described in claim 1, characterized in that, The character motion parameters include character movement speed, character position, and character movement direction. Determining the map tiles to be loaded in the game map based on the character motion parameters includes: The maximum movement distance of the virtual character in the game map is determined based on the character's movement speed, and the line-of-sight length of the virtual character in the game map is determined based on the maximum movement distance. Based on the character's position, the character's movement direction, and the line of sight length, at least two target map tiles within the virtual character's line of sight are determined from the game map, and these at least two target map tiles are identified as the map tiles to be loaded.
3. The resource loading method for a game map as described in claim 2, characterized in that, The step of determining the map tiles to be loaded in the game map based on the character motion parameters further includes: Based on the line-of-sight length and the preset minimum loading distance, the field-of-sight angle of the virtual character in the game map is calculated; From at least two target map tiles, target map tiles that are not within the field of view and whose relative distance to the virtual character is greater than the minimum loading distance are filtered out, and the filtered target map tiles are determined as the map tiles to be loaded.
4. The resource loading method for a game map as described in claim 2, characterized in that, Determining the line-of-sight length of the virtual character in the game map based on the furthest movement distance includes: If the farthest moving distance is greater than the preset maximum loading distance, then the maximum loading distance is determined as the line-of-sight length; If the farthest moving distance is less than the maximum loading distance and greater than the preset minimum loading distance, then the farthest moving distance is determined as the line of sight length; If the farthest moving distance is less than the minimum loading distance, then the minimum loading distance is determined as the line-of-sight length.
5. The resource loading method for a game map as described in claim 1, characterized in that, The process of loading resources for each type of game scene object in the map tile to be loaded, based on the visible range of each type of game scene object in the map tile to be loaded, includes: Based on the visible range of each type of game scene object in the map tile to be loaded, the target visible range where the virtual character is currently located is determined, and resources are loaded for the game scene object to which the target visible range belongs.
6. The resource loading method for a game map as described in claim 1, characterized in that, The sequential loading of resources for each type of game scene object in the map tile to be loaded includes: The resource files corresponding to various types of game scene objects in the map block to be loaded are obtained from at least one preset map resource package. The game map is divided into multiple map regions, each map resource package corresponds to one map region, and the resource files of adjacent game scene objects in each map region are located in adjacent positions in the map resource package corresponding to the map region. Based on the resource files corresponding to each type of game scene object in the map tile to be loaded, the resources of each type of game scene object in the map tile to be loaded are loaded sequentially.
7. The resource loading method for a game map as described in claim 6, characterized in that, Before obtaining the resource files corresponding to each type of game scene object in the map tile to be loaded from at least one preset map resource package, the method further includes: Traverse each game scene object in each of the map regions and store the resource files used by the traversed game scene objects in the map resource package corresponding to the map region where the traversed game scene objects are located; If a target resource file is used by at least two target game scene objects, then the target resource file is stored in the map resource package corresponding to the map region where the first traversed target game scene object is located.
8. A resource loading device for a game map, characterized in that, The device includes: The parameter acquisition module is used to acquire the character movement parameters of the virtual character in the game map. The game map is composed of multiple map tiles. The game scene objects of each map tile are divided into multiple types. Each type of game scene object is configured with a priority. Each priority corresponds to a visible range. The higher the priority, the larger the visible range. The character movement parameters are used to indicate the movement state of the virtual character in the game map. The range determination module is used to determine the map tiles to be loaded in the game map based on the character's motion parameters, and to obtain the visible range corresponding to each type of game scene object in the map tiles to be loaded; when the character height of the virtual character is less than or equal to the preset maximum loading height, if the virtual character is not within the visible range corresponding to each type of game scene object in the map tiles to be loaded, then based on the character position of the virtual character, the visible range corresponding to at least one type of game scene object in the map tiles to be loaded is adjusted to include the virtual character, and the map tiles to be loaded are map tiles within the line of sight of the virtual character; The resource loading module is used to load resources for each type of game scene object in the map tile to be loaded in sequence, based on the visible range of each type of game scene object in the map tile to be loaded.
9. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps in the resource loading method for a game map as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the resource loading method for a game map according to any one of claims 1 to 7.
Citation Information
Patent Citations
Resource dynamic loading method and terminal
CN106547599A
Object loading method and device in scene, storage medium and electronic equipment
CN111790152A
Resource storage method and device
CN111957051A