Game height map generation method and device, equipment and storage medium
By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy, and using different sampling densities and repeated sampling frequency to generate the game height map, the problem of inflexible sampling methods and inaccurate sampling results in the prior art is solved, and higher sampling flexibility and accuracy are achieved.
Patent Information
- Application Number
- CN202510432971.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-08-29
AI Technical Summary
In the prior art, the sampling method of game height map generation is not flexible enough, resulting in inaccurate sampling results and cannot meet the needs of different objects' complexity and details.
By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, using different sampling densities and repeated sampling frequencies for height sampling, a game height map is generated.
It improves the flexibility of the sampling method and the accuracy of sampling results, and improves the accuracy of game height map generation.
Smart Images

Figure CN120563709A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a method, device, equipment and medium for generating a game height map. Background Art
[0002] A game heightmap is a grayscale image or matrix specifically used to store terrain height. The data in a game heightmap represents the vertical position of objects or points on them in three-dimensional game space, describing the spatial hierarchy of objects. With the development of the gaming industry, accurately sampling game heightmaps to enhance the player experience has become crucial.
[0003] In existing technology, game heightmaps are often generated by determining the height sampling accuracy of all objects in the game map based on the game's design requirements and detail rendering standards. The game map is then height sampled using the same height sampling accuracy, and the game heightmap is generated based on the sampling results. However, different objects in the game map have varying levels of complexity and detail, requiring different sampling accuracies. Existing technology uses the same sampling accuracy for height sampling, resulting in inflexible sampling methods and inaccurate sampling results, which in turn leads to inaccurate game heightmap generation. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a game height map generation method, device, equipment and medium, which solves the problem that the sampling method is not flexible enough and the sampling results are not accurate enough in the related art, which leads to inaccurate game height map generation results. By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, and performing height sampling on the sampled object according to the sampling accuracy, the purpose of adjusting the height sampling accuracy based on the complexity of the object can be achieved, thereby improving the flexibility of the sampling method and the accuracy of the sampling results, and at the same time improving the accuracy of the game height map generation results.
[0005] In a first aspect, an embodiment of the present application provides a method for generating a game height map, the method comprising:
[0006] Obtain a three-dimensional model of an object to be sampled in the game map, and decompose the three-dimensional model into components based on a preset component decomposition rule to obtain multiple components corresponding to the object to be sampled;
[0007] Obtaining three-dimensional parameters corresponding to each component, and determining the complexity of each component based on the three-dimensional parameters;
[0008] Determine the sampling accuracy of each component based on the complexity and the relationship between the preset complexity and sampling accuracy, where the sampling accuracy includes sampling density and repeated sampling frequency;
[0009] Based on the sampling density, multiple sampling points on the preset sampling path of each component are determined, and each component is highly sampled based on the multiple sampling points and the repeated sampling frequency. Based on the height sampling results of each component, a height map of the object to be sampled in the game map is generated.
[0010] Optionally, the three-dimensional parameters include multiple vertex coordinates;
[0011] Determine the complexity of each component based on 3D parameters, including:
[0012] The vertex mutation points in each component are determined based on multiple vertex coordinates, the number of vertex mutation points is identified, and the complexity of each component is obtained.
[0013] Optionally, a vertex discontinuity point in each component is determined based on multiple vertex coordinates, including:
[0014] calculating a first connection slope between a first vertex and a second vertex in each component based on the plurality of vertex coordinates, and calculating a second connection slope between the first vertex and a third vertex;
[0015] Calculating the difference between the first connection slope and the second connection slope, and identifying whether the difference meets a preset vertex mutation range;
[0016] When the difference value meets the preset vertex mutation range, the first vertex is determined as the vertex mutation point.
[0017] Optionally, after determining the sampling accuracy of each component, the method further includes:
[0018] Read the mutation point coordinates of the vertex mutation point in the three-dimensional parameters corresponding to each component, and calculate the shape similarity between multiple components based on the mutation point coordinates;
[0019] Identifying whether the shape similarity is greater than or equal to a preset similarity threshold, and determining that the height data of the plurality of components are the same if the shape similarity is greater than or equal to the preset similarity threshold;
[0020] Accordingly, each component is highly sampled based on multiple sampling points and repeated sampling frequencies, including:
[0021] Height sampling is performed on one of the multiple components based on multiple sampling points and a repeated sampling frequency, and a height sampling result is determined as a height sampling result of each component.
[0022] Optionally, the 3D model is split into components based on preset component splitting rules, including:
[0023] Identifying the object type of the object to be sampled, and determining whether the object to be sampled is a structural object based on the object type;
[0024] In the case where the object to be sampled is a structural object, the three-dimensional model is decomposed into components based on the structure of the object to be sampled;
[0025] When the object to be sampled is not a structural object, the three-dimensional model is split into components based on a preset grid.
[0026] Optionally, after determining the complexity of each component based on the three-dimensional parameters, the method further includes:
[0027] Obtaining game logic data of the game map, and determining the degree of association between each component of the object to be sampled and the game character based on the game logic data;
[0028] The final complexity corresponding to each component is determined based on the degree of association, preset association weights and complexity.
[0029] Optionally, the game logic data includes character walking path parameters and task execution path parameters;
[0030] Determine the degree of association between each component of the object to be sampled and the game character based on the game logic data, including:
[0031] Determining the contact frequency between each component and the game character based on the character walking path parameters, and determining the number of task associations between each component and the game character based on the task execution path parameters;
[0032] Determine how relevant each component is to the game character based on the frequency of contact and the number of tasks associated with it.
[0033] In a second aspect, an embodiment of the present application provides a device for generating a game height map, the device comprising:
[0034] A component splitting module is used to obtain a three-dimensional model of an object to be sampled in the game map, and to split the three-dimensional model into components based on preset component splitting rules to obtain multiple components corresponding to the object to be sampled;
[0035] A complexity determination module is used to obtain three-dimensional parameters corresponding to each component and determine the complexity of each component based on the three-dimensional parameters;
[0036] A sampling accuracy determination module is used to determine the sampling accuracy of each component based on the complexity and the preset relationship between complexity and sampling accuracy. The sampling accuracy includes sampling density and repeated sampling frequency.
[0037] The height sampling module is used to determine multiple sampling points on the preset sampling path of each component based on the sampling density, perform height sampling on each component based on the multiple sampling points and the repeated sampling frequency, and generate a height map of the object to be sampled in the game map based on the height sampling results of each component.
[0038] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0040] In the fifth aspect, an embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device performs the method described in the first aspect.
[0041] In an embodiment of the present application, a three-dimensional model of an object to be sampled in a game map is obtained, and the three-dimensional model is decomposed into components based on a preset component decomposition rule to obtain multiple components corresponding to the object to be sampled; three-dimensional parameters corresponding to each component are obtained, and the complexity of each component is determined based on the three-dimensional parameters; the sampling accuracy of each component is determined based on the complexity and the relationship between the preset complexity and the sampling accuracy, and the sampling accuracy includes the sampling density and the repeated sampling frequency; based on the sampling density, multiple sampling points on the preset sampling path of each component are determined, and the height of each component is sampled based on the multiple sampling points and the repeated sampling frequency. A height map of the object to be sampled in the game map is generated based on the height sampling results of each component. The above-mentioned game height map generation method solves the problem that the sampling method is not flexible enough and the sampling results are not accurate enough in the related art, which leads to inaccurate game height map generation results. By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, and performing height sampling on the object to be sampled according to the sampling accuracy, the purpose of adjusting the height sampling accuracy based on the complexity of the object can be achieved, thereby improving the flexibility of the sampling method and the accuracy of the sampling results, and at the same time improving the accuracy of the game height map generation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 This is a flowchart of a method for generating a game height map provided by an embodiment of the present application;
[0043] Figure 2 It is a schematic diagram of the disassembled components of the structural object provided by this application;
[0044] Figure 3 is a schematic diagram of the disassembled components of a non-structural object provided by this application;
[0045] Figure 4This is a flowchart of another method for generating a game height map provided by an embodiment of the present application;
[0046] Figure 5 This is a flowchart for determining component complexity provided by an embodiment of the present application;
[0047] Figure 6 This is a structural block diagram of a game height map generation device provided by an embodiment of the present application;
[0048] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. It should also be noted that, for ease of description, only parts related to the present application, not all of the contents, are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0050] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0051] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0052] First of all, the usage scenario of this solution can be a scenario where a game height map is generated through height sampling, especially a scenario where object models with multiple complexities or irregularities in the game map are subjected to height sampling to generate a game height map. By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, and performing height sampling on the object to be sampled according to the sampling accuracy, the purpose of adjusting the height sampling accuracy based on the complexity of the object can be achieved, thereby improving the flexibility of the sampling method and the accuracy of the sampling results, and at the same time improving the accuracy of the game height map generation results. Based on the above usage scenarios, it can be understood that the executor of this solution can be an electronic device.
[0053] The following, in conjunction with the accompanying drawings, describes in detail a method, device, equipment and medium for generating a game height map provided by an embodiment of the present application through specific embodiments and their application scenarios.
[0054] Figure 1 This is a flow chart of a method for generating a game height map provided by an embodiment of the present application. Figure 1 As shown, the specific steps include:
[0055] S101, obtaining a three-dimensional model of an object to be sampled in a game map, and decomposing the three-dimensional model into components based on a preset component decomposition rule to obtain a plurality of components corresponding to the object to be sampled.
[0056] The game map is the spatial framework of the virtual game world, defining the player's interactive environment, terrain structure, resource distribution, and level logic. The game map includes multiple three-dimensional models of the player's character's environment, such as mountains, stairs, ships, and trees. Objects to be sampled can be three-dimensional models within the game map that require height data sampling. To enhance the player's visual experience during gameplay and the morphological characteristics of objects within the game map, height data sampling is performed on existing three-dimensional models within the game map to describe the shape characteristics of each object and the spatial structural relationships between multiple objects and between objects and the ground. Preset component splitting rules can be pre-set regulations for splitting the object to be sampled into multiple parts. The multiple components corresponding to the object to be sampled can be all the components that make up the object to be sampled. For example, if the object to be sampled is a staircase, the corresponding multiple components can be the handrails and steps on both sides of the staircase; if the object to be sampled is the ground, the corresponding multiple components can be all the tiles that make up the ground.
[0057] In one embodiment, a three-dimensional model of an object to be sampled in a game map stored during the game map construction process or the object modeling process can be obtained. Since different parts of the object to be detected correspond to different degrees of morphological irregularity, different parts of the object to be detected correspond to different levels of complexity. In this case, the three-dimensional model of the object to be detected can be first decomposed into components, and then the complexity of the object to be detected can be evaluated by component. The preset component decomposition rules include the number of components that the object to be sampled needs to be decomposed into. Based on the number of components, the three-dimensional model of the object to be sampled is subjected to a random and non-repetitive component decomposition operation with respect to volume size to obtain multiple components corresponding to the object to be sampled.
[0058] In one embodiment, component decomposition of a three-dimensional model based on preset component decomposition rules includes: identifying the object type of the object to be sampled, and determining whether the object to be sampled is a structural object based on the object type; if the object to be sampled is a structural object, decomposing the three-dimensional model based on the structure of the object to be sampled; if the object to be sampled is not a structural object, decomposing the three-dimensional model based on a preset grid. The object type of the object to be sampled can be information describing whether the structural features of the object to be sampled are regular or whether there are logical relationships. A structural object can be an object whose components have logical relationships. For example, the components of a staircase have a logical relationship between handrails and steps; the components of a stone do not have any logical relationship and no regularity between the components.
[0059] In one embodiment, the object type of the object to be sampled can be identified based on its name or the characteristics of its 3D model. Based on the object type, it can be determined whether the object to be sampled is a structural object. If the object to be sampled is a structural object, all components of the object to be sampled are treated as corresponding parts of the 3D model according to the structure of the object to be sampled, and the 3D model is then split into components.
[0060] Figure 2 It is a schematic diagram of the disassembled components of the structural object provided in this application.
[0061] like Figure 2 As shown in the figure, the structural object is a staircase, which includes multiple layers of steps and side guard structures on both sides of the multiple layers of steps. The multiple layers of steps are logically connected according to the step level, and the measurement structures on both sides are logically arranged symmetrically with respect to the ends of the steps. Therefore, the staircase can be divided into components by dividing each layer of steps into a component, namely component 1, and dividing the side guard structures on both sides into components, namely component 2. Because the side guard structures are long and have some bends, each side guard structure can be further divided according to the splicing parts that make up the side guard structure, so that a side guard structure can be divided into multiple components, namely component 3.
[0062] In one embodiment, when the object to be sampled is not a structural object, the three-dimensional model is non-repetitively framed according to a pre-set grid with a fixed volume or area size, each part of the frame is used as a corresponding component of the three-dimensional model, and the three-dimensional model is split according to the framed part.
[0063] Figure 3 This is a schematic diagram of the disassembled components of a non-structural object provided by this application.
[0064] like Figure 3 As shown in the figure, the unstructured object is a mountain. The multiple irregular parts that make up the mountain have no logical relationship, and the shapes of each part are irregular. In this case, the 3D model of the mountain can be segmented according to the preset grids. Each dashed box in the figure represents a preset grid. The schematic diagram only shows six segments. In the actual segmentation process, the 3D model of the mountain should be segmented according to the principle that the preset grids are closely connected and fully cover the 3D model of the mountain. The part corresponding to each grid is a component of the 3D model of the mountain.
[0065] This solution identifies the object type of the object to be sampled, determines whether the object to be sampled is a structural object, and then decomposes the three-dimensional model into components based on the structure or preset grid in the object to be sampled. This can improve the rationality of component decomposition and facilitate subsequent complexity analysis of each component.
[0066] S102: Acquire three-dimensional parameters corresponding to each component, and determine the complexity of each component based on the three-dimensional parameters.
[0067] The three-dimensional parameters can be data describing the three-dimensional characteristics of each component. Examples include geometric parameters, structural parameters, dimensional parameters, curvature parameters, and rendering parameters. The complexity of each component can be data describing the refinement of its geometric structure. The complexity of each component can be represented by the degree of shape irregularity. The higher the degree of shape irregularity, the finer the component's geometric structure and the more complex the component.
[0068] In one embodiment, the pre-stored three-dimensional parameters corresponding to each component can be obtained, and the polygons on the surface of each component and the number of each polygon can be determined based on the three-dimensional parameters. The ratio of the sum of the number of quadrilaterals greater than or equal to the number of quadrilaterals in the polygons to the sum of the number of all polygons can be calculated, and the ratio can be used as the complexity of each component. The number of vertices of each component can also be determined based on the three dimensions. The ratio of the number of vertices of each component to the sum of the number of fixed points of all components in the three-dimensional model of the object to be detected can be calculated, and the ratio can be used as the complexity of each component.
[0069] S103 : Determine the sampling accuracy of each component based on the complexity and the preset correlation between complexity and sampling accuracy. The sampling accuracy includes sampling density and repeated sampling frequency.
[0070] The relationship between the preset complexity and sampling accuracy can be a correspondence between different pre-set complexity ranges and corresponding sampling accuracies. Sampling accuracy can be the degree of refinement when sampling each component. Sampling accuracy includes sampling density and resampling frequency. Sampling density can be the interval between two adjacent sampling points on a sampling path. Resampling frequency can be the number of times the same sampling path is repeatedly sampled.
[0071] In one embodiment, the sampling accuracy followed when sampling height data for each component can be determined based on the preset relationship between complexity and sampling accuracy and the complexity of each component. Sampling accuracy includes sampling density and repeated sampling frequency.
[0072] S104, determining multiple sampling points on a preset sampling path for each component based on the sampling density, performing height sampling on each component based on the multiple sampling points and the repeated sampling frequency, and generating a height map of the object to be sampled in the game map based on the height sampling result of each component.
[0073] Among them, the preset sampling path can be the sampling direction and sampling endpoint pre-set on the surface of each component for sampling the height data of the component. The preset sampling paths for different components may be different, and are specifically determined according to the settings of the game developers. The sampling points can be points on the preset sampling path from the starting point of the sampling endpoint to the end point of the sampling endpoint for obtaining height data. Height sampling can be the operation of sampling the distance between the component position corresponding to each sampling point and the flat ground in the game map. The height map is a two-dimensional array that stores the height data of the surface of an object or uneven terrain in the form of a grayscale image or matrix. The height map in this solution mainly stores the height data of the surface of each component in the object to be sampled. The grayscale value of each pixel in the height map of the object to be sampled corresponds to the vertical coordinate in the three-dimensional space.
[0074] In one embodiment, the sampling interval between two adjacent sampling points on the preset sampling path can be determined based on the sampling density, and multiple sampling points on the preset sampling path of each component can be determined based on the sampling interval and the starting point on the preset sampling path. According to the position of each sampling point on the surface of the component, the data between each sampling point and the collision point of the flat ground is respectively obtained as the height data of the point, and each sampling point on each component is repeatedly sampled in height according to the repeated sampling frequency. Since there may be problems such as noise interference in the height sampling process, which may lead to different results of repeated sampling of the same sampling point, it is necessary to identify whether the height data corresponding to the same sampling point is the same during the repeated sampling process. If they are the same, the height data is determined to be the height data of the object to be sampled at the sampling point; if they are not the same, the average value of the height data sampled multiple times is calculated as the height data of the object to be sampled at the sampling point. A height map of the object to be sampled in the game map is generated based on the height data of each component at each sampling point.
[0075] Since the complexity of different components may be different, the sampling density corresponding to each component may be different. At the same time, the preset sampling paths of different components may also be different. Therefore, the sampling points and sampling directions of each component may be different. This solution divides the object to be sampled into components and samples the height data with different precision according to the complexity of each component. This can effectively avoid the problems of excessively large height map files of the object to be sampled due to excessive high-precision sampling and inaccurate sampling results due to low sampling precision.
[0076] The technical solution provided by the embodiment of the present application is to obtain a three-dimensional model of an object to be sampled in a game map, decompose the three-dimensional model into components based on a preset component decomposition rule, and obtain multiple components corresponding to the object to be sampled; obtain three-dimensional parameters corresponding to each component, and determine the complexity of each component based on the three-dimensional parameters; determine the sampling accuracy of each component based on the complexity and the relationship between the preset complexity and the sampling accuracy, and the sampling accuracy includes the sampling density and the repeated sampling frequency; determine multiple sampling points on the preset sampling path of each component based on the sampling density, and perform height sampling on each component based on the multiple sampling points and the repeated sampling frequency. Based on the height sampling results of each component, a height map of the object to be sampled in the game map is generated. Through the above-mentioned game height map generation method, the problem of insufficient flexibility of the sampling method and insufficient accuracy of the sampling results in the related art is solved, which leads to inaccurate game height map generation results. By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, and performing height sampling on the object to be sampled according to the sampling accuracy, the purpose of adjusting the height sampling accuracy based on the complexity of the object can be achieved, thereby improving the flexibility of the sampling method and the accuracy of the sampling results, and at the same time improving the accuracy of the game height map generation results.
[0077] Figure 4 This is a flow chart of another method for generating a game height map provided by an embodiment of the present application. Figure 4 As shown, the specific steps include:
[0078] S401, obtaining a three-dimensional model of an object to be sampled in a game map, and decomposing the three-dimensional model into components based on a preset component decomposition rule to obtain a plurality of components corresponding to the object to be sampled.
[0079] S402, obtaining three-dimensional parameters corresponding to each component, the three-dimensional parameters including multiple vertex coordinates, determining vertex mutation points in each component based on the multiple vertex coordinates, identifying the number of vertex mutation points, and obtaining the complexity of each component.
[0080] Among them, the vertex coordinates can be used to describe the vertex of each component on the game map. Figure 3 The data of the position in the 3D coordinate system. The vertex discontinuity point can be a point where the component is protruding or recessed.
[0081] In one embodiment, the three-dimensional parameters corresponding to each component can be obtained. The three-dimensional parameters include multiple vertex coordinates. The vertex coordinates of vertices in multiple directions adjacent to the same vertex are identified, and the difference between the vertex coordinates of the vertex and each adjacent vertex is calculated respectively. The magnitude of each difference is compared to see whether it is greater than a preset difference, and whether the positive and negative signs of each difference are the same. If the difference is greater than the preset difference and the positive and negative signs are the same, the vertex is determined to be a vertex mutation point in the component. If a vertex is not a vertex mutation point, the vertex coordinates of the vertices in two directions adjacent to the vertex and in opposite directions are opposite in sign, and the difference in vertex coordinates between the two adjacent vertices is small. The number of vertex mutation points in each component is identified, and the number of vertex mutation points is used as the complexity of the component.
[0082] In one embodiment, determining a vertex discontinuity point in each component based on multiple vertex coordinates includes: calculating a first connection slope between a first vertex and a second vertex, and a second connection slope between a first vertex and a third vertex in each component based on the multiple vertex coordinates; calculating the difference between the first and second connection slopes, and determining whether the difference falls within a preset vertex discontinuity range; and determining the first vertex as a vertex discontinuity point if the difference falls within the preset vertex discontinuity range. The first vertex can be any vertex in the component. The second vertex can be a vertex on the same face and opposite sides as the first vertex. The first connection slope can be the slope of a line segment formed by connecting the first and second vertices, i.e., the slope of the face on which the first and second vertices lie. The third vertex can be a vertex on the same face and opposite sides as the first vertex. The face on which the third vertex and the first vertex lie is different from the face on which the first and second vertices lie, and the first vertex is used to connect the two different faces. The second connection slope can be the slope of a line segment formed by connecting the first and third vertices, i.e., the slope of the face on which the first and third vertices lie. The preset vertex mutation range can be a preset range of the difference between the first connection slope and the second connection slope when the first vertex is the vertex mutation point. The specific boundary value of the preset vertex mutation range can be preset according to the vertex mutation point judgment requirement.
[0083] In one embodiment, a first connection slope between the first vertex and the second vertex in each component can be calculated based on the vertex coordinates of the first vertex and the vertex coordinates of the second vertex, and a second connection slope between the first vertex and the third vertex can be calculated based on the vertex coordinates of the first vertex and the vertex coordinates of the third vertex. The difference between the first connection slope and the second connection slope is calculated, and the difference is compared to see whether it falls within a preset vertex mutation range. If the difference falls within the preset vertex mutation range, the first vertex is determined to be a vertex mutation point.
[0084] This solution calculates the connection slopes between the same vertex and multiple vertices in each component, and calculates the difference between multiple connection slopes. It determines whether the vertex is a vertex mutation point based on whether the difference meets the preset vertex mutation range. This can achieve the purpose of judging vertex mutation points based on the degree of bending between adjacent faces, and improves the accuracy of the vertex mutation point judgment results.
[0085] In one embodiment, after determining the sampling accuracy of each component, the method further includes: reading the mutation point coordinates of the vertex mutation point in the three-dimensional parameters corresponding to each component, and calculating the shape similarity between multiple components based on the mutation point coordinates; identifying whether the shape similarity is greater than or equal to a preset similarity threshold, and if the shape similarity is greater than or equal to the preset similarity threshold, determining that the height data of the multiple components are the same; accordingly, performing height sampling on each component based on multiple sampling points and a repeated sampling frequency, including: performing height sampling on one of the multiple components based on the multiple sampling points and a repeated sampling frequency, and determining the height sampling result as the height sampling result of each component. The shape similarity can be data describing whether the shapes of multiple components are similar and the degree of similarity. The preset similarity threshold can be the minimum value of the shape similarity when the shapes of multiple components are the same.
[0086] In one embodiment, the coordinates of the mutation points of the vertex mutation points in the three-dimensional parameters corresponding to each component can be read, and the shape curve of each component can be drawn based on the distribution of the mutation point coordinates. By calculating the similarity of the shape curves of multiple components, the shape similarity between the multiple components can be obtained. It is determined whether the shape similarity is greater than or equal to a preset similarity threshold. When the shape similarity is greater than or equal to the preset similarity threshold, it is determined that the shapes of the multiple components are relatively close, and the height data of the multiple components can be considered to be the same. The height of one component among the multiple components with the same height data can be sampled according to multiple sampling points and repeated sampling frequencies, and the height sampling result is used as the height sampling result of all components.
[0087] This solution calculates the shape similarity between multiple components based on the coordinates of the components' mutation points, determines whether the height data between the components are the same based on the shape similarity, and only samples the height of one component among the multiple components with the same height data. This can greatly reduce the number of sampled components without affecting the accuracy of the sampling results, effectively improving the efficiency of height sampling.
[0088] S403 : Determine the sampling accuracy of each component based on the complexity and the preset correlation between complexity and sampling accuracy. The sampling accuracy includes sampling density and repeated sampling frequency.
[0089] S404, determining multiple sampling points on a preset sampling path for each component based on the sampling density, performing height sampling on each component based on the multiple sampling points and the repeated sampling frequency, and generating a height map of the object to be sampled in the game map based on the height sampling result of each component.
[0090] The technical solution provided in the embodiment of the present application determines the multiple vertex coordinates of each component by obtaining the three-dimensional parameters corresponding to each component, determines the vertex mutation points in each component based on the multiple vertex coordinates, and obtains the complexity of each component based on the number of vertex mutation points. This can achieve the purpose of evaluating the complexity of components based on the irregular shape characteristics of the components, thereby improving the accuracy of the component complexity evaluation results.
[0091] Figure 5 This is a flow chart for determining component complexity provided by an embodiment of the present application. Figure 5 As shown, the specific steps include:
[0092] S501, obtaining game logic data of a game map, and determining the degree of association between each component of the object to be sampled and the game character based on the game logic data.
[0093] Game logic data can be the data that drives the game and defines game rules, entity behavior, state transitions, and interaction logic. The degree of association between a component and a game character can be the degree of involvement of the component in the game character's gameplay.
[0094] In one embodiment, the game logic data of the game map can be obtained. Based on the game logic data, it can be determined whether each game character needs the participation of the object to be sampled and which specific component of the object to be sampled participates in the process of completing each game task. The number of game tasks participated by each component in each game character is counted, and the number of game tasks participated is used as the degree of association between each component in the object to be sampled and the game character.
[0095] In one embodiment, the game logic data includes character walking path parameters and task execution path parameters. Determining the degree of association between each component in the sampled object and the game character based on the game logic data includes: determining the frequency of contact between each component and the game character based on the character walking path parameters, and determining the number of tasks associated with each component based on the task execution path parameters; and determining the degree of association between each component and the game character based on the contact frequency and the number of tasks associated. The character walking path parameters may be the paths that the game character can travel during the game. The task execution path parameters may be the paths that the game character must travel to perform a game task. For example, if a game character needs to perform a monster-killing task and must climb over a staircase handrail near the monster's location, then the path along the handrail is the path the game character must travel to perform the game task. The contact frequency may be the number of times each component has come into contact with all game characters. The number of tasks associated may be the number of tasks associated with each component. For example, the monster-killing task may be associated with the staircase handrail.
[0096] In one embodiment, whether each game character needs to come into contact with each component during the game can be determined based on the character's walking path parameters. The total number of times all game characters come into contact with each component is counted, and this total number is used as the contact frequency between each component and the game character. The components that each game character needs to pass through when performing each game task can be determined based on the task execution path parameters. The number of identical components that need to be passed through when performing different game tasks is counted as the task association number for that component. The sum of the contact frequency and the task association number is calculated, and this sum is used to determine the degree of association between each component and the game character.
[0097] This solution determines the contact frequency and task association number of each component with the game character based on the character walking path parameters and task execution path parameters, and then determines the degree of association between each component and the game character based on the contact frequency and task association number. This can achieve the purpose of evaluating the association between each component and the game character in combination with the game character walking path and task execution path, thereby improving the comprehensiveness of the association evaluation results.
[0098] S502: Determine the final complexity corresponding to each component based on the association degree, the preset association weight and the complexity.
[0099] The preset association weight may be a pre-set parameter indicating the influence of the association degree on each complexity.
[0100] In one embodiment, a weighted value of the association degree and a preset association weight may be calculated, and the weighted value and the complexity may be added together to obtain a final complexity corresponding to each component.
[0101] The technical solution provided in the embodiment of the present application determines the degree of association between each component in the sampled object and the game character by obtaining the game logic data of the game map, and determines the final complexity corresponding to each component based on the degree of association, preset association weight and complexity. This can achieve the effect of updating the complexity of each component based on the impact of the component on the game character during the game process, further improving the comprehensiveness and accuracy of the component complexity evaluation results.
[0102] Figure 6 This is a structural block diagram of a device for generating a game height map provided by an embodiment of the present application. Figure 6 As shown, specifically including the following:
[0103] A component splitting module 601 is used to obtain a three-dimensional model of an object to be sampled in the game map, and to split the three-dimensional model into components based on a preset component splitting rule to obtain multiple components corresponding to the object to be sampled;
[0104] A complexity determination module 602 is configured to obtain three-dimensional parameters corresponding to each component and determine the complexity of each component based on the three-dimensional parameters;
[0105] A sampling accuracy determination module 603 is configured to determine the sampling accuracy of each component based on the complexity and a preset relationship between complexity and sampling accuracy, where the sampling accuracy includes sampling density and repeated sampling frequency.
[0106] The height sampling module 604 is used to determine multiple sampling points on a preset sampling path for each component based on the sampling density, perform height sampling on each component based on the multiple sampling points and the repeated sampling frequency, and generate a height map of the object to be sampled in the game map based on the height sampling results of each component.
[0107] Optionally, the three-dimensional parameters include multiple vertex coordinates;
[0108] The complexity determination module 602 is specifically configured to:
[0109] The vertex mutation points in each component are determined based on multiple vertex coordinates, the number of vertex mutation points is identified, and the complexity of each component is obtained.
[0110] Optionally, the complexity determination module 602 is specifically configured to:
[0111] calculating a first connection slope between a first vertex and a second vertex in each component based on the plurality of vertex coordinates, and calculating a second connection slope between the first vertex and a third vertex;
[0112] Calculating the difference between the first connection slope and the second connection slope, and identifying whether the difference meets a preset vertex mutation range;
[0113] When the difference value meets the preset vertex mutation range, the first vertex is determined as the vertex mutation point.
[0114] Optionally, the sampling accuracy determination module 603 is further configured to:
[0115] Read the mutation point coordinates of the vertex mutation point in the three-dimensional parameters corresponding to each component, and calculate the shape similarity between multiple components based on the mutation point coordinates;
[0116] Identifying whether the shape similarity is greater than or equal to a preset similarity threshold, and determining that the height data of the plurality of components are the same if the shape similarity is greater than or equal to the preset similarity threshold;
[0117] Accordingly, the height sampling module 604 is specifically configured to:
[0118] Height sampling is performed on one of the multiple components based on multiple sampling points and a repeated sampling frequency, and a height sampling result is determined as a height sampling result of each component.
[0119] Optionally, the component separation module 601 is specifically configured to:
[0120] Identifying the object type of the object to be sampled, and determining whether the object to be sampled is a structural object based on the object type;
[0121] In the case where the object to be sampled is a structural object, the three-dimensional model is decomposed into components based on the structure of the object to be sampled;
[0122] When the object to be sampled is not a structural object, the three-dimensional model is split into components based on a preset grid.
[0123] Optionally, the complexity determination module 602 is further configured to:
[0124] Obtaining game logic data of the game map, and determining the degree of association between each component of the object to be sampled and the game character based on the game logic data;
[0125] The final complexity corresponding to each component is determined based on the degree of association, preset association weights and complexity.
[0126] Optionally, the game logic data includes character walking path parameters and task execution path parameters;
[0127] The complexity determination module 602 is specifically configured to:
[0128] Determining the contact frequency between each component and the game character based on the character walking path parameters, and determining the number of task associations between each component and the game character based on the task execution path parameters;
[0129] Determine how relevant each component is to the game character based on the frequency of contact and the number of tasks associated with it.
[0130] The technical solution provided in the embodiments of the present application includes a component splitting module for obtaining a three-dimensional model of an object to be sampled in a game map, and performing component splitting on the three-dimensional model based on preset component splitting rules to obtain multiple components corresponding to the object to be sampled; a complexity determination module for obtaining three-dimensional parameters corresponding to each component, and determining the complexity of each component based on the three-dimensional parameters; a sampling accuracy determination module for determining the sampling accuracy of each component based on the complexity and the relationship between the preset complexity and sampling accuracy, wherein the sampling accuracy includes the sampling density and the repeated sampling frequency; a height sampling module for determining multiple sampling points on a preset sampling path for each component based on the sampling density, performing height sampling on each component based on the multiple sampling points and the repeated sampling frequency, and generating a height map of the object to be sampled in the game map based on the height sampling result of each component. The above-mentioned game height map generation device solves the problem in the related art that the sampling method is not flexible enough and the sampling results are not accurate enough, which leads to inaccurate game height map generation results. By calculating the complexity of each component of the object to be sampled in the game map, determining the sampling accuracy of the component, and performing height sampling on the sampled object according to the sampling accuracy, the purpose of adjusting the height sampling accuracy based on the complexity of the object can be achieved, thereby improving the flexibility of the sampling method and the accuracy of the sampling results, and at the same time improving the accuracy of the game height map generation results.
[0131] A game height map generation device in an embodiment of the present application can be configured in a device, or can be configured in a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM, or an kiosks, etc., which are not specifically limited in the embodiment of the present application.
[0132] In the embodiment of the present application, a device for generating a game height map may be an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0133] The game height map generation device provided in the embodiment of the present application can implement each process implemented by the above-mentioned method embodiments. To avoid repetition, it will not be described here.
[0134] like Figure 7 As shown, an embodiment of the present application further provides an electronic device 700, including a processor 701, a memory 702, and a program or instruction stored in the memory 702 and executable on the processor 701. When the program or instruction is executed by the processor 701, each process of the above-mentioned embodiment of the method for generating a game height map is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0135] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0136] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned embodiment of the game height map generation method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0137] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.
[0138] The present application also provides a program product comprising program code. When the program product is executed on a computer device, the program code is configured to cause the computer device to execute the steps of the methods described above in accordance with various exemplary embodiments of the present application. For example, the computer device may execute a method for generating a game height map as described in an embodiment of the present application. The program product may be implemented using any combination of one or more readable media.
[0139] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0141] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0142] The above are only preferred embodiments of the present application and the technical principles employed. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that are possible for those skilled in the art will not depart from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include more other equivalent embodiments without departing from the concept of the present application. The scope of the present application is determined by the scope of the claims.
Claims
1. A method for generating a game height map, characterized in that: The method comprises: Obtaining a three-dimensional model of an object to be sampled in a game map, and decomposing the three-dimensional model into components based on a preset component decomposition rule to obtain a plurality of components corresponding to the object to be sampled; Obtaining three-dimensional parameters corresponding to each of the components, and determining the complexity of each of the components based on the three-dimensional parameters; Determining the sampling accuracy of each component based on the complexity and a preset correlation between complexity and sampling accuracy, wherein the sampling accuracy includes sampling density and repeated sampling frequency; Based on the sampling density, multiple sampling points on a preset sampling path of each of the components are determined, height sampling is performed on each of the components based on the multiple sampling points and the repeated sampling frequency, and a height map of the object to be sampled in the game map is generated based on the height sampling result of each of the components.
2. The method for generating a game height map according to claim 1, wherein: The three-dimensional parameters include a plurality of vertex coordinates; Determining the complexity of each of the components based on the three-dimensional parameters includes: Based on the multiple vertex coordinates, vertex discontinuity points in each of the components are determined, the number of the vertex discontinuity points is identified, and the complexity of each of the components is obtained.
3. The method for generating a game height map according to claim 2, wherein: The step of determining a vertex discontinuity point in each component based on the plurality of vertex coordinates comprises: calculating a first connection slope between a first vertex and a second vertex in each of the components based on the plurality of vertex coordinates, and calculating a second connection slope between the first vertex and a third vertex; Calculating a difference between the first connection slope and the second connection slope, and identifying whether the difference meets a preset vertex mutation range; When the difference value meets the preset vertex mutation range, the first vertex is determined to be a vertex mutation point.
4. The method for generating a game height map according to claim 2, wherein: After determining the sampling accuracy of each of the components, the method further includes: Reading the mutation point coordinates of the vertex mutation point in the three-dimensional parameters corresponding to each of the components, and calculating the shape similarity between the multiple components based on the mutation point coordinates; identifying whether the shape similarity is greater than or equal to a preset similarity threshold, and determining that the height data of the plurality of components are the same if the shape similarity is greater than or equal to the preset similarity threshold; Accordingly, performing height sampling on each of the components based on the multiple sampling points and the repeated sampling frequency includes: Height sampling is performed on one of the plurality of components based on the plurality of sampling points and the repetitive sampling frequency, and a height sampling result is determined as a height sampling result of each of the plurality of components.
5. The method for generating a game height map according to claim 1, wherein: The component splitting of the three-dimensional model based on the preset component splitting rule includes: Identifying the object type of the object to be sampled, and determining whether the object to be sampled is a structural object based on the object type; In a case where the object to be sampled is a structural object, decomposing the three-dimensional model into components based on the structure of the object to be sampled; In a case where the object to be sampled is not a structural object, the three-dimensional model is decomposed into components based on a preset grid.
6. The method for generating a game height map according to claim 1, wherein: After determining the complexity of each of the components based on the three-dimensional parameters, the method further includes: Obtaining game logic data of the game map, and determining the degree of association between each component of the object to be sampled and the game character based on the game logic data; Based on the association degree, the preset association weight and the complexity, a final complexity corresponding to each of the components is determined.
7. The method for generating a game height map according to claim 6, wherein: The game logic data includes character walking path parameters and task execution path parameters; The determining, based on the game logic data, the degree of association between each component in the object to be sampled and the game character includes: Determining the contact frequency between each component and the game character based on the character walking path parameters, and determining the number of task associations between each component and the game character based on the task execution path parameters; Based on the contact frequency and the task association quantity, the association degree of each of the components with the game character is determined.
8. A device for generating a game height map, characterized in that: The device comprises: A component splitting module is used to obtain a three-dimensional model of an object to be sampled in the game map, and to split the three-dimensional model into components based on a preset component splitting rule to obtain multiple components corresponding to the object to be sampled; a complexity determination module, configured to obtain three-dimensional parameters corresponding to each of the components, and determine the complexity of each of the components based on the three-dimensional parameters; A sampling accuracy determination module, configured to determine the sampling accuracy of each component based on the complexity and a preset correlation between complexity and sampling accuracy, wherein the sampling accuracy includes a sampling density and a repeated sampling frequency; A height sampling module is used to determine multiple sampling points on a preset sampling path of each of the components based on the sampling density, perform height sampling on each of the components based on the multiple sampling points and the repeated sampling frequency, and generate a height map of the objects to be sampled in the game map based on the height sampling results of each of the components.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of a method for generating a game height map as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of a game height map generation method according to any one of claims 1 to 7 are implemented.