A game map generation method, system and device considering map resources

By analyzing the connection between character positions and map resources in role-playing combat games, the optimal movement path is generated and a pre-loading sequence is constructed, which solves the problem of map loading lag and improves the efficiency of game map generation and player experience.

CN120285563BActive Publication Date: 2025-11-04XIAMEN GUANYING NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510576466.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-11-04
Estimated Expiration
2045-05-06

AI Technical Summary

Technical Problem

In existing technologies, map loading in role-playing combat games can cause lag due to real-time updates, especially when map resources refresh and the player's path for picking up resources is fixed, resulting in slow map loading or even lag.

Method used

By analyzing the connection between the character's position and map resources, the shortest path is determined and corrected by combining it with the map terrain to generate the optimal movement path. Taking into account the effects of occlusion and path length, the movement direction is determined and a map preloading sequence is constructed to achieve predictive map preloading.

Benefits of technology

It effectively reduces lag during game map generation, improves the player's gaming experience, ensures smooth routes and reduces the impact of occlusion, optimizes path length, and enables predictive map loading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120285563B_ABST
    Figure CN120285563B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of game animation software, and discloses a game map generation method, system and device considering map resources, which comprises the following steps: acquiring a game map, refreshed map resources and a position of a character controlled by a player; generating an initial moving path of the character on the game map based on the map resources and the position of the character; correcting the part of the initial moving path passing through different terrains in combination with the terrain distribution of each position in the game map, so as to obtain an optimal moving path of the character; determining the moving direction of the character at each position in the optimal moving path based on the optimal moving path of the character and the distribution of the map resources in the game map; acquiring a map preloading sequence based on the optimal moving path in combination with the game map based on the moving direction of each position; and preloading and generating the game map based on the moving position of the character controlled by the player. The application aims to solve the problem of lagging in the update and loading of the game map with the movement of the character.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of game animation software, and particularly relates to a game map generation method, system and device considering map resources. BACKGROUND

[0002] In a role-playing battle game based on a plane map, the game map is fixed, and some map resources are refreshed in the fixed position of the game map at regular intervals. The player controls the character to move in the map to pick up resources or fight. However, the game map range displayed by the game is limited. During the movement of the character, the game map is updated, and the game map is loaded based on the moving direction of the character, so as to realize the automatic generation of the game map of the role-playing battle game.

[0003] In the prior art, the real-time generation of the game map is usually based on the moving direction of the character. The game map in the corresponding direction is loaded based on the real-time change of the moving direction of the character. However, the real-time loading of the game map will cause the background to be in a high-frequency response state all the time, which will cause the game map to be loaded too slowly or even appear to be stuck. The generation of the map resources in the game map will be accompanied by the priority loading of the nearby game map. The path of the player controlling the character to pick up the map resources is usually fixed. Therefore, a large amount of preloading of the map in the path direction can be performed to reduce the game map generation sticking problem. SUMMARY

[0004] The present application provides a game map generation method, system and device considering map resources to solve the problem of the existing game map update and loading with the character movement. The technical solution is as follows:

[0005] The present application provides a game map generation method considering map resources. The method comprises the following steps:

[0006] Obtaining the game map, the refreshed map resources and the position of the character controlled by the player;

[0007] Based on the map resources and the position of the character, an initial moving path of the character is generated on the game map. In combination with the terrain distribution of each position in the game map, the part of the initial moving path passing through different terrains is corrected to obtain an optimal moving path of the character;

[0008] Based on the optimal moving path of the character and the distribution of the map resources in the game map, the moving direction of the character at each position in the optimal moving path is determined. Based on the moving direction of each position, the game map is obtained based on the optimal moving path to obtain a map preloading sequence.

[0009] According to the map preloading sequence, the game map is preloaded and generated based on the moving position of the character controlled by the player.

[0010] Optionally, the method for generating the initial movement path of the character on the game map comprises the following specific steps:

[0011] a straight line is obtained by connecting the starting point to the ending point, as the shortest path of the character; a part of the line segment of the shortest path that does not exist on the game map is obtained as a plurality of to-be-modified paths of the character, and the area that cannot be directly passed through corresponding to the to-be-modified path is taken as the blocking area of each to-be-modified path;

[0012] According to the distribution of the blocking area of the to-be-modified path and the map resource, a modified path of each to-be-modified path is obtained.

[0013] The starting point and the ending point of the to-be-modified path are connected through the modified path; the modified paths of all the to-be-modified paths on the shortest path are obtained and replaced and connected to obtain the initial movement path of the character.

[0014] Optionally, the modified path of each to-be-modified path comprises the following specific steps:

[0015] For any to-be-modified path and its blocking area, the starting point and the ending point of the to-be-modified path are obtained in the direction from the starting point to the ending point; two paths around the two sides of the blocking area are obtained based on the starting point and the ending point of the to-be-modified path, as the candidate modified paths of the to-be-modified path.

[0016] For any candidate modified path, a connecting line between the candidate modified path and the map resource is obtained at any position of the candidate modified path, if the connecting line passes through the blocking area, the position is recorded as a blocking position, and the calculation method of the candidate non-recommendation degree α of the candidate modified path is as follows:

[0017]

[0018] Wherein, l represents the length of the candidate modified path, N ′ represents the number of blocking positions in the candidate modified path, and N0 represents the total number of positions in the candidate modified path.

[0019] The candidate modified path with the minimum candidate non-recommendation degree in the two candidate modified paths is taken as the modified path of the to-be-modified path.

[0020] Optionally, the method for obtaining the optimal movement path of the character comprises the following specific steps:

[0021] For any one of the to-be-corrected path, the correction path, obtain a plurality of line segments and curves in the segment of the correction path, as the initial local path of the segment of the correction path; from the first segment of the initial local path and the second segment of the initial local path, connect the starting point of the first segment of the initial local path to the ending point of the second segment of the initial local path, obtain a line segment and judge whether it passes through the shielding area of the to-be-corrected path, if not, as a candidate local path, obtain the candidate non-recommendation degree of the candidate local path, and the candidate non-recommendation degree obtained by regarding the first two segments of the initial local path as a path, if the former candidate non-recommendation degree is less than or equal to the latter candidate recommended degree, replace the first two segments of the initial local path through the candidate local path, and take the first local path as the starting point and the third segment of the initial local path as the ending point, and continue to replace and judge in this way;

[0022] If the former candidate non-recommendation degree is greater than the latter candidate non-recommendation degree, do not replace, and keep the first segment of the initial local path, and replace the starting point of the second segment of the initial local path with the ending point of the third segment of the initial local path, and continue in this way, finally connect the starting point and the ending point of the adjacent two segments of the initial local path, and replace and judge, and continue to judge the initial local path behind the first local path after replacement, obtain a path in which all initial local paths of the to-be-corrected path are replaced and judged, and record it as the updated path of the to-be-corrected path;

[0023] For the updated paths of the two to-be-corrected paths adjacent in sequence, obtain the line segment corresponding to the shortest distance between the two updated paths as the to-be-updated path, if the shortest distance corresponds to a plurality of line segments, take the first appearance of the line segment corresponding to the shortest distance in the position corresponding to the two updated paths of each line segment as the reference, and obtain the to-be-updated path in this way;

[0024] Split the two updated paths by the to-be-updated path, take each segment of the updated path between the positions corresponding to the to-be-updated path of the two updated paths, and the initial moving path corresponding to the ending point of the former updated path to the starting point of the latter updated path, as the contrast original path of the to-be-updated path; if the length of the to-be-updated path is less than or equal to the contrast original path, replace the contrast original path with the to-be-updated path, otherwise do not replace;

[0025] Replace and analyze all the updated paths of the two to-be-corrected paths adjacent to each other, and take the processed path as the optimal moving path of the role.

[0026] Optionally, the moving direction of each position is obtained in the following specific way:

[0027] For any position on the optimal movement path, a tangent of the optimal movement path at the position is obtained, and a direction of the tangent along the optimal movement path and pointing to the terminal point is taken as a movement direction of the position;

[0028] Based on the movement direction of each position and the distribution of the map resource, a movement deflection direction of each position is obtained through a visual angle deflection threshold judgment;

[0029] The movement direction of the i-th position is denoted as β i , and the calculation method is as follows:

[0030]

[0031] wherein, β i represents the movement direction of the i-th position, β i+1 represents the movement direction of the i+1-th position, and ε i represents the movement deflection direction of the i-th position.

[0032] Optionally, the specific acquisition method of the movement deflection direction of each position is as follows:

[0033] For any position on the optimal movement path, a direction of the position pointing to the refreshed map resource is taken as a visual angle direction of the position;

[0034] If an included angle between the visual angle direction of the position and the movement direction is greater than a visual angle deflection threshold, the visual angle deflection threshold is taken as the movement deflection direction of the position, and if the included angle is less than or equal to the visual angle deflection threshold, the visual angle direction is taken as the movement deflection direction of the position.

[0035] Optionally, the specific acquisition method of the map preloading sequence based on the optimal movement path is as follows:

[0036] A plurality of loading directions are obtained, for any position on the optimal movement path, distances between the position and a boundary of the loaded game map in eight loading directions are obtained, and a loading direction with a minimum included angle between the loading direction and the movement direction of the position is taken as a preloading direction of the position;

[0037] The calculation method of the game map loading amount D of the position is as follows:

[0038]

[0039] wherein, d0 represents a boundary distance threshold, d represents a distance between the position and the boundary of the loaded game map in the preloading direction of the position, θ represents the movement direction of the position, cos() represents a cosine trigonometric function, θ represents an included angle between the movement direction of the position and the expected preloading direction, represents a ceiling function, and min() represents a minimum value function;

[0040] The movement direction and the game map load at that location are combined into a tuple and used as the map preloading element for that location. The map preloading elements for each location on the optimal movement path are obtained and arranged in order of location to obtain the map preloading sequence based on the optimal movement path.

[0041] Optionally, the method for preloading and generating the game map based on the player's character movement position according to the map preloading sequence includes:

[0042] For any position during the movement, if the position is on the optimal movement path, obtain the element corresponding to the position in the map preloading sequence, as well as several elements after the element. Then, perform offset judgment on each of the several elements after the element relative to the element. If the absolute value of the difference between the movement direction of the element and its next adjacent element is less than or equal to the offset threshold, the next adjacent element is taken as the element to be loaded at the position. This process continues until the absolute value of the difference between the movement direction of the element and its next adjacent element is greater than the offset threshold, at which point the acquisition of the element to be loaded at the position is stopped.

[0043] When moving to this position, the game map load of each element to be loaded is preloaded one by one; if the absolute value of the difference between the movement direction of this element and its next adjacent element is greater than the offset threshold, the next adjacent element is taken as the element to be loaded at this position and the subsequent traversal judgment is stopped. When moving to the position corresponding to the next adjacent element, the position corresponding to the next adjacent element is used as the reference to judge the subsequent elements as the elements to be loaded and the game map is preloaded.

[0044] If any position is not on the optimal movement path during the movement, obtain the position projected onto the optimal movement path and use it as the projection position; obtain the elements to be loaded at the projection position and preload them.

[0045] This invention also proposes a game map generation system that considers map resources, the system comprising:

[0046] The character map acquisition module is used to acquire the game map, refreshed map resources, and the position of the player-controlled character;

[0047] The character movement analysis module is used to generate the initial movement path of the character on the game map based on map resources and character position; and to correct the part of the initial movement path that passes through different terrains by combining the terrain distribution of each location in the game map, so as to obtain the optimal movement path of the character.

[0048] The moving direction of the role at each position in the optimal moving path is determined based on the distribution of the optimal moving path and the map resource of the role-based game map.

[0049] The map loading generation module is configured to generate the game map based on the moving position of the player-controlled role according to the map preloading sequence.

[0050] The application further provides a game map generation device considering map resources, which comprises a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the steps of the above method when executing the computer program.

[0051] The application has the following beneficial effects: The application is aimed at the loading lag problem of the game map loading generation of the role-playing battle game caused by the influence of the visual angle and the movement update. When the map resource is refreshed and the player goes to pick up, the shortest path is determined by analyzing the position relationship between the role position and the map resource, and the path is adjusted in combination with the terrain in the game map. The influence of the visual angle being blocked and the path length is comprehensively considered to determine the optimal moving path and analyze the moving direction. The game map preloading direction is determined in combination with the visual angle direction, and then the game map preloading is realized based on the movement prediction of the role position change. The role position and the map resource are connected, and the blocked and vacant areas existing in the game map design are combined to correct the shortest path of the connection to obtain an initial moving path, so that the route is completely smooth. The initial moving path is optimized to reduce the blocking and the path length, and the optimal moving path is obtained by further considering the problem that the visual angle direction cannot observe the map resource due to the blocking during the process of bypassing the blocked area and the problem that the path length is increased due to bypassing along the peripheral contour of the blocked area. The moving direction of the role is determined based on the optimal moving path, and the moving direction of the role at each position in the optimal moving path is determined in combination with the visual angle direction between the role and the map resource. The direction of the map that needs to be preloaded is determined based on the moving direction, and the quantity of the preloaded game map is determined in combination with the loaded game map and the position of the role in the game map, so as to construct the map preloading sequence, realize the predictive game map preloading, and reduce the game map loading lag. The game map loading lag is effectively reduced, the influence of the map resource refresh on the game map is considered, and the game experience of the player is improved. BRIEF DESCRIPTION OF DRAWINGS

[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description only show some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0053] Figure 1 A flowchart of a game map generation method considering map resources provided by an embodiment of the present application;

[0054] Figure 2 A structural block diagram of a game map generation system considering map resources provided by another embodiment of the present application. DETAILED DESCRIPTION

[0055] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0056] Please refer to Figure 1 which shows a flowchart of a game map generation method considering map resources provided by an embodiment of the present application. The method comprises the following steps:

[0057] Step S001, obtaining a game map, refreshed map resources and a player-controlled character position.

[0058] The purpose of the present embodiment is to optimize the situation that the player-controlled character moves in the game map and the map preloading is blocked due to limited map range as the map resources are refreshed in the role-playing battle game in the flat map. Therefore, the player's moving path needs to be predicted based on the player-controlled character position and the refreshed map resources at each point in the game map, and then the preloading amount of the game map is adjusted based on the direction change of the moving path to reduce the blocking of the game map generation and loading.

[0059] Specifically, the game map of the role-playing battle game based on the flat game map, the refresh time of multiple map resources and the point refreshed in the game map, and the real-time obtained player-controlled character position are obtained, wherein the refresh time and point of the map resources are fixed, and the character position is obtained in real time. When any map resource is refreshed, the player-controlled character goes to pick up, and then the subsequent moving path is obtained based on the character position at the time of map resource refresh.

[0060] Step S002, generating an initial moving path of the role on the game map based on the map resource and the role position; combining the terrain distribution of each position in the game map, correcting the part of the initial moving path passing through different terrains to obtain the optimal moving path of the role.

[0061] It should be noted that, in the process of predicting the moving path of the role to the refreshed map resource, the moving path follows the principle of the shortest distance, and the shortest path does not completely exist in the game map due to the wall or the design of the map, that is, the shortest path does not actually exist when the wall needs to be bypassed or the design of the map has a vacancy part. Therefore, based on the game map, the initial moving path is generated on the basis of the shortest path.

[0062] Preferably, in an embodiment of the present application, the initial moving path of the role on the game map is generated based on the map resource and the role position, which includes the following specific method:

[0063] Taking the role position as the starting point and the map resource as the ending point, a straight line is connected from the starting point to the ending point as the shortest path of the role; the part of the shortest path that does not exist on the game map, that is, the line segment corresponding to the wall or the vacancy part generated by the design of the map that cannot be passed through, is obtained as the to-be-corrected path of the role, and the area that cannot be directly passed through corresponding to the to-be-corrected path is taken as the shielding area of each to-be-corrected path.

[0064] Further, for any to-be-corrected path and its shielding area, the starting point and the ending point of the to-be-corrected path are obtained in the direction from the starting point to the ending point; based on the starting point and the ending point of the to-be-corrected path, two paths around the two sides of the shielding area are obtained as the candidate correction paths of the to-be-corrected path, wherein the candidate correction paths are along the periphery of the shielding area.

[0065] It should be noted that, since the shielding area covers the to-be-corrected path, the role usually bypasses the periphery of the shielding area when passing through this part of the shielding area, that is, it travels along the periphery of the shielding area. Since the shielding area covers the to-be-corrected path, the paths on both sides will appear when bypassing along the periphery, and the moving path needs to ensure that the distance is short enough. Therefore, firstly, the lengths of the two candidate correction paths are compared, and the role moving process needs to ensure that the less the view angle of the map resource is blocked, the more preferred it is, that is, the shielding of the wall or the vacancy area to the line between the role position and the map resource is reduced during the bypassing process, so as to obtain the correction path for the to-be-corrected path.

[0066] Specifically, for any candidate correction path, the line between any position of the candidate correction path and the map resource is obtained, if the line passes through the shielding area, the position is recorded as a shielding position, and the calculation method of the candidate recommendation degree a of the candidate correction path is:

[0067]

[0068] wherein, l represents the length of the segment of the alternative modified path, N ′ represents the number of the occlusion positions in the segment of the alternative modified path, and N0 represents the total number of positions in the segment of the alternative modified path.

[0069] Further, the segment of the alternative modified path with the minimum alternative non-recommendation degree is taken as the modified path of the segment of the to-be-modified path, and the start point and the end point of the segment of the to-be-modified path are connected through the modified path; the modified path of each segment of the to-be-modified path on the shortest path is obtained and replaced, and finally the initial moving path for the character generation is obtained.

[0070] It should be further explained that after the initial moving path is generated, it reflects the positions existing along the path on the game map, and the path from the position of the character to the refreshed map resource, and the game map does not actually need to go along the wall in a straight line and turn to go forward, but can go forward in a diagonal line in advance to shorten the path length, and the terrain also has an arc-shaped occlusion part, so the path can go along the arc-shaped part, that is, the influence of the terrain change and distribution on the path needs to be considered on the basis of the initial moving path, and the path length is shortened to obtain the optimal moving path.

[0071] Preferably, in an embodiment of the present application, the initial moving path passing through different terrains is modified in combination with the terrain distribution of each position in the game map to obtain the optimal moving path of the character, and the specific method comprises:

[0072] It should be noted that the optimal moving path is actually a modification of the modified path in the initial moving path and the part of the path before and after the modified path to shorten the path and reduce the existence of the occlusion position in the moving path to provide a basis for the subsequent determination of the moving direction, that is, the comprehensive influence of the moving direction and the view direction.

[0073] Specifically, for any one segment of the to-be-corrected path, the correction path is obtained, and a plurality of line segments and curves in the segment of the correction path are obtained as the initial local path of the segment of the correction path; starting from the first segment of the initial local path and the second segment of the initial local path, connecting the starting point of the first segment of the initial local path to the ending point of the second segment of the initial local path, obtaining a line segment and judging whether it passes through the occlusion region of the to-be-corrected path, if not, it is regarded as a candidate local path, and the candidate non-recommendation degree of the candidate local path is obtained according to the above method, and the candidate non-recommendation degree of the first two segments of the initial local path is regarded as a path, if the former candidate non-recommendation degree is less than or equal to the latter candidate recommended degree, the first two segments of the initial local path are replaced by the candidate local path, and are regarded as the first local path, and the replacement judgment is continued with the starting point of the first local path and the ending point of the third segment of the initial local path, and so on; if the former candidate non-recommendation degree is greater than the latter candidate non-recommendation degree, no replacement is performed, and the first segment of the initial local path is retained, and the replacement judgment is performed with the starting point of the second segment of the initial local path and the ending point of the third segment of the initial local path, and so on. Finally, the starting point and the ending point of the adjacent two segments of the initial local path are connected, and the replacement judgment is performed, and the first local path after replacement is continued to the initial local path behind, to obtain a path in which all the initial local paths of the segment of the to-be-corrected path are replaced and the judgment is completed, which is recorded as the updated path of the segment of the to-be-corrected path.

[0074] Further, there are adjacent large-area occlusion regions, which cause the correction path of the two segments of the to-be-corrected path to actually produce a large detour after returning to the shortest path. If the occlusion regions are merged, i.e., the correction path is directly connected without returning to the shortest path, the occlusion position can be reduced and the path length can be greatly shortened.

[0075] Further, for the two segments of the to-be-corrected path adjacent in order, since the updated path needs to return to the shortest path, there is no intersection point between the two updated paths. The line segment corresponding to the shortest distance between the two updated paths is obtained as the to-be-updated path, and if the shortest distance corresponds to a plurality of line segments, the position of the first appearance of the line segment corresponding to the shortest distance in the position corresponding to the two updated paths in order is taken as the reference, and the to-be-updated path is obtained.

[0076] Furthermore, the two update paths are divided by the path to be updated. The update path between the corresponding positions of the two update paths and the initial movement path corresponding to the end point of the previous update path to the start point of the next update path are used as the reference original path for the path to be updated. If the length of the path to be updated is less than or equal to the reference original path, the reference original path is replaced by the path to be updated; otherwise, no replacement is performed. The update paths of all adjacent two segments of the path to be corrected are replaced and analyzed according to the above method. Then, by obtaining the update path and combining it with the replacement of the path to be updated, the final processed path is taken as the optimal movement path for the character.

[0077] Thus, by connecting the character's position and map resources, and considering the obstructions and gaps in the game map design, the initial movement path is obtained by correcting the shortest path of the connection, ensuring that the route is completely unobstructed. Further considering the issues of the inability to observe map resources due to the downward view when circling obstructed areas, and the increased path length caused by circling along the outer contour of obstructed areas, the initial movement path is optimized to reduce obstructions and decrease the path length, resulting in the optimal movement path.

[0078] Step S003: Based on the character's optimal movement path and the distribution of map resources in the game map, determine the character's movement orientation at each position along the optimal movement path; based on the movement orientation at each position and in conjunction with the game map, obtain a map preloading sequence based on the optimal movement path.

[0079] It should be noted that as the player controls the character to move along the optimal movement path, the direction of movement changes due to changes in the path and the distribution of map resources. The viewpoint should be pointing towards the map resources while moving along the extension direction of the movement path. This is used to comprehensively quantify the character's movement direction. Each position on the optimal movement path will correspond to a movement direction, providing a basis for the corresponding direction of the subsequent preloaded map.

[0080] Preferably, in one embodiment of the present invention, the method for determining the movement orientation of the character at each position along the optimal movement path based on the character's optimal movement path and the distribution of map resources on the game map includes:

[0081] The starting point of the optimal movement path is the character's position, and the ending point is the refreshed map resource. The direction of the entire optimal movement path is from the starting point to the ending point. For any position on the optimal movement path, obtain the tangent of the optimal movement path at that position, and take the direction of movement of the tangent along the optimal movement path towards the ending point as the movement direction of that position. If the optimal movement path at that position is a curved part, obtain the tangent; if it is a straight part, directly take the straight line as the tangent.

[0082] It is further needed to be explained that after the movement direction of each position on the optimal movement path is determined, the movement direction needs to be combined with the view direction to obtain the movement direction, that is, the view direction always points to the map resource during the movement on the optimal movement path, so as to adjust the movement direction to obtain the movement direction, and the difference between the movement direction and the view direction needs to be considered comprehensively. The view direction has little influence on the movement direction when the angle difference is small, and the greater the angle difference, the greater the influence on the movement direction. The movement direction needs to be determined between the movement direction and the view direction. At the same time, the optimal movement path cannot completely remove the shielding effect of the shielding position, so at the shielding position, the movement direction needs to change according to the change of the shielding position, that is, to ensure that the map resource as the terminal point can be found immediately when moving to the non-shielding position.

[0083] Specifically, the direction of any position on the optimal movement path to the refreshed map resource is taken as the view direction of the position. It is particularly noted that if the straight line corresponding to the view direction, that is, the line connecting the position and the map resource, is shielded by the shielding area, the straight line is rotated to the movement direction of the position. When the straight line no longer passes through any shielding area during the rotation, the direction formed by the straight line at this time and the position as the starting point is taken as the view direction of the position. A preset view deflection threshold is adopted in the embodiment, and the view deflection threshold is 45 degrees. If the angle between the view direction of the position and the movement direction is greater than the view deflection threshold, the view deflection threshold is taken as the movement deflection direction of the position. If the angle is less than or equal to the view deflection threshold, the view direction is taken as the movement deflection direction of the position.

[0084] Further, taking the i-th position on the optimal movement path as an example, the movement direction of the i+1-th position is combined to obtain the movement direction γ i of the i-th position.

[0085]

[0086] Wherein, β i represents the movement direction of the i-th position, β i+1 represents the movement direction of the i+1-th position, and ε i represents the movement deflection direction of the i-th position.

[0087] It is needed to be explained that based on the change of the movement direction of the adjacent next position, the change of the movement direction to the movement deflection direction cannot exceed the change of the movement direction of the adjacent position, so as to avoid deviation during the movement on the optimal movement path. Therefore, the determination of the movement deflection direction is limited within the maximum movement direction change range.

[0088] It is further needed to be explained that during the movement of the character along the optimal movement path, the game map needs to be preloaded according to the movement direction of the character at each position, and then through the change of the movement direction, in combination with the already loaded area of the game map and the area not loaded in the corresponding direction of the movement direction, the preloading amount of the area not loaded is sorted in the order of the movement direction, including continuously preloading the map with the same or similar movement direction, and when the movement direction changes greatly, the map in the corresponding direction is preloaded according to the movement direction of the next position, so as to obtain the map preloading sequence under the optimal movement path.

[0089] Preferably, in an embodiment of the present application, based on the movement direction of each position, in combination with the game map, the map preloading sequence based on the optimal movement path is obtained, including the specific method of:

[0090] In this embodiment, the game map is preloaded in eight directions, which are eight loading directions, i.e. 360 degrees are divided into eight directions for preloading; for any position on the optimal movement path, the distance of the position and the loaded game map boundary in eight loading directions is obtained, i.e. the distance to the loaded game map boundary along the loading direction; the loading direction with the smallest angle between the movement direction of the position is taken as the preloading direction of the position.

[0091] Further, a preset boundary distance threshold is set, and the boundary distance threshold is set to 10 in this embodiment, and then the calculation method of the game map loading amount D of the position is:

[0092]

[0093] Wherein, d0 represents the boundary distance threshold, d represents the distance of the position and the loaded game map boundary in the preloading direction thereof, θ represents the movement direction of the position, cos() represents the cosine trigonometric function, θ represents the angle between the movement direction of the position and the expected preloading direction, represents the upward rounding function, and min() represents the minimum value function.

[0094] It is needed to be explained that based on the movement direction, the optimal movement path starts from the starting position of the character controlled by the player, and the boundary distance between the character position and the loaded game map needs to be considered comprehensively, and a certain distance is reserved to avoid the unloading gap area of the game map displayed to the player, and the part of the game map that needs to be loaded during the movement of the character position needs to be quantified based on the movement direction and the offset that may occur during the movement of the character, i.e. as the loading amount of the game map at the corresponding position, so that the game map is loaded in advance to ensure that there is no loading lag during the movement of the character to the corresponding position.

[0095] Further, the moving direction of the position and the game map loading amount of the position constitute a two-tuple as the map preloading element of the position, the map preloading elements of positions on the optimal moving path are obtained, and are arranged according to the order of positions to obtain a map preloading sequence based on the optimal moving path.

[0096] So far, the moving direction of the role is determined based on the optimal moving path, and the moving direction of the role at each position on the optimal moving path is determined by combining the perspective direction between the role and the map resource. The direction of the map that needs to be preloaded is determined based on the moving direction, and the amount of the preloaded game map is determined by further combining the loaded game map and the position of the role in the game map, so as to construct the map preloading sequence, realize predictive game map preloading, and reduce game map loading lag.

[0097] Step S004, according to the map preloading sequence, preloading generation of the game map based on the moving position of the player-controlled role.

[0098] It should be noted that the map preloading sequence is generated based on the optimal moving path. When the player controls the role to move, there may be a deviation from the optimal moving path, but the overall target is still the refreshed map resource, so the moving direction will not change greatly. The projection position of the role on the optimal moving path is determined to determine the corresponding map preloading amount during the moving process, and then the preloading generation of the game map is performed based on the map preloading sequence.

[0099] Specifically, the player controls the character to move in real time, and in the process of moving to the refreshed map resource to pick up, for any position in the moving process, if the position is on the optimal moving path, the position is obtained in the corresponding element of the map preloading sequence, and the elements after the element, the elements after the element are respectively judged by the offset, and the offset threshold value of the embodiment is described by 5°, if the absolute value of the difference between the moving direction of the element and the next element is less than or equal to the offset threshold value, the next element is taken as the to-be-loaded element of the position, and the to-be-loaded element of the position is obtained in this way until the absolute value of the difference between the moving direction of the element and the next element is greater than the offset threshold value, and the to-be-loaded element of the position is stopped; when moving to the position, the game map loading amount in the to-be-loaded element is preloaded one by one; if the absolute value of the difference between the moving direction of the element and the next element is greater than the offset threshold value, the next element is directly taken as the to-be-loaded element of the position and the subsequent traversal judgment is stopped, and when moving to the position corresponding to the next element, the position corresponding to the next element is taken as the reference, the judgment of the subsequent element as the to-be-loaded element is performed, and the preloading of the game map is performed; it is particularly pointed out that if the next element and the elements after the next element are all to-be-loaded elements, the to-be-loaded element judgment of the subsequent elements is still needed after moving to the position corresponding to the next element, that is, due to the change of the reference element, the to-be-loaded element will also be expanded.

[0100] It is necessary to explain that when moving to any position, if the difference between the moving direction of the position and the positions after the position in the corresponding elements of the map preloading sequence is small, the game map loading amount in the element with small change in the subsequent moving direction can be preloaded when moving to the position; and if the difference is large, only the next element is preloaded, so that the game map can be preloaded in large quantities during the movement in the same or similar direction, that is, the movement is accompanied by subsequent preloading, avoiding the loading lag caused by movement, and only the next element is preloaded when the moving direction changes greatly, avoiding the error deviation caused by continuous loading.

[0101] Further, if any position in the moving process is not on the optimal moving path, the position projected on the optimal moving path is obtained as the projection position of the position, wherein the projection is a vertical line from the position to the optimal moving path, and the position where the vertical line intersects the optimal moving path; the projection position is obtained according to the above method, and the preloading is performed; then for the player controlling the character to move in real time, in the process of moving to the refreshed map resource to pick up, the position on the optimal moving path or the projection position, the to-be-loaded element is judged, the game map is preloaded based on the map preloading sequence, and the game map generation considering the map resource is realized.

[0102] So far, for the game map loading generation of the role playing battle type game, the loading lag problem caused by the perspective influence and the movement update, in the map resource refreshing and the player going to pick up, by analyzing the connection position relationship between the role position and the map resource, determining the shortest path and adjusting the terrain in the game map, considering the influence of the perspective being blocked and the path length, determining the optimal movement path and analyzing the movement direction, combining the perspective direction to make the game map preloading direction judgment, and then realizing the game map preloading based on the movement prediction of the role position change, effectively reducing the lag of the game map generation, considering the influence of the map resource refreshing on the game map, improving the game experience of the player.

[0103] Please refer to Figure 2 Another embodiment of the present application provides a game map generation system considering map resources, which comprises:

[0104] The role map acquisition module 101 acquires the game map, the refreshed map resource and the role position controlled by the player;

[0105] The role movement analysis module 102 generates the initial movement path of the role on the game map based on the map resource and the role position, and corrects the part of the initial movement path passing through different terrains in combination with the terrain distribution of each position in the game map to obtain the optimal movement path of the role;

[0106] Based on the optimal movement path of the role and the distribution of the map resource in the game map, the movement direction of the role at each position in the optimal movement path is determined; based on the movement direction of each position, the game map is combined to obtain the map preloading sequence based on the optimal movement path;

[0107] The map loading generation module 103 preloads and generates the game map based on the movement position of the player controlled role according to the map preloading sequence.

[0108] Another embodiment of the present application provides a game map generation device considering map resources, which comprises a memory, a processor and a computer program stored in the memory and running on the processor, and the processor implements the above method steps S001 to S004 when executing the computer program.

[0109] The above description is only the preferred embodiment of the present application, and is not used to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.

Claims

1. A game map generation method considering map resources, characterized by, The method comprises the following steps: Obtaining a game map, refreshed map resources and a position of a character controlled by a player; Based on the map resources and the position of the character, an initial moving path of the character is generated on the game map; in combination with the topographic distribution of each position in the game map, the initial moving path is corrected in the part passing through different topographies to obtain an optimal moving path of the character; Based on the optimal moving path of the character and the distribution of the map resources in the game map, the moving direction of the character at each position in the optimal moving path is determined; based on the moving direction of each position, in combination with the game map, a map preloading sequence based on the optimal moving path is obtained; According to the map preloading sequence, the game map is preloaded and generated based on the moving position of the character controlled by the player; The specific method for generating the initial moving path of the character on the game map comprises the following steps: A straight line is obtained by connecting a position of the character as a starting point and the map resources as an ending point, as a shortest path of the character; a part of the line segment that does not exist on the game map is obtained as a plurality of to-be-corrected paths of the character, and an area that cannot be directly passed through corresponding to the to-be-corrected path is taken as an occlusion area of each to-be-corrected path; According to the occlusion area of the to-be-corrected path and the distribution of the map resources, a correction path of each to-be-corrected path is obtained; The starting point and the ending point of the to-be-corrected path are connected through the correction path; the correction path of each to-be-corrected path on the shortest path is obtained and replaced to obtain the initial moving path of the character; The specific method for obtaining the correction path of each to-be-corrected path comprises the following steps: For any to-be-corrected path and its occlusion area, the starting point and the ending point of the to-be-corrected path are obtained in the direction from the starting point to the ending point; based on the starting point and the ending point of the to-be-corrected path, two paths bypassing the two sides of the occlusion area are obtained as the candidate correction paths of the to-be-corrected path; For any one segment of the candidate modified path, a connection between the segment of the candidate modified path and the map resource is obtained at any one position of the segment of the candidate modified path, if the connection passes through the shielding area, the position is recorded as a shielding position, and the candidate non-recommendation degree of the segment of the candidate modified path is calculated according to the following formula: The calculation method of the candidate non-recommendation degree is as follows: wherein, represents the length of the segment of the alternative correction path, represents the number of occluded positions in the segment of the alternative correction path, represents the total number of positions in the segment of the alternative correction path; The candidate correction path with the minimum candidate non-recommendation degree of the two candidate correction paths is taken as the correction path of the to-be-corrected path.

2. The game map generation method considering map resources according to claim 1, wherein, The specific method for obtaining the optimal moving path of the character comprises the following steps: For the correction path of any to-be-corrected path, a plurality of line segments and curves in the correction path are taken as initial local paths of the correction path; starting from the first initial local path and the second initial local path, the starting point of the first initial local path is connected to the ending point of the second initial local path to obtain a line segment and determine whether the line segment passes through the occlusion area of the to-be-corrected path; if not, the line segment is taken as a candidate local path, the candidate non-recommendation degree of the candidate local path is obtained, and the candidate non-recommendation degree obtained by regarding the first two initial local paths as a path is obtained; if the candidate non-recommendation degree of the former is less than or equal to the candidate recommendation degree of the latter, the first two initial local paths are replaced by the candidate local path, which is taken as the first local path, and the replacement judgment is continued by connecting the starting point of the first local path to the ending point of the third initial local path, and so on. If the un-recommendation degree of the former candidate is greater than that of the latter candidate, no replacement is performed, and the first initial partial path is retained, and the start point of the second initial partial path and the end point of the third initial partial path are replaced and judged, and the like is repeated, finally, the start point and the end point of adjacent two initial partial paths are connected, and the replacement judgment is performed, and the first partial path after replacement is continuously judged to the initial partial path behind, and a path in which all initial partial paths of the to-be-corrected path are replaced and judged is obtained, and is recorded as an updated path of the to-be-corrected path; For the updated paths of two adjacent to-be-corrected paths in sequence, a line segment corresponding to the shortest distance between the two updated paths is obtained as a to-be-updated path, and if the shortest distance corresponds to a plurality of line segments, the position of the first line segment corresponding to the shortest distance in the position of the former updated path in the two updated paths is taken as a reference, and the to-be-updated path is obtained; The two updated paths are segmented by the to-be-updated path, and each segment of the updated path between the positions corresponding to the to-be-updated path of the two updated paths and the initial moving path corresponding to the end point of the former updated path to the start point of the latter updated path are taken as the contrast original path of the to-be-updated path; if the length of the to-be-updated path is less than or equal to the contrast original path, the to-be-updated path is replaced by the contrast original path, otherwise, no replacement is performed; The replacement analysis is performed on all adjacent two updated paths of the to-be-corrected path, and the processed path is taken as the optimal moving path of the role.

3. The game map generation method considering map resources according to claim 1, wherein, The specific acquisition method of the moving direction of each position is as follows: For any position on the optimal moving path, the tangent line of the optimal moving path at the position is obtained, and the tangent line is taken as the moving direction of the position in the direction of the optimal moving path pointing to the end point; Based on the moving direction of each position and the distribution of the map resource, the moving deflection direction of each position is obtained through the view deflection threshold judgment. The method for calculating the movement of the first position towards the second position is: wherein, represents the moving direction of the first position, represents the moving direction of the first position, represents the moving direction of the first position.

4. The game map generation method considering map resources according to claim 3, wherein, The specific acquisition method of the moving deflection direction of each position is as follows: The direction of any position on the optimal moving path pointing to the refreshed map resource is taken as the view direction of the position. If the included angle between the view direction of the position and the moving direction is greater than the view deflection threshold, the view deflection threshold is taken as the moving deflection direction of the position, and if the included angle is less than or equal to the view deflection threshold, the view direction is taken as the moving deflection direction of the position.

5. The game map generation method considering map resources according to claim 1, wherein, The specific acquisition method of the map preloading sequence based on the optimal moving path is as follows: A plurality of loading directions are obtained, for any position on the optimal moving path, the distances of the position to the loaded game map boundary in eight loading directions are obtained; the loading direction with the smallest included angle between the moving direction of the position and the loading direction is taken as the preloading direction of the position; The position of the game map loading amount The calculation method is: wherein, denotes a border distance threshold, denotes the distance of the position from the preloaded direction of the loaded game map border, denotes the movement orientation of the position, denotes the cosine trigonometric function, denotes the angle of the movement orientation of the position to the expected preloaded direction, denotes the ceiling function, denotes the min function; The moving direction of the position and the game map loading amount of the position form a binary tuple as the map preloading element of the position, the map preloading elements of all positions on the optimal moving path are obtained, and are arranged in the order of positions to obtain the map preloading sequence based on the optimal moving path.

6. The game map generation method considering map resources according to claim 5, wherein, The method comprises the following steps of: For any position in the moving process, if the position is on the optimal moving path, the position corresponding element in the map preloading sequence and a plurality of elements after the element are obtained, and the plurality of elements after the element are respectively sequentially subjected to offset judgment with the element, if the absolute value of the difference between the moving direction of the element and the adjacent next element is less than or equal to the offset threshold, the adjacent next element is taken as the to-be-loaded element of the position, and the like is continued until the absolute value of the difference between the moving direction of the element and the element after the element is greater than the offset threshold, and the to-be-loaded element of the position is stopped being obtained; When moving to the position, the game map loading amount in the to-be-loaded element is sequentially preloaded; if the absolute value of the difference between the moving direction of the element and the adjacent next element is greater than the offset threshold, the adjacent next element is taken as the to-be-loaded element of the position and the subsequent traversal judgment is stopped, and when moving to the position corresponding to the adjacent next element, the position corresponding to the adjacent next element is taken as the reference to judge the subsequent element as the to-be-loaded element and preloading the game map; If any position in the moving process is not on the optimal moving path, the position corresponding to the projection of the position on the optimal moving path is taken as the projection position of the position; the to-be-loaded element of the projection position is obtained and preloaded.

7. A game map generation system that takes into account map resources, characterized by, The system comprises: A character map obtaining module is configured to obtain a game map, refreshed map resources, and a position of a character controlled by a player. An analysis module is configured to generate an initial moving path of the character on the game map based on the map resources and the position of the character, and correct portions of the initial moving path passing through different terrains based on terrain distribution of each position in the game map to obtain an optimal moving path of the character. Based on the optimal moving path of the character and distribution of the map resources in the game map, moving directions of each position in the optimal moving path of the character are determined, and a map preloading sequence based on the optimal moving path is obtained based on the moving directions of each position and the game map. A map loading generation module is configured to pregenerate the game map based on the player moving the position of the character according to the map preloading sequence. 8.A game map generation device considering map resources, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, The processor executes the computer program to realize the steps of the game map generation method considering map resources according to any one of claims 1-6.

Citation Information

Patent Citations

  • Generation method, device and equipment of mirror image island map in game and storage medium

    CN112245916A

  • Game map generation method and device, storage medium and computer equipment

    CN119280802A