Method and device for generating region in multi-level map, electronic equipment and storage medium
The method addresses inefficiencies in large-scale map design by using polygonal areas and layer-based adjustments to optimize area boundaries, improving accuracy and reducing resource demands in multi-level maps for open world games.
Patent Information
- Application Number
- CN202411185904.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-06
AI Technical Summary
Existing map design methods for large-scale open world games are inefficient and resource-intensive, leading to inconsistent area division, high performance demands, and large storage requirements due to pixel-based region coloring, which affects visual quality and gaming experience.
A method for generating areas in multi-level maps using polygonal areas, adjusting their shapes based on ownership relationships between adjacent layers, reducing the need for pixel-level processing and optimizing boundaries to improve accuracy and reduce computational and storage demands.
The method enables efficient, accurate, and resource-friendly area division in multi-level maps, enhancing gaming experience by minimizing performance bottlenecks and storage needs while maintaining visual quality.
Smart Images

Figure CN119090996A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of map design technology, and in particular to a method, device, electronic device and storage medium for generating areas within a multi-level map. Background Art
[0002] In traditional map design, designers usually complete the map area division manually. This process is tedious and time-consuming, and is easily affected by human factors, which may lead to inconsistent or incorrect area division, thus affecting the final game experience. Therefore, in order to improve the efficiency of map production, it is crucial to adopt a suitable automated map area division method to improve the work efficiency of map design.
[0003] At present, the existing map region division method adopts the pixel-based region coloring technology, which makes the boundaries of each region appear jagged, which may lead to errors in the recognition of region division. Especially in the map design scenario of large-scale open world games, it is usually necessary to design multi-level game maps. The map scale is extremely large, and the number of pixels increases accordingly. The performance and storage requirements of the device are very high, which makes this technology unsuitable for generating multi-level game maps.
[0004] Therefore, how to provide a method that can quickly complete the area division in a multi-level map while reducing the requirements for performance and storage is a technical problem that needs to be solved. Summary of the invention
[0005] One of the purposes of the present invention is to provide a method, device, electronic device and storage medium for generating regions in a multi-level map, which can quickly and accurately complete the division of regions in a multi-level map, and has low requirements on the performance and storage of the device. The embodiments of the present invention can be implemented as follows:
[0006] In a first aspect, the present invention provides a method for generating areas in a multi-layer map, the method comprising: determining the number of map layers and the number of areas in each map layer; generating a plurality of polygonal areas consistent with the number of areas in each map layer; for two adjacent map layers, determining the ownership relationship between the polygonal areas in the lower map layer and the polygonal areas in the upper map layer; in the ownership relationship, adjusting the area shape of the polygonal areas in the upper map layer using the edge information of the polygonal areas in the lower map layer until the area shape adjustment of all the polygonal areas in the upper map layer is completed.
[0007] In an optional embodiment, in the attribution relationship, the area shape of the polygonal area in the upper map is adjusted using the edge information of the polygonal area in the lower map until the area shape of all the polygonal areas in the upper map is adjusted, including: determining the edge set of each polygonal area in each layer of the map; and according to the edge set, edge merging the polygonal area of the lower map in the attribution relationship with the polygonal area in the upper map to complete the adjustment of the area shape of the polygonal area in the upper map.
[0008] In an optional embodiment, based on the edge set, the polygonal area of the lower map in the attribution relationship is edge-fused with the polygonal area in the upper map to complete the adjustment of the regional shape of the polygonal area in the upper map, including: adding each edge of the area of the lower map in the attribution relationship to a temporary edge set of the polygonal area of the upper map; if there are two duplicate edges in the temporary edge set, deleting the two duplicate edges from the temporary edge set, and then replacing the edge set of the polygonal area of the upper map with the temporary edge set.
[0009] In an optional embodiment, for two adjacent layers of maps, the ownership relationship between the polygonal area in the lower layer map and the polygonal area in the upper layer map is determined, including: determining the center point of each polygonal area in each layer of the map; for each center point of the lower layer map, determining a target polygonal area containing the center point in the upper layer map; and establishing the ownership relationship between the polygonal area where the center point is located and the target polygonal area.
[0010] In an optional implementation, establishing the belonging relationship between the polygonal area where the center point is located and the target polygonal area includes: adding the polygonal area where the center point is located to a sub-area set of the target polygonal area.
[0011] In an optional embodiment, a plurality of polygonal areas consistent with the number of areas are generated in each layer of the map, including: for each layer of the map, a plurality of seed points consistent with the number of areas are randomly generated within a preset map range; and a plurality of polygonal areas are generated based on the plurality of seed points and the map range.
[0012] In an optional embodiment, before generating a plurality of areas in each layer of the map that is consistent with the number of areas, the method further comprises: determining the order of area generation and the order of attribution determination for each layer of the map according to the size of the level identifier of each layer of the map; wherein the larger the level identifier, the higher the map level.
[0013] In a second aspect, the present invention provides a device for generating areas in a multi-layer map, comprising a generation module, a determination module and an adjustment module; the determination module is used to determine the number of map layers and the number of areas in each layer of the map; the generation module is used to generate a plurality of polygonal areas consistent with the number of areas in each layer of the map; the determination module is also used to determine, for two adjacent layers of maps, the ownership relationship between the polygonal areas in the lower map and the polygonal areas in the upper map; the adjustment module is used to adjust the area shape of the polygonal areas in the upper map using the ownership relationship until the area shape of all the polygonal areas in the upper map is adjusted.
[0014] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method for generating areas within a multi-level map as described in any one of the aforementioned implementations.
[0015] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for generating a region in a multi-level map as described in any one of the aforementioned implementations is implemented.
[0016] The method, device, electronic device and storage medium for generating regions in a multi-layer map provided by the embodiment of the present invention have the following advantages: the embodiment of the present invention first generates a corresponding number of polygonal regions on each layer of the map based on the number of map layers and the number of regions to be divided in each layer of the map. These initially generated regions are only intermediate forms, not final forms. The core of the embodiment of the present invention is that by establishing the attribution relationship between the regions in two adjacent layers of the map, the region of the lower map is used to optimize the region shape of the upper map, that is, the region boundary, to achieve accurate reorganization of the region shape. This regional adjustment based on the characteristics of maps at different levels can make the map design more in line with the needs of actual application scenarios, avoid unreasonable boundary division, and ensure that the region division of each layer of the map is accurate and correct. In addition, the embodiment of the present invention replaces pixel-level processing with edge-level data processing, which can reduce the amount of calculation, improve the processing speed, and significantly reduce the demand for computing device performance and storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0018] Figure 1It is a schematic flow chart of a method for generating a map area of an existing game scene;
[0019] Figure 2 A schematic flow chart of a method for generating a region in a multi-layer map according to an embodiment of the present invention;
[0020] Figure 3 Another schematic flow chart of a method for generating a region in a multi-layer map according to an embodiment of the present invention;
[0021] Figure 4 A functional module diagram of a device for generating a region in a multi-layer map provided by an embodiment of the present invention;
[0022] Figure 5 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0026] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0027] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0028] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0029] The following first introduces relevant terms involved in the embodiments of the present invention.
[0030] Voronoi diagram: Voronoi diagram is also called Dirichlettessellation or Thiessen polygon. The problem solved by Voronoi diagram is actually to divide the plane into different regions based on a set of specific points, and each region contains only one specific point, and the distance from any position in the region to the specific point is closer than to other specific points.
[0031] Large open world games: are electronic games that allow players to freely explore and interact in a vast open virtual world. The characteristics of this type of game usually include: large maps, high freedom of exploration for players, and rich interactive design. At the same time, it will also design a complex task system, rich plot lines, and diverse gameplay. While allowing players to freely explore the world, they can also experience endless fun and fulfilling game challenges.
[0032] Multi-level map: It is a map structure that is layered from top to bottom. Similar to the administrative division map in real life, the multi-level map subdivides the map of a certain range into multiple levels. In addition to the most basic map, each level of the map is composed of more detailed maps at the lower level. For example, the world map is a multi-level map. It contains sub-maps of various countries and regions, such as the map of China, the map of the United States, and the map of Japan. These sub-maps are stitched together to form a full picture of the world. At the same time, the map of China can be subdivided into sub-maps of various provincial administrative regions. By continuously exploring, it can be decomposed to the basic primitives of a single shape. This map design method that fundamentally adopts a layered structure is what we call a multi-level map. It uses a structure that is continuously refined from top to bottom to achieve map recognition and application at different scales.
[0033] Thiessen polygon region: Referring to the definition of Voronoi diagram, the Thiessen polygon region contains a center point (the center point is one of the specific points used to generate the Voronoi diagram) and several edges surrounding the region. All points in the Thiessen polygon region have the property of being closest to the center point of the region in the Voronoi diagram.
[0034] At present, in order to improve the efficiency of map design, it is very important to adopt a suitable automatic map area division method to improve the efficiency of map design. Taking the game scene as an example, Figure 1A schematic diagram of a method for automatically dividing map regions in a game scene is shown. This region division method is based on pixel-based region coloring technology, which divides the entire map into small map pixels and then Figure 1 S11 to S14 shown are to determine the ownership of each area.
[0035] like Figure 1 As shown, first, the map is subdivided into many independent pixel units, each pixel represents a basic unit on the map. Then, the game system will select several pixel points on the map as the control center of the camp. These center points usually represent the core area or strategic location of the camp. In order to determine the sphere of influence of each camp, the system uses the BFS (Breadth-First Search) algorithm to expand outward from these center points. Breadth-first search is an effective graph traversal method that determines the influence range of each pixel by expanding layer by layer. During the expansion process, each pixel will determine its final ownership based on its distance from the center point and the distance from other camps. Finally, the result of this search and expansion divides the map into multiple jagged areas, each of which is dyed with a specific color to represent its corresponding camp or player.
[0036] The inventor discovered through research that Figure 1 The map area division method shown has the following defects:
[0037] First, when the map is divided into many tiny pixel units, the boundaries of each area will inevitably appear jagged. This jagged boundary may affect the visual effect of the map, and in high-contrast or detailed scenes, it may also cause players to misjudge the boundaries of the area.
[0038] Second: These technical limitations are particularly evident when designing large-scale open world game maps. As the map size is extremely large, the pixel unit order of magnitude also increases, which places extremely high demands on computing resources and processing power. Large-scale maps require not only efficient area division algorithms, but also powerful hardware to achieve real-time rendering and updates, otherwise it may cause performance bottlenecks or delays during game operation.
[0039] Third: Since the boundaries of each pixel need to be accurately marked and stored, the exported map files are usually very large. This large-scale data storage not only increases the installation size of the game, but may also slow down the file loading and processing speed, affecting the player's gaming experience. In addition, maintaining these huge amounts of map files also brings more challenges to the development team, including data backup, version control, and resource optimization.
[0040] In order to solve the above technical problems, the embodiment of the present invention provides a method for generating regions in a multi-layer map, which can quickly divide each region in each layer of the map and reorganize the shape of the region of the upper map based on the regional association between the upper and lower maps, thereby completing the precise division of the region in each layer of the map. At the same time, this method can replace pixel-level processing with edge-level data processing, significantly reducing the demand for computing device performance and storage space, and is suitable for the design scenario of large open world maps.
[0041] See also Figure 2 , Figure 2 This is a schematic flow chart of a method for generating regions in a multi-layered map provided by an embodiment of the present invention. The method may be executed by a device with data processing capabilities, including but not limited to a personal computer, a server, etc. The method may be applied, but not limited to, to the design of large open world maps. Figure 2 As shown, the process of the method for generating a region in a multi-level map provided by an embodiment of the present invention includes:
[0042] S201, determining the number of map layers and the number of regions in each map layer;
[0043] S202, generating a plurality of polygonal areas in each layer of the map that is consistent with the number of areas;
[0044] S203, for two adjacent layers of maps, determining the attribution relationship between the polygonal area in the lower layer map and the polygonal area in the upper layer map;
[0045] S204: In the attribution relationship, the shape of the polygonal area in the upper map is adjusted using the edge information of the polygonal area in the lower map, until the shape of the polygonal area in all the upper maps is adjusted.
[0046] In the scheme of the above steps S201 to S204 provided by the present invention, the number of map levels required and the number of areas that each map level should contain are first determined. Based on these parameters, a corresponding number of polygonal areas will be generated on each map level. These initially generated areas are only intermediate forms, not final forms. The core of the embodiment of the present invention is to establish the ownership relationship between the areas in two adjacent map levels, and use the areas of the lower map to optimize the area shape of the upper map, that is, the area boundary, to achieve accurate reorganization of the area shape. This regional adjustment based on the characteristics of maps at different levels can make the map design more in line with the needs of actual application scenarios, avoid unreasonable boundary division, and ensure that the area division of each map level is accurate and correct. In addition, the embodiment of the present invention replaces pixel-level processing with edge-level data processing, which can significantly reduce the demand for computing device performance and storage space.
[0047] The implementation methods of each of the above steps will be clearly and detailedly introduced below.
[0048] In step S201, the number of map layers and the number of regions in each map layer can be flexibly set by the designer according to actual needs, and the embodiment of the present invention does not limit this. The polygonal region can be regular or irregular in shape.
[0049] For the convenience of description, the number of map layers is recorded as N, and the level identifier of each map layer can be 1 to N from small to large. The larger the level identifier, the higher the map level. The number of regions is recorded as K, and the number of regions in the i-th layer map is recorded as K i (i∈[1,N],i∈Z+) represents.
[0050] In one embodiment of the present invention, the number of regions corresponding to each layer of maps is different. Moreover, the number of regions in each layer of maps is preferably set to be more than one times the number of regions corresponding to the upper layer of maps in each layer of maps, that is, K i >2*K i+1 .
[0051] In one embodiment of the present invention, before executing steps S202 to S204, the order of generating the regions in the map and the order of determining the attribution relationship may be determined according to the size of the level identifier. Therefore, before step S202, the embodiment of the present invention may also:
[0052] The order of area generation and the order of attribution determination of each layer of the map are determined according to the size of the layer identifier of each layer of the map; the larger the layer identifier, the higher the map layer;
[0053] In one implementation, the regions in each layer of the map may be generated in descending order of the level identifiers, and the ownership relationship may be determined in descending order of the level identifiers. For example, for an N-layer map, assuming that the level identifiers are 1 to N, the regions in each layer of the map may be generated in the order from the Nth layer map to the 1st layer map. The ownership relationship of the regions of the lower layer map and the upper layer map may be determined in the order from the 1st layer to the Nth layer.
[0054] It should be understood that the above implementation is only an example of the embodiment of the present invention, and should not be understood as a limitation on the order of region generation and the order of attribution determination in the embodiment of the present invention. Designers can flexibly arrange these orders according to the hierarchical identifier, and the embodiment of the present invention does not limit this.
[0055] In one embodiment of the present invention, the two tasks of generating regions and determining the ownership relationship may be performed alternately or serially.
[0056] Serial means that the embodiment of the present invention can complete the region generation task of each layer of the map at one time, and then perform the task of determining the region ownership relationship for two adjacent layers of the map in the order from the lowest layer to the highest layer. For example, for an N-layer map, multiple regions can be generated in the N-layer map to the 1st layer map in sequence. Then, starting from the 1st layer map, the region ownership relationship between the 1st layer and the 2nd layer is determined in sequence, and so on, the 2nd layer and the 3rd layer, the 3rd layer and the 4th layer are completed in sequence until the Nth layer map is reached.
[0057] Cross-execution means that the embodiment of the present invention can start executing the region generation task from the highest layer map, and after completing the region generation in two adjacent layers of maps, determine the ownership relationship between the regions in this set of adjacent layers of maps, and so on, until the first layer of maps. For example, you can first generate regions in the Nth layer map, then generate regions in the N-1th layer map, and then determine the region ownership relationship between the Nth layer map and the N-1th layer map. After completion, continue to execute the region generation task for the N-2th layer map, and so on, until the ownership relationship between the second layer map and the first layer map is determined.
[0058] The following describes how to generate multiple polygonal areas in each map layer in an embodiment of the present invention.
[0059] In step S202, multiple polygonal areas are generated in each layer of the map according to the determined number of areas. An implementation of step S202 is as follows:
[0060] Step b1: for each layer of the map, a number of seed points consistent with the number of regions are randomly generated within a preset map range;
[0061] In one embodiment of the present invention, assuming that the map size can be represented by the size of the area enclosed by the width and height, the map range can be represented as [W min ,W max ][H min ,H max ]. For step b1, within the i-th layer map, you can min ,W max ],y∈[H min ,H max ] Randomly generate K i seed points, and obtain the point set P corresponding to the i-th layer map i , and so on, we can get the point set of each layer of the map.
[0062] Step b2: Generate multiple polygonal areas according to multiple seed points and map ranges.
[0063] In the embodiment of the present invention, the existing polygonal region generation algorithm can be used for implementation.
[0064] For example, the embodiment of the present invention preferentially selects the Voronoi map area, so for the i-th layer map, the point set P can be used i The map range [Wmin, Wmax] [Hmin, Hmax] is used as the input of the Voronoi diagram generation algorithm to generate a K i The set A of Voronoi graph regions i .
[0065] After generating multiple areas in each layer of the map, you can also collect the edges of each area for backup, to provide data basis for subsequent area shape adjustments.
[0066] The following describes the process of determining the region belonging relationship between two adjacent layers of maps in an embodiment of the present invention.
[0067] In step S203, for two adjacent layers of maps, the one with a smaller layer identifier is used as the lower layer map, and the one with a larger layer identifier is used as the upper layer map. Then the method for determining the region attribution relationship between the upper layer map and the lower layer map can be:
[0068] Step c1: determine the center point of each polygonal area in each layer of the map;
[0069] In one embodiment of the present invention, the center point of each polygonal area of each layer of the map can be calculated using existing center point determination methods, including but not limited to calculating the center of mass, calculating the center of a circumscribed circle, or other algorithms for determining the center point, which is not limited in this embodiment of the present invention.
[0070] Taking the Voronoi diagram region as an example, the center point can be approximately determined by calculating the centroid (i.e., the average point) of all points in the region; or, for complex or irregular Voronoi diagrams, the equilibrium point of the region can be found as the center point through an iterative process; or, a specific algorithm can be used to determine the center of the Voronoi diagram region. For example, if the Voronoi diagram region is formed by calculating the interior points of the convex hull, then the algorithm for calculating the interior points of the convex hull can be used to approximate the center.
[0071] It should be noted that each Voronoi diagram region may have different shapes and sizes, so an appropriate method for determining the center point may be selected based on the shape of the Voronoi diagram region actually generated.
[0072] Step c2: for each center point of the lower map, determine the target area containing the center point in the upper map;
[0073] In one embodiment of the present invention, each center point of the lower map may be first mapped or transferred to the coordinate system of the upper map so that comparison can be made within the same reference frame. The boundaries of each region in the upper map are then determined. For each polygonal region in the upper map, a point-in-polygon determination method is used to determine whether the center point of the lower map is within the region.
[0074] Step c3: Establish the belonging relationship between the polygonal area where the center point is located and the target polygonal area.
[0075] In one embodiment of the present invention, considering that each polygonal area of the lower map may have an ownership relationship with different polygonal areas in the upper map, in order to facilitate and clearly manage these ownership relationships, the following implementation method can be used when establishing the ownership relationship:
[0076] The polygonal area where the center point is located is added to the sub-area set of the target polygonal area.
[0077] For ease of understanding, the center point is recorded as Pcenter. Assume that the two adjacent layers of maps are the i-th layer map and the i+1-th layer map. As mentioned earlier, the area set of the i-th layer map is recorded as A. i , the area set of the i+1th layer map is denoted as A i+1 In order to facilitate the distinction, the embodiment of the present invention will be i,k (k∈[1,K i ]) where “k” represents the area set A of the i-th layer map i The kth polygonal area in i+1,k’ (k'∈[1,K i+1 ]) where “k'” represents the region set A of the i+1th layer map i+1 The k'th polygonal area within .
[0078] Then, in the i-th layer map, for the region set A i Each area a i,k , take its center point Pcenter, and use Pcenter in the area set A of the i+1 layer map i+1 Find the region a that contains this Pcenter i+1,k , then create a i,k and a i+1,k’ The relationship between them can be understood as a i,k is a i+1,k’ sub-region.
[0079] In the embodiment of the present invention, except for the lowest layer map, an empty sub-region set can be created in advance for each multi-deformation region of each layer map, denoted as subA. i,k,i∈[2,N],k∈[1,K i ], used to maintain sub-regions of the polygonal region.
[0080] The following describes a process of adjusting the shape of a region by using the obtained region belonging relationship in an embodiment of the present invention.
[0081] In step S204, in the embodiment of the present invention, each polygonal area is defined by a set of boundaries, so the area shape of the polygonal area can be represented by a set of edges. The implementation method of step S204 in the embodiment of the present invention is as follows:
[0082] Step d1: determine the edge set of each polygonal area in each layer of the map;
[0083] Step d2: According to the edge set, edge fusion is performed on the polygonal area of the lower map in the belonging relationship with the polygonal area in the upper map to complete the adjustment of the area shape of the polygonal area in the upper map.
[0084] In one embodiment of the present invention, for the polygonal areas of the upper map in the attribution relationship, the sub-areas of the polygonal areas in the lower map are used to perform edge fusion, so that the polygonal areas in the upper map can be accurately reorganized in shape. This method not only optimizes the geometric structure of the map, but also improves the flexibility and dynamics of map design, thereby ensuring the accuracy of area division within the multi-level map.
[0085] In one embodiment of the present invention, an optional implementation method for achieving edge fusion is: adding each edge of the area of the lower map in the belonging relationship to the temporary edge set of the polygonal area of the upper map; if there are two duplicate edges in the temporary edge set, the two duplicate edges are deleted from the temporary edge set, and then the temporary edge set is used to replace the edge set of the polygonal area of the upper map.
[0086] For ease of understanding, assume that for all a i,k ∈A i ,i∈[2,N],k∈[1,K i ], its sub-region set is denoted as subA i,k , subA i,k All sub-regions in are denoted as b, b∈subA i,k , and denote the edge of region b as e, and the edge set as E b First, a i,k Create a temporary edge set tmpE for subA i,kFor each region b in tmpE, add all edges e to tmpE. If the edge e already exists in tmpE, delete it from tmpE. After completing the fusion operation on all edges in the regions of the sub-region set, replace the multi-edge region a with tmpE. i,k The edge set of . i,k ∈A i After all edge fusion operations are completed, region set A i That is the division of the i-th layer map.
[0087] Through the edge fusion operation, the edges of the upper region can be replaced by an edge set (large region) formed by combining the edges of the lower region, so that the shape of the upper region is the same as the shape formed by combining the edges of the lower region.
[0088] Based on the content of the above embodiment, in order to comprehensively understand the process of the multi-level map area generation method provided by the embodiment of the present invention, the embodiment of the present invention also provides a flow chart, such as Figure 3 As shown, Figure 3 Another schematic flow chart of a multi-layer map region generation method provided by an embodiment of the present invention shows an example of cross-completing region generation tasks and attribution relationship determination tasks in order from the Nth layer to the first layer, which may include the following steps:
[0089] S31: Determine the number of map layers N and the number of regions K in each map layer i (i∈[1,N]), determine the map size [W min ,W max ][H min ,H max ];
[0090] S32: Initialize i=N, K=K i ;
[0091] S32: In x∈[W min ,W max ],y∈[H min ,H max ] randomly generate K seed points within the range of ] to form the point set P of the i-th layer map i ;
[0092] S34: Use point set P i and map size [W min ,W max ][H min ,H max ] is used as the input of the Voroi map generation algorithm to generate the region set A of the i-th layer map i ;
[0093] S35: Determine whether i is equal to N;
[0094] If yes, execute S36 and then return to execute S32; if no, execute S37;
[0095] S36: Let i = i-1, K = K i-1 ;
[0096] S37: For region set A i Each a in i,k (k∈[1,K i ]) Take the center point P center , and use P center In area set A i+1 Find the one containing P center Area a i+1,k’ (k'∈[1,K i+1 ]) and a i,k Join a i+1,k’ The sub-region set subA i+1,k’ ;
[0097] S38: Determine whether i is equal to 1;
[0098] If yes, execute S39; if no, return to execute S36;
[0099] S39: let i=2;
[0100] S310: For region set A i Each a in i,k , belonging to subA i,k All the edges e of each sub-region b are added to the temporary set tempE. If there are two duplicate edges in tempE, delete them and use the obtained tempE as a i,k The edge set, each adjusted a i,k The region set A i As the regional division of this layer;
[0101] S311: Determine whether i is equal to 1;
[0102] If yes, execute S313; if no, execute S312 and return to execute S310;
[0103] S312: Let i=i+1.
[0104] S313: Complete the area generation task within the N-layer map.
[0105] From the above content, it can be seen that the method for generating areas in a multi-level map provided by the embodiment of the present invention completes the division of areas in a multi-level game map by generating polygonal areas and adjusting the shapes of the areas in each layer of the map, that is, reorganizing the shapes of the upper-layer maps, thereby improving the work efficiency and accuracy of multi-level map design.
[0106] Based on Figure 2 With the same inventive concept, the embodiment of the present invention also provides a device for generating a region in a multi-level map. Figure 4 , Figure 4 The functional module diagram of the multi-layer map region generation device provided by the embodiment of the present invention is as follows: The multi-layer map region generation device 40 may include: a determination module 401 , a generation module 402 and an adjustment module 403 .
[0107] A determination module 401 is used to determine the number of map layers and the number of regions in each map layer;
[0108] A generating module 402, for generating a plurality of polygonal areas in each layer of the map, the number of which is the same as the number of areas;
[0109] The determination module 401 is further used to determine the attribution relationship between the polygonal area in the lower map and the polygonal area in the upper map for two adjacent layers of maps;
[0110] The adjustment module 403 is used to adjust the area shapes of the polygonal areas in the upper map by using the belonging relationship until the area shapes of all the polygonal areas in the upper map are adjusted.
[0111] It is understandable that the determination module 401, the generation module 402 and the adjustment module 403 can be executed in coordination. Figure 2 Each step in the process is performed to achieve the corresponding technical effect.
[0112] In an optional implementation, the adjustment module 403 is specifically used to determine the edge set of each polygonal area in each layer of the map; based on the edge set, the polygonal area of the lower layer map in the belonging relationship is edge-fused with the polygonal area in the upper layer map to complete the adjustment of the regional shape of the polygonal area in the upper layer map.
[0113] In an optional implementation, the adjustment module 403 is specifically used to: add each edge of the area of the lower map in the belonging relationship to the temporary edge set of the polygonal area of the upper map; if there are two duplicate edges in the temporary edge set, delete the two duplicate edges from the temporary edge set, and then replace the edge set of the polygonal area of the upper map with the temporary edge set.
[0114] In an optional implementation, the determination module 401 is specifically used to determine the center point of each polygonal area in each layer of the map; for each center point of the lower layer map, determine the target polygonal area containing the center point in the upper layer map; and establish an ownership relationship between the polygonal area where the center point is located and the target polygonal area.
[0115] In an optional implementation, the determination module 401 is specifically configured to add the polygonal region where the center point is located to the sub-region set of the target polygonal region.
[0116] In an optional implementation, the generation module 402 is specifically configured to randomly generate a plurality of seed points that are consistent with the number of regions within a preset map range for each layer of the map; and generate a plurality of polygonal regions according to the plurality of seed points and the map range.
[0117] In an optional implementation, the determination module 401 is further used to: determine the region generation order and the attribution relationship determination order of each layer of the map according to the size of the layer identifier of each layer of the map; wherein, the larger the layer identifier, the higher the map layer.
[0118] It should be noted that the division of modules in the above embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0119] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program executable code.
[0120] The embodiment of the present invention further provides an electronic device 50, see Figure 5 , Figure 5The structural block diagram of the electronic device 50 provided in the embodiment of the present invention includes: a memory 501, a processor 502, and a communication interface 503. The memory 501, the processor 502, and the communication interface 503 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0121] Optionally, bus 504 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0122] In the embodiment of the present invention, the processor 502 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in the memory 501, and the processor 502 reads the program instructions in the memory 501 and completes the steps of the above method in combination with its hardware.
[0123] In the embodiment of the present invention, the memory 501 may be a non-volatile memory, such as a hard disk (HDD) or a solid-state drive (SSD), etc., or a volatile memory (Volatile Memory), such as RAM. The memory may also be any other medium that can be used to carry or store the desired program executable code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present invention may also be a circuit or any other device that can realize a storage function, for storing instructions and / or data.
[0124] The memory 501 can be used to store software programs and modules, such as the instructions / modules of the multi-level map region generation device 40 provided in the embodiment of the present invention, which can be stored in the memory 501 in the form of software or firmware (Firmware) or in the operating system (OS) of the computer device 500. The processor 502 executes the software programs and modules stored in the memory 501 to perform various functional applications and data processing. The communication interface 503 can be used to communicate signaling or data with other node devices.
[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0126] Understandably, Figure 5 The structure shown is for illustration only. The electronic device 50 may also include Figure 5 More or fewer components as shown, or with Figure 5 Different configurations shown. Figure 5 The components shown may be implemented in hardware, software or a combination thereof.
[0127] The electronic device 50 may also include a network device and / or a user device. The network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.
[0128] Based on the above embodiments, the present application further provides a storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the method for generating areas in a multi-level map provided in the above embodiments.
[0129] Based on the above embodiments, an embodiment of the present invention further provides a computer program. When the computer program is run on a computer, the computer executes the method for generating areas in a multi-level map provided in the above embodiments.
[0130] Based on the above embodiments, an embodiment of the present invention further provides a chip, which is used to read a computer program stored in a memory and to execute the method for generating areas in a multi-level map provided in the above embodiments.
[0131] The embodiment of the present invention further provides a computer program product, comprising instructions, which, when executed on a computer, enables the computer to execute the method for generating areas within a volumetric multi-level map provided in the above embodiment.
[0132] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0133] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0135] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for generating a region in a multi-layer map, characterized in that: The method comprises: Determine the number of map layers and the number of regions within each layer; Generating a plurality of polygonal areas in each layer of the map that is consistent with the number of the areas; For two adjacent layers of maps, determining the attribution relationship between the polygonal area in the lower layer map and the polygonal area in the upper layer map; In the attribution relationship, the area shape of the polygonal area in the upper map is adjusted using the edge information of the polygonal area in the lower map until the area shape adjustment of all the polygonal areas in the upper map is completed.
2. The method for generating a region in a multi-layer map according to claim 1, characterized in that: In the attribution relationship, the region shape of the polygonal region in the upper map is adjusted by using the edge information of the polygonal region in the lower map until the region shapes of all the polygonal regions in the upper map are adjusted, including: Determine the edge set of each polygonal area in each layer of the map; According to the edge set, the polygonal area of the lower map in the belonging relationship is edge-fused with the polygonal area in the upper map to complete the adjustment of the area shape of the polygonal area in the upper map.
3. The method for generating a region in a multi-layer map according to claim 2, characterized in that: According to the edge set, edge merging is performed on the polygonal area of the lower map in the belonging relationship with the polygonal area in the upper map to complete the adjustment of the area shape of the polygonal area in the upper map, including: Adding each edge of the area of the lower map in the belonging relationship to the temporary edge set of the polygonal area of the upper map; If there are two repeated edges in the temporary edge set, the two repeated edges are deleted from the temporary edge set, and then the temporary edge set is used to replace the edge set of the polygonal area of the upper map.
4. The method for generating a region in a multi-layer map according to any one of claims 1 to 3, characterized in that: For two adjacent layers of maps, determining the attribution relationship between the polygonal area in the lower layer map and the polygonal area in the upper layer map includes: Determine the center point of each polygonal area in each layer of the map; For each center point of the lower map, determining a target polygonal area containing the center point in the upper map; The belonging relationship between the polygonal area where the center point is located and the target polygonal area is established.
5. The method for generating a region in a multi-layer map according to claim 4, characterized in that: Establishing the belonging relationship between the polygonal area where the center point is located and the target polygonal area includes: The polygonal area where the center point is located is added to the sub-area set of the target polygonal area.
6. The method for generating a region in a multi-layer map according to any one of claims 1, 2, 3 and 5, characterized in that: A plurality of polygonal areas consistent with the number of areas are generated in each layer of the map, including: For each layer of the map, a plurality of seed points consistent with the number of regions are randomly generated within a preset map range; A plurality of polygonal areas are generated according to the plurality of seed points and the map range.
7. The method for generating a region in a multi-layer map according to any one of claims 1, 2, 3 and 5, characterized in that: Before generating a plurality of regions in each layer of the map that is consistent with the number of regions, the method further comprises: The order of area generation and the order of attribution determination of each layer of the map are determined according to the size of the layer identifier of each layer of the map; the larger the layer identifier, the higher the map level.
8. A device for generating a region in a multi-layer map, characterized in that: It includes a generation module, a determination module and an adjustment module; The determination module is used to determine the number of map layers and the number of areas in each map layer; The generating module is used to generate a plurality of polygonal areas in each layer of the map, the number of which is consistent with the number of areas; The determination module is further used to determine, for two adjacent layers of maps, the attribution relationship between the polygonal area in the lower layer map and the polygonal area in the upper layer map; The adjustment module is used to adjust the area shape of the polygonal area in the upper map by using the edge information of the polygonal area in the lower map in the belonging relationship until the area shape adjustment of all the polygonal areas in the upper map is completed.
9. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method for generating a region in a multi-level map as described in any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for generating areas in a multi-layer map as claimed in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Precise edge plot cutting and affiliation method based on plot boundary extension line
CN120747139A
