Game map rendering method, device and equipment
By dynamically loading and cacheing map resources of the game map, and using map chunking information to optimize the task loading queue, it solves the problem of too long loading of resource maps in game map rendering, and improves game experience and resource utilization efficiency.
Patent Information
- Application Number
- CN202311765538.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2025-01-10
AI Technical Summary
In game development, the rendering of game maps affects the player's gaming experience due to the long loading time of a large number of resource maps.
By creating map configuration information for different regions, dynamically loading and cache map resources based on map chunking information, and optimizing task loading queues using view intersection and correlation to reduce unnecessary map resource loading.
It achieves the ability to ensure smooth operation of players while saving game resources and video memory usage, improving the efficiency of game map rendering and player experience.
Smart Images

Figure CN119280833A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of game development technology, and in particular to a method, device and equipment for rendering a game map. Background Art
[0002] During the game development process, irregular areas on the game map are filled with regional fog according to different gameplay requirements, and the fog in these areas can be dynamically unlocked through player operations.
[0003] As the size of the game map continues to expand, the size of the viewing area in the game has also become very large. Usually, the rendering of the game map can be achieved through resource maps. Considering that resource maps occupy a lot of memory, when players open game maps with different resource requirements, a large number of resource maps in the game map will take a long time to load, affecting the player's gaming experience. Summary of the invention
[0004] In view of this, the present application provides a method and device for rendering a game map, the main purpose of which is to solve the problem that the loading time of a large number of resource maps in the game map of the prior art affects the player's gaming experience.
[0005] According to a first aspect of the present application, a method for rendering a game map is provided, comprising:
[0006] Creating map configuration information for different areas, wherein the map configuration information includes map block information obtained by segmenting the game map;
[0007] In response to an operation instruction of the game map, determining first map block information in the game map according to the map configuration information, wherein the first map block information is map block information having view intersection in the game map;
[0008] Acquire the texture resource of the loaded map block in the task loading queue according to the first map block information, wherein the task loading queue stores the loading task structure of the map block in the game map;
[0009] The game map is rendered using the texture resources of the loaded map blocks.
[0010] Furthermore, the creation of map configuration information for different areas includes:
[0011] Obtaining game maps of different areas, dividing the game maps of the different areas, and obtaining map block information;
[0012] According to the map block information, determine the map identifier to which the map block belongs and the area identifier corresponding to the game map;
[0013] Creating map configuration information for different areas according to the map identifiers to which the map blocks belong and the area identifiers corresponding to the game map;
[0014] Accordingly, in response to the operation instruction of the game map, determining the first map block information in the game map according to the map configuration information includes:
[0015] In response to an operation instruction of the game map, determining map block information covered by the game map according to the map configuration information;
[0016] The first map block information is determined in the game map by performing intersection calculation on the map block information covered by the game map and the view.
[0017] Furthermore, before acquiring the texture resource of the loaded map block in the task loading queue according to the first map block information, the method further includes:
[0018] Obtaining a task loading queue, wherein the task loading queue stores task loading information of a map block, wherein the task loading information includes a sequence number identifier, a tag value, and a loaded texture resource set of the map block;
[0019] The task loading queue is traversed, and the texture resources of the map blocks are loaded according to the traversal results.
[0020] Furthermore, traversing the task loading queue and loading the texture resources of the map blocks according to the traversal results include:
[0021] Traversing the task loading queue, and judging whether there is task loading information of the first map block in the task loading queue according to the traversal result;
[0022] If it does not exist, a thread is called to add a loading task and a task mark of the first map chunk to the task loading queue.
[0023] Further, after responding to the operation instruction of the game map, the method includes:
[0024] Determining second map block information in the game map according to the map configuration information, wherein the second map block information is map block information in the game map within a preset range adjacent to the first map block;
[0025] Accordingly, traversing the task loading queue and loading the texture resources of the map blocks according to the traversal results include:
[0026] Traversing the task loading queue, and judging whether there is task loading information of the second map block in the task loading queue according to the traversal result;
[0027] If it does not exist, a thread is called to add a loading task and a task mark of the second map chunk in the task loading queue.
[0028] Furthermore, before creating the map configuration information of different areas, the method further includes:
[0029] Determine the view information of the game map, wherein the view information includes the size information of the view and the zoom information of the view;
[0030] Determine a map area of the game map displayed in the view according to the size information of the view;
[0031] Determining the map area range of the game map displayed in the view through the zoom operation according to the zoom information of the view;
[0032] Accordingly, after determining the view information of the game map, the method further includes:
[0033] In response to the map area adjustment instruction, adjusting the position of the map area displayed in the view according to the position information carried in the adjustment instruction;
[0034] In response to a zoom instruction for the map area, the range of the map area displayed in the view is adjusted according to size information carried in the zoom instruction.
[0035] Furthermore, after determining the view information of the game map, the method further includes:
[0036] When receiving a view translation operation instruction, the task mark of the map block in the task loading queue is updated according to the map area displayed after the view translation;
[0037] If the task identifier of the updated map block meets the set conditions, the loading task of the map block is deleted to release the texture resources loaded in the map block.
[0038] Furthermore, the rendering of the game map using the texture resources of the loaded map blocks includes:
[0039] Traversing the first map block information to construct vertex data of the first map block;
[0040] Sending vertex data of the first map block to a vertex buffer for binding to a shader;
[0041] A drawing function is called in the shader to render the game map.
[0042] Furthermore, before calling the drawing function in the shader to render the game map, the method further includes:
[0043] Get the index value of the unlocked area in the game map, and pass the index value of the unlocked area as an index array into the shader;
[0044] Correspondingly, calling a drawing function in the shader to render the game map includes:
[0045] Respectively obtain a map texture, a fog texture, and a mask texture from the texture resources of the loaded map blocks;
[0046] Using the current pixel to sample in the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, traversing and determining whether the target area index value to which the current pixel belongs is stored in the index array;
[0047] If it exists, the color information corresponding to the current pixel is obtained by sampling from the map map; otherwise, the color information corresponding to the current pixel is obtained by sampling from the fog map;
[0048] According to the color information corresponding to the current pixel, a drawing function is called in the shader to render the game map.
[0049] Furthermore, before calling a drawing function in the shader to render the game map according to the color information corresponding to the current pixel, the method further includes:
[0050] Obtain the initial index value and fade-out time of the area to be unlocked in the game map, and pass the initial index value and fade-out time into the shader;
[0051] Using the current pixel to sample the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, and determining whether the initial index value is the same as the target area index value to which the current pixel belongs;
[0052] If so, the texture resource to be sampled is determined in the texture resources of the loaded map blocks, and the color information corresponding to the current pixel is sampled from the texture resource to be sampled.
[0053] Furthermore, the step of determining a texture resource to be sampled from the texture resources of the loaded map blocks, and sampling the texture resource to be sampled to obtain color information corresponding to the current pixel includes:
[0054] Calculate the current fading progress according to the proportion of the fading time of the area to be unlocked in the total fading time;
[0055] Using the depth value randomly obtained by the fractal noise, determining whether the depth value is greater than the current fading progress;
[0056] If so, the color information corresponding to the current pixel is sampled from the fog map; otherwise, the color information corresponding to the current pixel is sampled from the map map.
[0057] According to a second aspect of the present application, a rendering device for a game map is provided, comprising:
[0058] A creation unit, used to create map configuration information of different areas, wherein the map configuration information includes map block information obtained by segmenting the game map;
[0059] A first determining unit, configured to determine first map block information in the game map in response to an operation instruction of the game map according to the map configuration information, wherein the first map block information is map block information having view intersection in the game map;
[0060] A first acquisition unit, configured to acquire a texture resource of a loaded map block in a task loading queue according to the first map block information, wherein the task loading queue stores a loading task structure of a map block in a game map;
[0061] A rendering unit is used to render the game map using the texture resources of the loaded map blocks.
[0062] Furthermore, the creation unit is specifically used to:
[0063] Obtaining game maps of different areas, dividing the game maps of the different areas, and obtaining map block information;
[0064] According to the map block information, determine the map identifier to which the map block belongs and the area identifier corresponding to the game map;
[0065] Creating map configuration information for different areas according to the map identifiers to which the map blocks belong and the area identifiers corresponding to the game map;
[0066] Accordingly, the first determining unit is specifically configured to:
[0067] In response to an operation instruction of the game map, determining map block information covered by the game map according to the map configuration information;
[0068] The first map block information is determined in the game map by performing intersection calculation on the map block information covered by the game map and the view.
[0069] Furthermore, the device also includes:
[0070] A second acquisition unit is used to acquire a task loading queue before acquiring the texture resource of the loaded map block in the task loading queue according to the first map block information, wherein the task loading queue stores the task loading information of the map block, and the task loading information includes the sequence number identification of the map block, the tag value and the loaded texture resource set;
[0071] The loading unit is used to traverse the task loading queue and load the map block texture resources according to the traversal result.
[0072] Furthermore, the loading unit is specifically used for:
[0073] Traversing the task loading queue, and judging whether there is task loading information of the first map block in the task loading queue according to the traversal result;
[0074] If it does not exist, a thread is called to add a loading task and a task mark of the first map chunk to the task loading queue.
[0075] Furthermore, the device also includes:
[0076] A second determining unit is used to determine second map block information in the game map according to the map configuration information after responding to the operation instruction of the game map, wherein the second map block information is map block information in the game map within a preset range adjacent to the first map block;
[0077] Accordingly, the loading unit is further used for:
[0078] Traversing the task loading queue, and judging whether there is task loading information of the second map block in the task loading queue according to the traversal result;
[0079] If it does not exist, a thread is called to add a loading task and a task mark of the second map chunk in the task loading queue.
[0080] Furthermore, the device also includes:
[0081] A third determining unit, configured to determine view information of the game map before creating map configuration information of different areas, wherein the view information includes size information of the view and zoom information of the view;
[0082] A fourth determining unit, configured to determine a map area of the game map displayed in the view according to the size information of the view;
[0083] A fifth determining unit, configured to determine a map area range of the game map displayed in the view through a zoom operation according to the zoom information of the view;
[0084] Accordingly, the device further comprises:
[0085] A first adjustment unit, configured to, after determining the view information of the game map, respond to an adjustment instruction for the map area and adjust the position of the map area displayed in the view according to the position information carried in the adjustment instruction;
[0086] The second adjustment unit is used to respond to a zoom instruction of the map area and adjust the range of the map area displayed in the view according to size information carried in the zoom instruction.
[0087] Furthermore, the device further comprises:
[0088] An updating unit, configured to update the task marks of the map blocks in the task loading queue according to the map area displayed after the view information of the game map is determined and when an operation instruction of view translation is received;
[0089] The deleting unit is used to delete the loading task of the map block if the task identifier of the updated map block meets the set conditions, so as to release the texture resources loaded in the map block.
[0090] Furthermore, the rendering unit includes:
[0091] A construction module, used for traversing the first map block information and constructing vertex data of the first map block;
[0092] A binding module, for sending the vertex data of the first map block to a vertex buffer for binding to a shader;
[0093] The rendering module is used to call the drawing function in the shader to render the game map.
[0094] Furthermore, the rendering unit further includes:
[0095] An acquisition module, used for acquiring the index value of the unlocked area in the game map before calling the drawing function in the shader to render the game map, and passing the index value of the unlocked area into the shader as an index array;
[0096] Accordingly, the rendering module is specifically used for:
[0097] Respectively obtain a map texture, a fog texture, and a mask texture from the texture resources of the loaded map blocks;
[0098] Using the current pixel to sample in the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, traversing and determining whether the target area index value to which the current pixel belongs is stored in the index array;
[0099] If it exists, the color information corresponding to the current pixel is sampled from the map map, otherwise, the color information corresponding to the current pixel is sampled from the fog map; according to the color information corresponding to the current pixel, the drawing function is called in the shader to render the game map.
[0100] Furthermore, the rendering module is further used for:
[0101] Before calling a drawing function in the shader to render the game map according to the color information corresponding to the current pixel, obtaining an initial index value and a fading time of the area to be unlocked in the game map, and passing the initial index value and the fading time into the shader;
[0102] Using the current pixel to sample the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, and determining whether the initial index value is the same as the target area index value to which the current pixel belongs;
[0103] If so, the texture resource to be sampled is determined in the texture resources of the loaded map blocks, and the color information corresponding to the current pixel is sampled from the texture resource to be sampled.
[0104] Furthermore, the rendering module is further used for:
[0105] Calculate the current fading progress according to the proportion of the fading time of the area to be unlocked in the total fading time;
[0106] Using the depth value randomly obtained by the fractal noise, determining whether the depth value is greater than the current fading progress;
[0107] If so, the color information corresponding to the current pixel is sampled from the fog map; otherwise, the color information corresponding to the current pixel is sampled from the map map.
[0108] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0109] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0110] By means of the above technical scheme, the present application provides a method, device and equipment for rendering a game map. Compared with the current prior art that uses a large number of texture resources to realize the rendering of the game map, the present application creates map configuration information of different areas, where the map configuration information includes the map block information obtained by segmenting the game map, responds to the operation instruction of the game map, determines the first map block information in the game map according to the map configuration information, where the first map block information is the map block information with view intersection in the game map, and then obtains the texture resources of the loaded map block in the task loading queue according to the first map block information, and the task loading queue stores the loading task structure of the map block, and finally uses the texture resources of the loaded map block to render the game map. The whole process realizes the block processing of the texture resources through the map block information, and then makes full use of the correlation between the map blocks in the view to dynamically load and cache the texture resources of the map block required by the game in the task loading queue, which can ensure the smooth operation of the players while saving the video memory occupation of the game resources.
[0111] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0113] Figure 1 It is a flowchart of a method for rendering a game map provided in an embodiment of the present application;
[0114] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step 101;
[0115] Figure 3 It is a flowchart of another method for rendering a game map provided in an embodiment of the present application;
[0116] Figure 4 A schematic diagram of map blocks displayed before and after a view translation operation in an embodiment of the present application;
[0117] Figure 5 yes Figure 1 A schematic flow chart of a specific implementation of step 104;
[0118] Figure 6 yes Figure 1Another specific implementation flow diagram of step 104;
[0119] Figure 7 yes Figure 6 Another specific implementation flow diagram of step 104;
[0120] Figure 8 yes Figure 7 A schematic flow chart of a specific implementation of step 507;
[0121] Fig. 9A is a flowchart of the configuration of map information provided in an embodiment of the present application;
[0122] Fig. 9B It is a flowchart of the event logic processing provided by the embodiment of the present application;
[0123] Fig. 9C It is a flowchart of rendering of texture resources provided in an embodiment of the present application;
[0124] Fig.10 It is a structural schematic diagram of a game map rendering device provided in an embodiment of the present application;
[0125] Fig.11 It is a schematic diagram of the device structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0126] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0127] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0128] Related technology During the rendering process of the game map, lower-resolution map texture resources can be used to create a game map with resource effects, but using lower-resolution map texture resources will discard the details in the game map; the map texture resources can also be loaded into the memory in advance, but the player may not open the game map at the same time as the map texture resources are loaded, resulting in a waste of memory, and the entire texture needs to be passed to the graphics processor during rendering, which will take up a lot of video memory; the game map can also be split into multiple areas, only showing the map of the player's area, but the split areas cannot be browsed through the entire game map through intuitive dragging and zooming, affecting the player's gaming experience.
[0129] In order to solve the above technical problems, this embodiment provides a method for rendering a game map, such as Figure 1 As shown, the method comprises the following steps:
[0130] 101. Create map configuration information for different areas.
[0131] In game development, in order to enrich the game experience of players, game maps of different areas are usually set up in the game world, and the game maps of each area are used to present themed levels with different forms and full of entertainment for players to explore and challenge. The game map of the area here needs to be related to the theme of the game. The game theme can be an adventure type, and the corresponding adventure area map will be arranged with many unknown areas and puzzles to be solved. The game theme can also be a war type, and the corresponding game map is a battle area map, and the battle area map will be arranged with many strategic points and battle points. The game theme can also be a fog type, and the corresponding game map is a fog area map, and the fog area map will be arranged with many fog points and unlocking points.
[0132] In actual applications, in order to better manage game maps in different areas, map configuration information of different areas can be created, and the map block information obtained by dividing the game map can be stored through the map configuration information, thereby storing the game map information of different areas.
[0133] Taking into account that game maps in different areas have different layout effects, in the process of creating map configuration information for different areas, the game maps of different areas are first determined, and the game maps are divided according to the attribute information of the game maps to obtain multiple game blocks. A unique serial number identifier is further assigned to each map block in the game maps of different areas, and map configuration information for different areas is created according to the unique serial number identifier of the map block.
[0134] The executor of this embodiment can be a rendering device or equipment for the game map, which can be configured on the game server or client. The game map information is stored in blocks by creating map configuration information of different game areas, and then the corresponding texture resources are obtained according to the map block information, thereby realizing flexible loading of texture resources in different map blocks.
[0135] 102. In response to an operation instruction of the game map, determine first map block information in the game map according to the map configuration information.
[0136] It is understandable that the game map can display different map areas through views. After the player enters the game world, the player can select the game map to enter from the game maps of different areas through selection operations, and then display the corresponding map area through the view. When the player selects the game map, the map block information of the game map can be determined through the map configuration information, and then the view is placed in the block information of the game map. At this time, the map area displayed by the view may exceed the edge of the game map. The view is adjusted to ensure that the map area displayed by the view is located inside the game map.
[0137] Among them, the first map block information is the map block information of the game map with view intersection, that is, the first map block information is the map block information corresponding to the map area displayed by the view of the game map. Here, the target location area can be selected in the game map through the map area displayed by the view, and the map blocks with intersection in the game map are determined according to the target location area, and the serial numbers, vertex coordinates and texture coordinates of the map blocks with intersection are further placed in the first map block information. For example, the game map includes 9 map blocks, and the map area displayed by the view includes 4 map blocks. The serial numbers, vertex coordinates and texture coordinates of these 4 map blocks can be placed in the first map classification information.
[0138] Normally, the size of the view will be smaller than the size of the game map, and can be dynamically panned and zoomed by the player. The position of the map area displayed in the view can be adjusted by panning, and the first map tile information contained in the map area will be adjusted accordingly. Here, it mainly refers to the position of the first map tile. The proportion of the map area displayed in the view can be adjusted by zooming, and the first map tile information contained in the map area will be adjusted accordingly. Here, it mainly refers to the number of first map tiles. Specifically, a zooming out operation will increase the number of map tiles contained in the map area displayed in the view, and a zooming in operation will reduce the number of map tiles contained in the map area displayed in the view.
[0139] 103. Obtain the texture resources of the loaded map blocks in the task loading queue according to the first map block information.
[0140] In this embodiment, the task loading queue stores the loading task structure of the map blocks in the game map. The loading task structure includes the serial number identifier, tag value and loaded texture resource set of the map block. The loading task structure of the map block can be used to dynamically load the texture resources of the required map block in real time, and the texture resources of the loaded map block can be stored in the task loading queue.
[0141] It is understandable that when the player enters the game map, the task loading queue will generate the loading task and task mark of the current frame according to the first map block information output by the current frame, and load the map block texture resources according to the loading task. However, with the various operations of the player in the game world, the first map block displayed in the game map view is also changing accordingly. At this time, in order to better distinguish the loading requirements of the map blocks, the task loading queue will generate the loading task and task mark of the first map block output by the current frame, and will also update the task mark of the map block generated by the previous frame, so as to realize the loading requirement level of the map block through different task identifiers. For map blocks with lower loading requirements, the loading tasks and texture resources of the map blocks can be processed by deletion, thereby saving the memory usage of game resources.
[0142] 104. Render the game map using the texture resources of the loaded map blocks.
[0143] It is understandable that for the first map block information output in the current frame, the task loading queue will execute the loading task of the first map block in the queue order, and obtain the texture resources of the first map block. The texture resources of the loaded map blocks in the task loading queue are usually the texture resources of the map blocks that need to be loaded in the game. Later in the rendering process, the first map block information can be traversed to obtain the texture resources of the map blocks that need to be loaded from the texture resources of the loaded map blocks. If the texture resources of the map blocks that need to be loaded have not been loaded, the rendering of the map block can be skipped or replaced with preset texture resources. Then, the vertex data of the map blocks that need to be loaded is constructed through the first map block information, and the vertex data of the map blocks that need to be loaded is sent to the required vertex buffer to be bound to the shader, and the vertex data is shaded in the shader to achieve the rendering of the game map.
[0144] It should be noted that in the process of rendering the effects of the game map, one-time rendering can be used to achieve the rendering of the effects of the game map. If the number of map blocks rendered at one time is too large and not enough to submit all the textures, the map blocks can be rendered in batches.
[0145] Compared with the current prior art that uses a large number of texture resources to achieve the rendering of the game map, the rendering method of the game map provided in the embodiment of the present application creates map configuration information of different areas, where the map configuration information includes the map block information obtained by segmenting the game map, responds to the operation instruction of the game map, determines the first map block information in the game map according to the map configuration information, where the first map block information is the map block information with view intersection in the game map, and then obtains the texture resources of the loaded map block in the task loading queue according to the first map block information, and the task loading queue stores the loading task structure of the map block in the game map, and finally uses the texture resources of the loaded map block to render the game map. The whole process realizes the block processing of the texture resources through the map block information, and then makes full use of the correlation between the map blocks in the view to dynamically load and cache the texture resources of the map block required by the game in the task loading queue, which can ensure the smooth operation of the players while saving the video memory occupation of the game resources.
[0146] In actual application scenarios, different areas of the game map can use different segmentation methods. The map block information obtained by segmentation in different segmentation methods usually has different configuration information. Specifically, Figure 2 As shown, step 101 in the above method may further include the following steps:
[0147] 201. Obtain game maps of different areas, and segment the game maps of different areas to obtain map segmentation information.
[0148] 202. Determine the map identifier to which the map block belongs and the area identifier corresponding to the game map according to the map block information.
[0149] 203. Create map configuration information for different areas according to the map identifier to which the map block belongs and the area identifier corresponding to the game map.
[0150] Considering the different game themes, multiple game maps of different theme types need to be arranged in the game world. Each game map can be an independent area or cover multiple areas. Game maps of different areas can present element effects of different themes. For example, a city-themed game map can present element effects such as transportation and commerce, and a court-themed game map can present element effects such as palaces and clothing. Specifically, in the process of segmenting game maps of different areas, the game map can be evenly segmented according to the size of the game map to obtain multiple map blocks of the same size, and the game map can also be segmented into multiple map blocks containing different scene elements according to the scene layout of the game map. For the purpose of evenly segmenting the game map, the size of the game map is 11*9*1024px*1024px. The game map is divided into 11 rows and 9 columns in equal proportion, and the size is 1024px*1024px. After pre-testing, using 1024px*1024px as the size of the image resource can meet the good loading speed and the expected rendering effect. Further obtain the attribute information of the segmented map blocks, determine the map identifier to which the map blocks belong and the area identifier corresponding to the game map according to the attribute information of the map blocks, and create map configuration information for different areas.
[0151] For example, the game world is set with 10 game maps, and the corresponding map identifiers are 001-010 respectively. The map identifier to which the current map block belongs is 001, and the area identifier corresponding to the game map is A. The serial number identifier of the map block is further set to A001. That is to say, the game map information of the current area can be obtained from the map configuration information through the serial number identifier of the map block, that is, the game map of the current area and the map block information of the game map.
[0152] Furthermore, after creating map configuration information for different areas, the map block information can be sent to different processors according to the map configuration information, so that the processors can produce at least one map block texture resource according to the map block information, and then perform edge splicing on the map block texture resources. After storing the spliced map texture resources to a specified path, the resource paths of the texture resources corresponding to different map blocks are added to the map configuration information.
[0153] Accordingly, after responding to the operation instruction of the game map, the map block information covered by the game map can be determined according to the map configuration information, and the first map block information of the game map can be determined by performing intersection calculation with the map block information covered by the game map.
[0154] During the specific implementation process, when the player opens the game map, the area identifier of the game map will be obtained, and the game map and map block information of the game map will be further determined in the map configuration information based on the area identifier of the game map. The game map will then be displayed through a view, and the corresponding map blocks will be displayed in the view based on the player's operation information.
[0155] Considering the loading process of map resources corresponding to map blocks, further, Figure 3 As shown, before step 103, the method further includes the following steps:
[0156] 301. Get the task loading queue.
[0157] 302. Traverse the task loading queue, and load the texture resources of the map blocks according to the traversal results.
[0158] In one possible implementation, the task queue is a task loading queue that stores task loading information of map tiles, and the task loading information includes the serial number identifier, tag value, and loaded texture resource collection of the map tile. It should be noted that not all map tiles in the task queue will be created in the task loading queue, but only map tiles that require resource loading will create loading tasks in the task queue. When traversing the task loading queue, a new thread in the thread pool can be enabled to asynchronously load the texture resources of the map tile, and the loading status and results are stored in the loaded texture resource collection of the task loading information according to the traversal results. The loaded texture resources can be obtained through the loaded texture collection.
[0159] Furthermore, in order to accurately create the loading task information of the required map block in the task loading queue, it is also possible to traverse the task loading queue and determine whether there is task loading information of the first map block in the task loading queue according to the traversal result. If not, a thread is called to add the loading task and task mark of the first map block in the task loading queue. Since the first map block is a map block with a view intersection in the game map, and the texture resource of the corresponding map block is the texture resource of the required map block, if there is no task loading information of the first map block in the task loading queue, it is necessary to add the loading task and task mark of the first map block in the task loading queue.
[0160] Furthermore, in order to refine the degree of map block demand loading, after extracting the first map block with a higher degree of demand loading in the game map, it is necessary to perform a second extraction of the map blocks in the game map. In the above embodiment, the method further includes the following steps: determining the second map block information in the game map according to the map configuration information. The second map block information is the map block information within a preset range adjacent to the first map block in the game map. Here, the map blocks within the adjacent preset range can be map blocks within N rows adjacent to the first map block, and the value of N is preferably less than 2. Usually, the map blocks adjacent to the first map block are selected as the second map blocks.
[0161] It is understandable that the second map block, as the map block that is required to be loaded, also needs to create corresponding loading task information in the task loading queue. Accordingly, in the process of traversing the task loading queue, it is also possible to determine whether there is task loading information of the second map block in the task loading queue based on the traversal results. If not, the thread is called to add the loading task and task mark of the second map block in the task loading queue. Since the second map block is a map block within the view setting range in the game map, the texture resources of the corresponding map block are also the texture resources of the map block that is required to be loaded. If there is no task loading information of the second map block in the task loading queue, it is necessary to add the loading task and task mark of the second map block in the task loading queue.
[0162] As the player operates the view, the map tiles displayed in the view will also change, and the map tiles that intersect with the view will also change accordingly. In other words, the first map tile information and the second map tile information in the game map will also change accordingly. At this time, the loading tasks and task marks in the task loading queue will also change accordingly. For map tiles that have left the view area, they usually have lower loading requirements, while map tiles that have moved into the view area have higher loading requirements. Here, by changing the task mark, the degree of loading requirements of the current map tile can be changed in real time.
[0163] Specifically, the first map block, as the map block at the intersection of the views in the game map, has a higher degree of required loading, and the loading task of the first map block in the task loading queue can be marked as M1. The second map block, as the map block within the preset range of the view in the game map, has a lower degree of required loading, and the loading task of the second map block in the task loading queue can be marked as M2. As for the map blocks outside the preset range of the view in the game map, their degree of required loading will be even lower, and the loading tasks of this part of the map blocks in the task loading queue can be marked as M3.
[0164] Furthermore, in order to better display the game map, before creating map configuration information for different areas, the view information of the game map can also be determined, wherein the view information includes the size information of the view and the zoom information of the view; the map area of the game map displayed in the view is determined according to the size information of the view; and the range of the map area of the game map displayed in the view through a zoom operation is determined according to the zoom information of the view.
[0165] In one possible implementation, the size information of the view can be determined according to the size of the game map. Usually, the size of the game map is the same as the actual size of the scene, or it is scaled accordingly according to the size of the display interface of the game map, and the aspect ratio requirement of the game map is consistent with the scene, so as to display the map area in the game map through the view. The zoom information of the view also needs to be determined according to the size of the game map. Here, the aspect ratio of the view can be different from the aspect ratio of the map. The zoom information of the view can be achieved by setting the view to obtain the upper limit and lower limit. Under the premise of ensuring the aspect ratio of the view, the minimum width, maximum width or minimum height, maximum height of the view can be set. The upper limit of the view determines the range of the map area that the player can browse by zooming. In order to ensure the browsing effect of the game map in the view, when the view is the smallest, the corresponding game map is the most detailed, and the width of the view is preferably less than the set ratio of the width or height of the game map.
[0166] Accordingly, players can achieve view translation through view operations. Specifically, in response to the adjustment instruction of the map area, the position of the map area displayed in the view is adjusted according to the position information carried by the adjustment instruction. For example, after the view translation operation, the map area displayed in the view is adjusted from map block A to map block B.
[0167] Accordingly, the player can zoom the view through view operations. Specifically, in response to the zoom instruction of the map area, the range of the map area displayed in the view is adjusted according to the size information carried by the zoom instruction. For example, after the view zoom operation, the map area displayed in the view is adjusted from map block A to map block ABCD.
[0168] Furthermore, considering that after the view is translated, the map blocks displayed in the view will change accordingly, and the demand for loading resources corresponding to the map blocks will also change, and the task loading queue needs to be updated accordingly. Specifically, after determining the view information of the game map, when receiving the operation instruction of view translation, the task mark of the map block in the task loading queue is updated according to the map area displayed after the view is translated; if the task identifier of the updated map block meets the set conditions, the loading task of the map block is deleted to release the texture resources loaded in the map block. Here, the task identifier can use level or value to reflect the loading demand of the map block.
[0169] It can be understood that for the loading task of the map block in the task loading queue, the task identifier is set according to the intersection of the map block and the view, and can reflect the required loading degree. The intersection of the map block and the view will be changed by panning or zooming operations, and the task identifier of the corresponding map block in the task loading queue will also change. For example, when map block A is in the view area, a loading task for map block A will be created in the task loading queue, and the texture resources of map block A will be obtained accordingly. At the same time, the loading task mark is 1. When the view is translated, when map block A moves to a certain distance from the view, it means that the degree of required loading of map block A is reduced, and the mark of the corresponding loading task is updated to 0. When the view is translated again, map block A moves to a certain distance outside the view, it means that the degree of required loading of map block A is reduced again, and the mark of the corresponding loading task is updated to -1.
[0170] The set condition here can be expressed as the required loading degree of the loading task is low. For the case where the task identifier is represented by a numerical value, the set condition can be expressed as the task identifier is less than the set value. For the task identifier of the updated map block that meets the set condition, it means that the map block has moved away from the view and the possibility of being loaded is low. At this time, in order to save resource space, the loading task of the map block can be deleted to release the texture resources loaded in the map block. Specifically, at the end of the current frame logic execution, all loading task information in the task loading queue can be traversed. If the task identifier is less than the set value, the loading task is deleted to release the resources that the loading task has loaded. Continuing with the example in the above text, when the task identifier is less than 0, that is, the map block A moves to a certain distance outside the view, the loading task of the map block A can be deleted in the task loading queue to release the resources that the loading task has loaded.
[0171] To further illustrate the processing of loading tasks in the task loading queue, the map blocks displayed before and after the view translation operation are shown as follows: Figure 4As shown, the dotted box position is the view size. In the left figure, the task mark of the first map block is 2, and the task mark of the second map block is 1. In the right figure, after one frame of view translation operation, the first map block has changed. If there is still a view intersection in the first view block before the translation operation, the task mark of the map block is considered to be 2. If there is no view intersection, the task mark of the map block is reduced by 1 and updated to 1, and the second map block is also reduced by 1 and updated to 0. That is to say, if the map block has created a loading task in the task loading queue, the task mark of the map block will change with its intersection with the view. With the view translation operation of the next frame, the map block may be further away from the view area, and the task mark of the map block will be reduced by 1 and updated to -1. At the same time, the loading task of the map block will be deleted, and the loaded texture resources will be released accordingly.
[0172] Specifically, Figure 5 As shown, step 104 in the above method may further include the following steps:
[0173] 401. Traverse the first map block information to construct vertex data of the first map block.
[0174] 402. Send the vertex data of the first map block to a vertex cache for binding to a shader.
[0175] 403. Call a drawing function in the shader to render the game map.
[0176] It is understandable that after obtaining the texture resources of the loaded map blocks, it is necessary to render the map area in the view according to the texture resources of the loaded map blocks, that is, to render the first map block. Since the texture resources of the loaded map blocks will store the effect information of the corresponding map blocks, specifically in the process of rendering the game map, first create a resource texture of the loaded map blocks to store the resource effect information. The resource texture is usually a two-dimensional texture of the same size as the map block, and each pixel can represent the effect state of a map block. Then, the vertex data of the first map block is generated according to the first map block information, and the vertex data of the first map block is passed and bound to the required vertex buffer and sent to the shader. The vertex data of the first map block is used in the shader to render the effect of the corresponding texture resource on the game map. The effect rendering can be a fog effect, a lava effect, a frost effect, etc.
[0177] Taking the fog effect as an example, in the process of rendering the game map, in order to achieve the rendering of the irregular fog effect in the game map, further, in the above embodiment, Figure 6 As shown, before step 403, the method further includes the following steps:
[0178] 404. Obtain the index value of the unlocked area in the game map, and pass the index value of the unlocked area into the shader as an index array.
[0179] Considering the authenticity of the fog effect, the game map can be further divided into multiple irregular areas, each of which will be assigned a unique index value, which can be limited by 8-bit color, and the specific value range is [0,255]. The index array of the unlocked area is equivalent to the player's attribute, which can be passed to the shader before rendering.
[0180] Correspondingly, such as Figure 6 As shown, step 403 in the above method may further include the following steps:
[0181] 501. Obtain a map texture, a fog texture, and a mask texture from the texture resources of the loaded map blocks respectively.
[0182] 502. Use the current pixel to sample the mask map to obtain the attribute value of the preset channel to represent the target region index value to which the current pixel belongs, and traverse to determine whether the target region index value to which the current pixel belongs is stored in the index array.
[0183] 503a. If it exists, the color information corresponding to the current pixel is obtained by sampling from the map map; 503a. Otherwise, the color information corresponding to the current pixel is obtained by sampling from the fog map.
[0184] 504. Call a drawing function in the shader to render the game map according to the color information corresponding to the current pixel.
[0185] In one feasible method, the rendering of the game map can be achieved through the map texture, fog texture and mask texture. The map texture can display the map information contained in the map block, the fog texture can display the fog information contained in the map block, and the mask texture can determine the proportion of fog information in the map block.
[0186] Specifically, in the process of sampling the color information corresponding to the pixel, the R channel value sampled by the current pixel in the mask map is used to represent the region index value to which the current pixel belongs. If the region index value corresponding to the pixel exists in the index array of the player's unlocked area in the shader, it means that the fog effect rendered by the pixel has been rendered historically, and the color information of the pixel should be the color value sampled from the map map. Otherwise, it means that the fog effect rendered by the pixel has not been rendered historically, and the color information of the pixel should be the color value sampled from the fog map.
[0187] In order to realize that when a player activates an area for the first time, the map is opened to display the unlocking animation, further, in the above embodiment, Figure 7 As shown, before step 504, the method further includes the following steps:
[0188] 505. Obtain an initial index value and a fade-out time of the area to be unlocked in the game map, and pass the initial index value and the fade-out time into the shader.
[0189] 506. Use the current pixel to sample the attribute value of the preset channel in the mask map to represent the target region index value to which the current pixel belongs, and determine whether the initial index value is the same as the target region index value to which the current pixel belongs.
[0190] 507. If yes, determine the texture resource to be sampled in the texture resources of the loaded map blocks, and sample the color information corresponding to the current pixel from the texture resource to be sampled.
[0191] Among them, the initial index value is the index value that represents the fading change of the area to be unlocked, and the initial index value and the fading time are further passed to the shader before rendering. For the area to be unlocked, the R channel value obtained by sampling the current pixel in the mask map can be used to represent the target area index value to which the current pixel belongs. If the target area index value of the pixel is the same as the initial index value in the shader, it means that the player has unlocked the area for the first time. At this time, the color information corresponding to the pixel needs to be re-determined to achieve the rendering effect of the unlocking animation. If the target area index value of the pixel is different from the initial index value in the shader, it means that the player has not unlocked the area or it is not the first time to unlock the area. For the area that the player has unlocked, the color information of the pixel can be sampled using the above 501-504 methods.
[0192] Correspondingly, such as Figure 8 As shown, step 507 in the above method may further include the following steps:
[0193] 601. Calculate the current fading progress according to the proportion of the fading time of the area to be unlocked in the total fading time.
[0194] 602. Using the depth value randomly obtained by the fractal noise, determine whether the depth value is greater than the current fading progress.
[0195] 603a. If yes, sample the color information corresponding to the current pixel from the fog map; 603b. Otherwise, sample the color information corresponding to the current pixel from the map map.
[0196] In one possible implementation, specifically, a depth value of 0-1 can be randomly obtained by using fractal noise to achieve an effect similar to dissolution, and then the fading time of the area to be unlocked is divided by the total fading time to obtain the proportion of the fading time of the area to be unlocked in the total fading time. The current fading progress is determined by the proportion, and the fading progress is between 0-1. By comparing the depth value with the current fading progress, if the depth value is greater than the current fading progress, the fog color is displayed, and the color information corresponding to the current pixel is sampled from the fog map. Otherwise, the map color is displayed, and the color information corresponding to the current pixel is sampled from the map map.
[0197] In the actual application process, the rendering process of the game map can be divided into the configuration process of map information, the processing process of event logic and the rendering process of texture resources. Fig. 9A As shown, the view information is determined by the size information of the game map, and the game map is segmented to obtain the map block information. Texture resources and texture resource paths are generated for each map block, and map configuration information of different areas is created according to the map block information and texture resource paths. Specifically, in the process of event logic processing, Fig. 9B As shown, for the event logic updated for each frame, at the beginning of the event logic, the area identifier of the game map is obtained, the map block information of the game map is read from the map configuration information, the first map block information and the second map block information in the game map are calculated, each map block in the first map block information and the second map block information is traversed, and it is determined whether there is a loading task for the corresponding map block in the task loading queue. If not, a loading task for the map block is created in the task loading queue, and the task mark is set. After completing the traversal of the map blocks, the loading tasks in the loading task queue are traversed. At the end of the event logic, the task identifier is reduced by 1, and then it is determined whether the task identifier is less than 0. If so, the loading task is deleted and the loaded texture resources are released. Specifically, in the rendering process of texture resources, such as Fig. 9C As shown, for the rendering of each frame of pixels, the first map block information in the game map is obtained, each map block in the first map block information is traversed, vertex data is constructed, and then it is determined whether the texture resources of the map block are loaded. If so, the loaded texture resources are obtained from the task loading queue, otherwise, the default texture resources are used. After completing the traversal of the map blocks, it is bound to the rendering pipeline and the rendering instructions are executed to render the game map.
[0198] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a rendering device for a game map, such as Fig.10As shown, the device includes: a creating unit 71, a first determining unit 72, a first acquiring unit 73, and a rendering unit 74.
[0199] A creation unit 71, used to create map configuration information of different areas, wherein the map configuration information includes map block information obtained by segmenting the game map;
[0200] A first determining unit 72 is used to determine first map block information in the game map in response to an operation instruction of the game map according to the map configuration information, wherein the first map block information is map block information having view intersection in the game map;
[0201] A first acquisition unit 73, configured to acquire a texture resource of a loaded map block in a task loading queue according to the first map block information, wherein the task loading queue stores a loading task structure of a map block in a game map;
[0202] The rendering unit 74 is used to render the game map using the texture resources of the loaded map blocks.
[0203] The rendering device of the game map provided by the embodiment of the present invention is compared with the current prior art that uses a large number of texture resources to realize the rendering of the game map. The present application creates map configuration information of different areas, where the map configuration information includes map block information obtained by segmenting the game map, responds to the operation instruction of the game map, determines the first map block information in the game map according to the map configuration information, where the first map block information is the map block information with view intersection in the game map, and then obtains the texture resources of the loaded map block in the task loading queue according to the first map block information, and the task loading queue stores the loading task structure of the map block, and finally uses the texture resources of the loaded map block to render the game map. The whole process realizes the block processing of the texture resources through the map block information, and then makes full use of the correlation between the map blocks in the view to dynamically load and cache the texture resources of the map block required by the game in the task loading queue, which can ensure the smooth operation of the players while saving the video memory occupation of the game resources.
[0204] In an actual application scenario, the creation unit is specifically used to:
[0205] Obtaining game maps of different areas, dividing the game maps of the different areas, and obtaining map block information;
[0206] According to the map block information, determine the map identifier to which the map block belongs and the area identifier corresponding to the game map;
[0207] Creating map configuration information for different areas according to the map identifiers to which the map blocks belong and the area identifiers corresponding to the game map;
[0208] Accordingly, the first determining unit is specifically configured to:
[0209] In response to an operation instruction of the game map, determining map block information covered by the game map according to the map configuration information;
[0210] The first map block information is determined in the game map by performing intersection calculation on the map block information covered by the game map and the view.
[0211] In an actual application scenario, the device further includes:
[0212] A second acquisition unit is used to acquire a task loading queue before acquiring the texture resource of the loaded map block in the task loading queue according to the first map block information, wherein the task loading queue stores the task loading information of the map block, and the task loading information includes the sequence number identification of the map block, the tag value and the loaded texture resource set;
[0213] The loading unit is used to traverse the task loading queue and load the map block texture resources according to the traversal result.
[0214] In an actual application scenario, the loading unit is specifically used for:
[0215] Traversing the task loading queue, and judging whether there is task loading information of the first map block in the task loading queue according to the traversal result;
[0216] If it does not exist, a thread is called to add a loading task and a task mark of the first map chunk to the task loading queue.
[0217] In an actual application scenario, the device further includes:
[0218] A second determining unit is used to determine second map block information in the game map according to the map configuration information after responding to the operation instruction of the game map, wherein the second map block information is map block information in the game map within a preset range adjacent to the first map block;
[0219] Accordingly, the loading unit is further used for:
[0220] Traversing the task loading queue, and judging whether there is task loading information of the second map block in the task loading queue according to the traversal result;
[0221] If it does not exist, a thread is called to add a loading task and a task mark of the second map chunk in the task loading queue.
[0222] In an actual application scenario, the device further includes:
[0223] A third determining unit, configured to determine view information of the game map before creating map configuration information of different areas, wherein the view information includes size information of the view and zoom information of the view;
[0224] A fourth determining unit, configured to determine a map area of the game map displayed in the view according to the size information of the view;
[0225] A fifth determining unit, configured to determine a map area range of the game map displayed in the view through a zoom operation according to the zoom information of the view;
[0226] Accordingly, the device further comprises:
[0227] A first adjustment unit, configured to, after determining the view information of the game map, respond to an adjustment instruction for the map area and adjust the position of the map area displayed in the view according to the position information carried in the adjustment instruction;
[0228] The second adjustment unit is used to respond to a zoom instruction of the map area and adjust the range of the map area displayed in the view according to size information carried in the zoom instruction.
[0229] In an actual application scenario, the device further includes:
[0230] An updating unit, configured to update the task marks of the map blocks in the task loading queue according to the map area displayed after the view information of the game map is determined and when an operation instruction of view translation is received;
[0231] The deleting unit is used to delete the loading task of the map block if the task identifier of the updated map block meets the set conditions, so as to release the texture resources loaded in the map block.
[0232] In an actual application scenario, the rendering unit includes:
[0233] A construction module, used for traversing the first map block information and constructing vertex data of the first map block;
[0234] A binding module, for sending the vertex data of the first map block to a vertex buffer for binding to a shader;
[0235] The rendering module is used to call the drawing function in the shader to render the game map.
[0236] In an actual application scenario, the rendering unit further includes:
[0237] An acquisition module, used for acquiring the index value of the unlocked area in the game map before calling the drawing function in the shader to render the game map, and passing the index value of the unlocked area into the shader as an index array;
[0238] Accordingly, the rendering module is specifically used for:
[0239] Respectively obtain a map texture, a fog texture, and a mask texture from the texture resources of the loaded map blocks;
[0240] Using the current pixel to sample in the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, traversing and determining whether the target area index value to which the current pixel belongs is stored in the index array;
[0241] If it exists, the color information corresponding to the current pixel is sampled from the map map, otherwise, the color information corresponding to the current pixel is sampled from the fog map; according to the color information corresponding to the current pixel, the drawing function is called in the shader to render the game map.
[0242] In actual application scenarios, the rendering module is further used to:
[0243] Before calling a drawing function in the shader to render the game map according to the color information corresponding to the current pixel, obtaining an initial index value and a fading time of the area to be unlocked in the game map, and passing the initial index value and the fading time into the shader;
[0244] Using the current pixel to sample the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, and determining whether the initial index value is the same as the target area index value to which the current pixel belongs;
[0245] If so, the texture resource to be sampled is determined in the texture resources of the loaded map blocks, and the color information corresponding to the current pixel is sampled from the texture resource to be sampled.
[0246] In actual application scenarios, the rendering module is further used to:
[0247] Calculate the current fading progress according to the proportion of the fading time of the area to be unlocked in the total fading time;
[0248] Using the depth value randomly obtained by the fractal noise, determining whether the depth value is greater than the current fading progress;
[0249] If so, the color information corresponding to the current pixel is sampled from the fog map; otherwise, the color information corresponding to the current pixel is sampled from the map map.
[0250] It should be noted that for other corresponding descriptions of the functional units involved in the game map rendering device provided in this embodiment, please refer to Figure 1 -The corresponding description in Figure 9 will not be repeated here.
[0251] Based on the above Figure 1 - The method shown in FIG. 9, accordingly, the embodiment of the present application further provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1 -The rendering method of the game map shown in Figure 9.
[0252] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0253] Based on the above Figure 1 - the method shown in FIG. 9 , and Fig.10 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a physical device for rendering a game map, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 -The rendering method of the game map shown in Figure 9.
[0254] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0255] In an exemplary embodiment, see Fig.11 The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the game map rendering method in the above embodiment.
[0256] Those skilled in the art will appreciate that the physical device structure for rendering a game map provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0257] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for rendering the game map, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the information processing physical device.
[0258] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application implements the block processing of texture resources through map block information, and then makes full use of the correlation between map blocks in the view to dynamically load and cache the texture resources of the map blocks required by the game in the task loading queue, which can ensure smooth operation of the players while saving the video memory usage of game resources.
[0259] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0260] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for rendering a game map, characterized in that: include: Creating map configuration information for different areas, wherein the map configuration information includes map block information obtained by segmenting the game map; In response to an operation instruction of the game map, determining first map block information in the game map according to the map configuration information, wherein the first map block information is map block information having view intersection in the game map; Acquire the texture resource of the loaded map block in the task loading queue according to the first map block information, wherein the task loading queue stores the loading task structure of the map block in the game map; The game map is rendered using the texture resources of the loaded map blocks.
2. The method according to claim 1, characterized in that The step of creating map configuration information for different areas includes: Obtaining game maps of different areas, dividing the game maps of the different areas, and obtaining map block information; According to the map block information, determine the map identifier to which the map block belongs and the area identifier corresponding to the game map; Creating map configuration information for different areas according to the map identifiers to which the map blocks belong and the area identifiers corresponding to the game map; Accordingly, in response to the operation instruction of the game map, determining the first map block information in the game map according to the map configuration information includes: In response to an operation instruction of the game map, determining map block information covered by the game map according to the map configuration information; The first map block information is determined in the game map by performing intersection calculation on the map block information covered by the game map and the view.
3. The method according to claim 1, characterized in that Before acquiring the texture resource of the loaded map block in the task loading queue according to the first map block information, the method further includes: Obtaining a task loading queue, wherein the task loading queue stores task loading information of a map block, wherein the task loading information includes a sequence number identifier, a tag value, and a loaded texture resource set of the map block; The task loading queue is traversed, and the texture resources of the map blocks are loaded according to the traversal results.
4. The method according to claim 3, characterized in that The traversing the task loading queue and loading the map resources of the map blocks according to the traversal results include: Traversing the task loading queue, and judging whether there is task loading information of the first map block in the task loading queue according to the traversal result; If it does not exist, a thread is called to add a loading task and a task mark of the first map chunk to the task loading queue.
5. The method according to any one of claims 1 to 4, characterized in that After the operation instruction in response to the game map, the method includes: Determining second map block information in the game map according to the map configuration information, wherein the second map block information is map block information in the game map within a preset range adjacent to the first map block; Accordingly, traversing the task loading queue and loading the texture resources of the map blocks according to the traversal results include: Traversing the task loading queue, and judging whether there is task loading information of the second map block in the task loading queue according to the traversal result; If it does not exist, a thread is called to add a loading task and a task mark of the second map chunk in the task loading queue.
6. The method according to any one of claims 1 to 4, characterized in that Before creating map configuration information of different areas, the method further includes: Determine the view information of the game map, wherein the view information includes the size information of the view and the zoom information of the view; Determine a map area of the game map displayed in the view according to the size information of the view; Determining the map area range of the game map displayed in the view through the zoom operation according to the zoom information of the view; Accordingly, after determining the view information of the game map, the method further includes: In response to the map area adjustment instruction, adjusting the position of the map area displayed in the view according to the position information carried in the adjustment instruction; In response to a zoom instruction for the map area, the range of the map area displayed in the view is adjusted according to size information carried in the zoom instruction.
7. The method according to claim 6, characterized in that After determining the view information of the game map, the method further includes: When receiving a view translation operation instruction, the task mark of the map block in the task loading queue is updated according to the map area displayed after the view translation; If the task identifier of the updated map block meets the set conditions, the loading task of the map block is deleted to release the texture resources loaded in the map block.
8. The method according to any one of claims 1 to 4, characterized in that The rendering of the game map using the texture resources of the loaded map blocks includes: Traversing the first map block information to construct vertex data of the first map block; Sending vertex data of the first map block to a vertex buffer for binding to a shader; A drawing function is called in the shader to render the game map.
9. The method according to claim 8, characterized in that Before calling the drawing function in the shader to render the game map, the method further includes: Get the index value of the unlocked area in the game map, and pass the index value of the unlocked area as an index array into the shader; Correspondingly, calling a drawing function in the shader to render the game map includes: Respectively obtain a map texture, a fog texture, and a mask texture from the texture resources of the loaded map blocks; Using the current pixel to sample in the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, traversing and determining whether the target area index value to which the current pixel belongs is stored in the index array; If it exists, the color information corresponding to the current pixel is obtained by sampling from the map map; otherwise, the color information corresponding to the current pixel is obtained by sampling from the fog map; According to the color information corresponding to the current pixel, a drawing function is called in the shader to render the game map.
10. The method according to claim 9, characterized in that Before calling a drawing function in the shader to render the game map according to the color information corresponding to the current pixel, the method further includes: Obtain the initial index value and fade-out time of the area to be unlocked in the game map, and pass the initial index value and fade-out time into the shader; Using the current pixel to sample the mask map to obtain the attribute value of the preset channel to represent the target area index value to which the current pixel belongs, and determining whether the initial index value is the same as the target area index value to which the current pixel belongs; If so, the texture resource to be sampled is determined in the texture resources of the loaded map blocks, and the color information corresponding to the current pixel is sampled from the texture resource to be sampled.
11. The method according to claim 10, characterized in that The step of determining a texture resource to be sampled from the texture resources of the loaded map blocks, and sampling the texture resource to be sampled to obtain color information corresponding to the current pixel includes: Calculate the current fading progress according to the proportion of the fading time of the area to be unlocked in the total fading time; Using the depth value randomly obtained by the fractal noise, determining whether the depth value is greater than the current fading progress; If so, the color information corresponding to the current pixel is sampled from the fog map; otherwise, the color information corresponding to the current pixel is sampled from the map map.
12. A rendering device for a game map, characterized in that: include: A creation unit, used to create map configuration information of different areas, wherein the map configuration information includes map block information obtained by segmenting the game map; A first determining unit, configured to determine first map block information in the game map in response to an operation instruction of the game map according to the map configuration information, wherein the first map block information is map block information having view intersection in the game map; A first acquisition unit, configured to acquire a texture resource of a loaded map block in a task loading queue according to the first map block information, wherein the task loading queue stores a loading task structure of a map block in a game map; A rendering unit is used to render the game map using the texture resources of the loaded map blocks.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the game map rendering method described in any one of claims 1 to 11 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the game map rendering method described in any one of claims 1 to 11 are implemented.