CN112634381A - Method and device for generating random map stickers in game, readable storage medium and computer software program product - Google Patents

Method and device for generating random map stickers in game, readable storage medium and computer software program product Download PDF

Info

Publication number
CN112634381A
CN112634381A CN202011518710.5A CN202011518710A CN112634381A CN 112634381 A CN112634381 A CN 112634381A CN 202011518710 A CN202011518710 A CN 202011518710A CN 112634381 A CN112634381 A CN 112634381A
Authority
CN
China
Prior art keywords
value
pixel
map
weight
offset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011518710.5A
Other languages
Chinese (zh)
Other versions
CN112634381B (en
Inventor
刘珏江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Thunder Digital Entertainment Co ltd
Original Assignee
Shenzhen Thunder Digital Entertainment Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Thunder Digital Entertainment Co ltd filed Critical Shenzhen Thunder Digital Entertainment Co ltd
Priority to CN202011518710.5A priority Critical patent/CN112634381B/en
Publication of CN112634381A publication Critical patent/CN112634381A/en
Application granted granted Critical
Publication of CN112634381B publication Critical patent/CN112634381B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention relates to a method and a device for generating random map pasters in a game, a readable storage medium and a computer software program product, which provide a small amount of original pasters, then create an initial control chart, create the control chart according with terrain features by using terrain marking data, endow different initial marking values for different characteristic areas, and adopt corresponding paster groups in corresponding intervals of the characteristic areas so as to better reserve the regional characteristics such as the appearance of the areas. Finally, the initial map is mixed with the control map to form the target map. The random mode makes the fine arts personnel needn't provide a large amount of not repeated pictures, and a small amount of pictures can realize that the not repeated effect picture mixes and has brought bigger operating space for the fine arts, can produce abundanter effect.

Description

Method and device for generating random map stickers in game, readable storage medium and computer software program product
Technical Field
The invention relates to the field of computers, in particular to a method and a device for generating random map stickers in games, a readable storage medium and a computer software program product.
Background
The open world map is one of the popular game components at present, and many open world generation modes are random generation so as to reduce the heavy task amount of the customized map.
For game representation, a chartlet representation is an indispensable component, for a random large map, a small number of chartlets can cause a scene to have a strong sense of repetition, which needs art to provide more chartlets for solving the problem, but the chartlets bring a large amount of repeated workload to art workers, the development efficiency of the game is affected, and even if a large number of chartlets exist, the problem that the same chartlet appears continuously at random can also occur, so that a relatively obvious repetition phenomenon is brought.
In view of the above, the present invention provides a map mapping method for solving the above problems.
Disclosure of Invention
The invention aims to provide a method, a device, a readable storage medium and a computer software program product for generating a shorthand map in a game, so as to generate a large random map by using a small amount of maps and solve the problem of repeated feeling caused by the small amount of maps.
In order to achieve the purpose, the invention adopts the technical scheme that:
a method for generating random map stickers in a game includes
An initial control chart creating step; creating an initial control chart, wherein the number of the created initial control chart is 1/4 of the original map, and setting the color of each pixel in the initial control to correspond to the RGBA channel value;
for each initial control chart, performing the following steps to generate the control chart:
calculating a pixel mark value; calculating coordinate values of pixels of the initial control map in the terrain according to the aspect ratio of the initial control map and the terrain grid, and then solving a pixel marking value of the pixels;
a pixel weight list calculation step; for each pixel in the initial control chart, adding an offset value to the pixel mark value of each pixel to obtain an offset pixel mark value, determining the interval where the pixel is located according to the offset pixel mark value, setting the weight, and constructing a weight list of the pixel;
a control chart generation step; taking the weight in the pixel weight list as the values of the four channels RGBA, and constructing the pixel value to obtain a control chart;
generating a map; and mixing the control chart generated in the step with the original map to form the map.
In the pixel weight list calculation step, the weights are specifically set as follows:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion.
In the step of calculating the pixel weight list, if the mark value of the offset pixel is between the mark value intervals of two original maps, the weights of the two original maps are calculated as follows:
the weights of the next original map are: (pixel offset flag value-highest value of last bin)/the flag value;
the weight of the last original map is: 1-weight of next original map.
The method also comprises a weight array creating step, wherein the length of the weight array is the number of pixels of an initial control chart; the weight arrays are four times of the original control chart in number, and correspond to four channels of the pixel color of the original control chart;
the weight array is used to store the weight values of the pixels in the pixel weight list calculation step.
In the pixel weight list calculation step, the offset value is calculated as follows:
calculating an initial noise value by using a Berlin function, and processing to obtain an actual noise value; and multiplying the actual noise value by an offset coefficient to obtain an offset value.
The offset coefficients comprise a maximum offset coefficient and a minimum offset coefficient; the offset value is calculated as follows:
if the actual noise value is less than 0, multiplying the minimum offset coefficient to obtain an offset value; and if the actual noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value.
In the step of calculating the pixel label value, the calculation of the pixel label value is as follows:
firstly, according to the coordinates h (x, y) of the pixel in the initial control chart, which are mapped to the terrain, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil), wherein the coordinates of the two points can obtain an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j); where i = floor (x), j = floor (y), iCeil = ceil (x),
jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer no less than the value;
then, acquiring terrain marking values corresponding to the four points h0, h1, h2 and h 3;
finally, the marking value of the point h is obtained through bilinear interpolation of the four surrounding points h0, h1, h2 and h3, and the marking value of the point h is the pixel marking value of the initial control chart.
A device for generating random map in game comprises
An initial control map creation module for creating an initial control map and setting a color corresponding RGBA channel value of each pixel in the initial control, the initial control map creation number being 1/4 of the original map;
the control chart generation module comprises a pixel mark value calculation unit, a pixel weight list calculation unit and a control chart generation unit;
the pixel mark value calculating unit is used for calculating the coordinate value of the pixel of the initial control map in the terrain according to the aspect ratio of the initial control map and the terrain grid, and solving the pixel mark value of the pixel;
the pixel weight list calculating unit is used for adding an offset value to each pixel mark value of the initial control chart to obtain an offset pixel mark value, determining the interval where the offset pixel mark value is located according to the offset pixel mark value, setting the weight and constructing a weight list of the pixel;
the control chart generating unit is used for constructing the pixel value by taking the weight in the pixel weight list as the value of the RGBA four channels to obtain a control chart;
and the map generating module is used for mixing the generated control map with the original map to form the map.
The pixel weight list calculation unit sets weights as follows:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion.
When the pixel weight list calculating unit is used for calculating the weight, if the mark value of the offset pixel is between the mark value intervals of two original maps, the weight calculation of the two original maps is as follows:
the weights of the next original map are: (pixel offset flag value-highest value of last bin)/the flag value;
the weight of the last original map is: 1-weight of next original map.
The apparatus further comprises a weight array creation module for creating a weight array for storing weight values of the pixels in the pixel weight list calculation step;
the length of the weight array is the number of pixels of an initial control chart; the number of the weight arrays is four times of the number of the original maps, and corresponds to four channels of the color of the pixels of the original control map.
The pixel weight list calculation unit calculates the offset value as follows:
calculating an initial noise value by using a Berlin function, and processing to obtain an actual noise value; and multiplying the actual noise value by an offset coefficient to obtain an offset value.
The offset coefficients comprise a maximum offset coefficient and a minimum offset coefficient; the pixel weight list calculation unit calculates the offset value as: if the actual noise value is less than 0, multiplying the minimum offset coefficient to obtain an offset value; and if the actual noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value.
The pixel tag value calculating unit is configured to calculate a pixel tag value, specifically as follows:
firstly, according to the coordinates h (x, y) of the pixel in the initial control chart, which are mapped to the terrain, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil), wherein the coordinates of the two points can obtain an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j); where i = floor (x), j = floor (y), iCeil = ceil (x),
jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer no less than the value;
then, acquiring terrain marking values corresponding to the four points h0, h1, h2 and h 3;
finally, the marking value of the point h is obtained through bilinear interpolation of the four surrounding points h0, h1, h2 and h3, and the marking value of the point h is the pixel marking value of the initial control chart.
A computer-readable storage medium having stored therein instructions that, when run on a terminal device, cause the terminal device to perform the method of generating a random map tile of any of claims 1-7.
A computer software program product which, when run on a terminal device, causes the terminal device to perform the method of generating a random map tile of any of claims 1-7.
After the scheme is adopted, the original map is adopted and combined with terrain marking data to generate a control map in an interval form, and then the generated control map is mixed with the original map to generate a final map. The random mode makes the fine arts personnel needn't provide a large amount of not repeated pictures, and a small amount of pictures can realize that the not repeated effect picture mixes and has brought bigger operating space for the fine arts, can produce abundanter effect. Moreover, because the generation of the control chart is related to terrain marking data, the control chart conforming to terrain features can be created; different characteristic regions are endowed with different initial mark values, and corresponding map groups are adopted in corresponding intervals of the characteristic regions, so that the regional characteristics such as the appearance of the regions can be better reserved.
Drawings
FIG. 1 is a plot of labeled value calculations for an initial control chart;
fig. 2 is a schematic diagram of weight setting.
Detailed Description
The invention discloses a method for generating random map stickers in a game, which comprises the following steps:
step 1, providing an original map;
the original map is provided by the artist and comprises a plurality of groups of maps, and each group of maps consists of a diffuse reflection map and a corresponding normal map. In practice, the artist may provide a small number of original drawings, and in the embodiment of the present invention, the original drawings provided by the artist include 8 sets of drawings.
Step 2, generating a control chart;
step 2.1, creating an initial control chart, creating 1/4 with the number being the number of the original maps, and setting RGBA channel values corresponding to the color values of each pixel in all the initial control charts.
In the example of the present invention, two initial control charts need to be created, and the set RGBA channel values are both 1000.
And 2.2, calculating pixel mark values of the initial control chart for each initial control chart, and generating the control chart by using the mark values. The method comprises the following specific steps:
and 2.21, obtaining the length w and the width h of the terrain grid, and calculating the mark values of all points of the terrain, wherein the mark value of a certain point in the terrain is used for distinguishing the mapping level where the point is located and mixing the mappings. In the present invention, the method of calculating the mark value of a point in the terrain is not limited.
2.22, respectively calculating the proportion of a horizontal axis and a vertical axis according to the control chart length cw, the width ch and the length and the width of the terrain grid; wherein, the horizontal axis proportion r0= w/cw, and the vertical axis proportion r1= h/ch; the scale of the horizontal axis and the vertical axis is used to calculate control chart data from the grid data.
Step 2.23, for each pixel point in the control graph, obtaining a coordinate (x, y) of the pixel point in the map according to the proportion of the position (ci, cj) of the pixel point in the control graph to the corresponding coordinate axis, wherein x = r0/2+ r0 ci, and y = r1/2+ r1 cj; and then calculating the map marking value of the pixel point.
As shown in fig. 1, in this embodiment, the map label value of each pixel in the control map is calculated as follows:
firstly, according to a coordinate point h (x, y) mapped to a map by a pixel point in a control chart, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil) of the point h, and obtaining an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j) from the coordinates of the two points; wherein i = floor (x), j = floor (y), iCeil = ceil (x), jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer not less than the value.
Then, map flag values corresponding to the above four points h0, h1, h2, h3 are acquired.
Finally, the marking value of the point h is obtained through bilinear interpolation according to the four surrounding points h0, h1, h2 and h3, and the marking value is the pixel marking value of the initial control chart.
And 2.3, creating weight arrays, wherein the number of the arrays is four times of the number of the mapping arrays and four times of the number of the control charts, and correspondingly controlling four channels of the pixel colors of the image. And the length of each array is the number of pixels of the initial control chart.
The weight array is mainly used for storing the weight values of the control charts generated in the following mode, so that a worker can intuitively know the relation between the generated control charts and the terrain, and the worker can conveniently perform feedback adjustment related parameter setting.
In this example, 8 original maps are used, 2 control charts and 8 weight arrays are required to be generated, values in the first four arrays respectively correspond to values of four channels of each pixel of the first control chart, and correspond to the mixing weights of the first four original maps; the values in the last four arrays respectively correspond to the values of the four channels of each pixel of the second control chart and the mixing weights of the last four original maps. The function of the weights is to label which map is sampled, or which maps are blended in what proportions.
Step 2.4, for each pixel point marker value of each control chart, a pixel weight list for that location is calculated. The calculation method is as follows:
and 2.41, calculating an initial noise value by using a Berlin function according to the position (ci, cj) of each pixel in the control chart, wherein the value is between 0 and 1, adjusting the value to between-1 and 1 in a (noise value-0.5) × 2 mode, and obtaining an actual noise value.
Step 2.42, multiplying the actual noise value by a certain coefficient to obtain a mark value deviation value, and adding the deviation value to the original mark value to obtain a mark value after deviation;
the following protocol was used in this example: calculating an actual offset value according to the configured maximum offset coefficient and the minimum offset coefficient of the noise and the magnitude of the actual noise value: if the noise value is less than 0, multiplying by the minimum offset coefficient to obtain an offset value; if the noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value. The embodiment of the patent calculates the noise twice in total, the two noise values are separated to calculate the deviant, and then the original marking value is added with the two deviant values respectively to obtain the final marking value.
In the embodiment, an offset mode is adopted in the generation process of the control diagram, and the maximum offset value and the minimum offset value are combined, so that the influence of noise on the marking value of the pixel is effectively controlled.
Step 2.43, obtaining a mark value interval where the pixel is located according to the mark value after the pixel is shifted, and setting a weight according to the mark value interval, as shown in fig. 2, specifically describing the following:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion.
In this embodiment, the weights of the two original maps are calculated as follows:
the weights of the next original map are: (pixel offset flag value-highest value of last bin)/the flag value; the weight of the last original map is: 1-weight of next original map.
And 2.44, obtaining the mixed weight of all the maps at the position of the pixel point according to the step 2.43, and constructing a weight list of the pixel point, wherein each value in the list corresponds to the mixed weight of a certain map. And for the weight lists of all the pixel points, the sequence of the mapping is consistent. And simultaneously, sequentially storing the mixed weights of all the maps corresponding to the pixel point to the corresponding positions of the corresponding weight arrays.
And 2.5, sequentially using the pixel weight list as the values of the four channels RGBA, and constructing the pixel corresponding to the position of the control chart so as to obtain the control chart.
As shown in fig. 2, if the mark value is within a certain interval, the map group corresponding to the interval is used, and if the mark value is between two intervals, the original map groups corresponding to two adjacent intervals are mixed, where the mixing ratio of the original map 1 is the difference 1/mark value difference, and the mixing ratio of the original map 2 is the difference 2/mark value difference.
And 3, mixing the original maps by using the control map to form a target map.
In this example, the mixing method was as follows: in a simple example of the invention, the mark value interval corresponding to the first map is-70 to-30, and the mark value interval corresponding to the second map is 20 to 100; and for each pixel of the mixed mapping, calculating the final color value of the pixel according to the value of each channel corresponding to the pixel in the control chart and the correspondence of the mapping group corresponding to the channel, thereby obtaining the final mixed mapping.
In the method, the original map is adopted and combined with terrain marking data to generate a control map in an interval form, and then the generated control map is mixed with the original map to generate a final map. Therefore, the use amount of the original mapping can be reduced, and the problem of repeated feeling caused by a small amount of mapping is effectively avoided. Moreover, because the generation of the control graph is related to terrain marking data, the control graph conforming to terrain features can be created, for example, different characteristic areas are endowed with different initial marking values, the Berlin noise is utilized for carrying out one-time randomization, and corresponding map groups are adopted in corresponding intervals of the characteristic areas, so that the regional features such as the appearance of the areas can be better reserved.
In addition, the invention can conveniently derive the control chart generated in the previous step by recording the weight in the generation process of the control chart and storing the weight in the weight array, and can compare the control chart with the actual terrain effect, so that a worker can more intuitively see the influence of the control chart on the terrain map, and reference is provided for possible subsequent changes. In the practical application process, if the comparison reference is not needed, the weight can not be recorded, namely, the weight array is not needed to be set.
Based on the same inventive concept, the invention also discloses a device for generating the random map in the game, which comprises an initial control chart creating module, a control chart generating module and a map generating module.
The initial control map creation module is used to create an initial control map, which is created 1/4 for the original map, and set the color of each pixel in the initial control to correspond to the RGBA channel values.
The control chart generation module comprises a pixel mark value calculation unit, a pixel weight list calculation unit and a control chart generation unit.
The pixel mark value calculating unit is used for calculating the coordinate value of the pixel of the initial control map in the terrain according to the aspect ratio of the initial control map and the terrain grid, and solving the pixel mark value of the pixel.
Specifically, the pixel mark value calculation unit obtains the length w and the width h of the terrain grid, calculates mark values of all points of the terrain, and the mark value of a certain point in the terrain is used for distinguishing a map level where the point is located and mixing maps. In the present invention, the method of calculating the mark value of a point in the terrain is not limited.
Then, the pixel mark value calculating unit respectively calculates the proportion of a horizontal axis and a vertical axis according to the control chart length cw, the width ch and the length and the width of the terrain grid; wherein, the horizontal axis proportion r0= w/cw, and the vertical axis proportion r1= h/ch; the scale of the horizontal axis and the vertical axis is used to calculate control chart data from the grid data.
Finally, for each pixel point in the control chart, the pixel mark value calculating unit obtains the coordinate (x, y) of the pixel point in the map according to the proportion of the position (ci, cj) of the pixel point in the control chart to the corresponding coordinate axis, wherein x = r0/2+ r0 ci, y = r1/2+ r1 cj; and then calculating the map marking value of the pixel point.
Referring to fig. 1, in this embodiment, the map flag value of each pixel point in the control map is calculated as follows:
firstly, according to a coordinate point h (x, y) mapped to a map by a pixel point in a control chart, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil) of the point h, and obtaining an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j) from the coordinates of the two points; wherein i = floor (x), j = floor (y), iCeil = ceil (x), jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer not less than the value.
Then, map flag values corresponding to the above four points h0, h1, h2, h3 are acquired.
Finally, the marking value of the point h is obtained through bilinear interpolation according to the four surrounding points h0, h1, h2 and h3, and the marking value is the pixel marking value of the initial control chart.
The pixel weight list calculating unit is used for adding an offset value to each pixel mark value of the initial control chart to obtain an offset pixel mark value, determining the interval where the offset pixel mark value is located according to the offset pixel mark value, setting the weight and constructing the weight list of the pixel.
In this embodiment, the pixel weight list calculating unit calculates the offset value as follows:
calculating an initial noise value by using a Berlin function, and processing to obtain an actual noise value; and multiplying the actual noise value by an offset coefficient to obtain an offset value. Further, in this embodiment, the offset coefficients include a maximum offset coefficient and a minimum offset coefficient, so the pixel weight list calculation unit calculates the offset value as: if the actual noise value is less than 0, multiplying the minimum offset coefficient to obtain an offset value; and if the actual noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value.
In this embodiment, the pixel weight list calculation unit sets the weights as follows:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion. In this embodiment, the weight of the next original map is: (pixel offset flag value-highest value of last bin)/the flag value; the weight of the last original map is: 1-weight of next original map.
And the control chart generation unit is used for constructing the pixel value by taking the weight in the pixel weight list as the value of the RGBA four channels to obtain a control chart.
And the map generating module is used for mixing the generated control map with the original map to form the map.
The pixel weight list calculation module is used for calculating the weight values of the pixels in the pixel weight list calculation step;
the length of the weight array is the number of pixels of an initial control chart; the number of the weight arrays is four times of the number of the original maps, and corresponds to four channels of the color of the pixels of the original control map.
Based on the same inventive concept, the invention also discloses a computer-readable storage medium, in which instructions are stored, and when the instructions are run on a terminal device, the instructions cause the terminal device to execute the method for generating the random map tile.
Based on the same inventive concept, the invention also discloses a computer software program product, which enables the terminal device to execute the random map sticker generation method when the computer software program product runs on the terminal device.
In summary, the key point of the present invention is that the present invention generates a control chart in an interval form by using the original map and combining with the terrain mark data, and then mixes the generated control chart with the original map to generate a final map. Therefore, the use amount of the original mapping can be reduced, and the problem of repeated feeling caused by a small amount of mapping is effectively avoided. Moreover, because the generation of the control chart is related to terrain marking data, the control chart conforming to terrain features can be created; different characteristic regions are endowed with different initial mark values, Berlin noise is utilized to carry out one-time randomization, and corresponding map groups are adopted in corresponding intervals of the characteristic regions, so that the regional characteristics such as the appearance of the region can be better reserved.
The above description is only exemplary of the present invention and is not intended to limit the technical scope of the present invention, so that any minor modifications, equivalent changes and modifications made to the above exemplary embodiments according to the technical spirit of the present invention are within the technical scope of the present invention.

Claims (16)

1. A method for generating random map stickers in a game is characterized in that: comprises that
An initial control chart creating step; creating an initial control chart, wherein the number of the created initial control chart is 1/4 of the original map, and setting the color of each pixel in the initial control to correspond to the RGBA channel value;
for each initial control chart, performing the following steps to generate the control chart:
calculating a pixel mark value; calculating coordinate values of pixels of the initial control map in the terrain according to the aspect ratio of the initial control map and the terrain grid, and then solving a pixel marking value of the pixels;
a pixel weight list calculation step; for each pixel in the initial control chart, adding an offset value to the pixel mark value of each pixel to obtain an offset pixel mark value, determining the interval where the pixel is located according to the offset pixel mark value, setting the weight, and constructing a weight list of the pixel;
a control chart generation step; taking the weight in the pixel weight list as the values of the four channels RGBA, and constructing the pixel value to obtain a control chart;
generating a map; and mixing the control chart generated in the step with the original map to form the map.
2. The method of claim 1, wherein the method further comprises: in the pixel weight list calculation step, the weights are specifically set as follows:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion.
3. The method of claim 2, wherein the method further comprises: in the step of calculating the pixel weight list, if the mark value of the offset pixel is between the mark value intervals of two original maps, the weights of the two original maps are calculated as follows:
the weights of the next original map are: (pixel offset flag value-highest value of last bin)/the flag value;
the weight of the last original map is: 1-weight of next original map.
4. The method of claim 1, wherein the method further comprises: the method also comprises a weight array creating step, wherein the length of the weight array is the number of pixels of an initial control chart; the weight arrays are four times of the original control chart in number, and correspond to four channels of the pixel color of the original control chart;
the weight array is used to store the weight values of the pixels in the pixel weight list calculation step.
5. The method of claim 1, wherein the method further comprises: in the pixel weight list calculation step, the offset value is calculated as follows:
calculating an initial noise value by using a Berlin function, and processing to obtain an actual noise value; and multiplying the actual noise value by an offset coefficient to obtain an offset value.
6. The method of claim 5, wherein the method further comprises: the offset coefficients comprise a maximum offset coefficient and a minimum offset coefficient; the offset value is calculated as follows:
if the actual noise value is less than 0, multiplying the minimum offset coefficient to obtain an offset value; and if the actual noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value.
7. The method of claim 1, wherein the method further comprises: in the step of calculating the pixel label value, the calculation of the pixel label value is as follows:
firstly, according to the coordinates h (x, y) of the pixel in the initial control chart, which are mapped to the terrain, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil), wherein the coordinates of the two points can obtain an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j); where i = floor (x), j = floor (y), iCeil = ceil (x),
jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer no less than the value;
then, acquiring terrain marking values corresponding to the four points h0, h1, h2 and h 3;
finally, the marking value of the point h is obtained through bilinear interpolation of the four surrounding points h0, h1, h2 and h3, and the marking value of the point h is the pixel marking value of the initial control chart.
8. An apparatus for generating a random map sticker in a game, comprising: comprises that
An initial control map creation module for creating an initial control map and setting a color corresponding RGBA channel value of each pixel in the initial control, the initial control map creation number being 1/4 of the original map;
the control chart generation module comprises a pixel mark value calculation unit, a pixel weight list calculation unit and a control chart generation unit;
the pixel mark value calculating unit is used for calculating the coordinate value of the pixel of the initial control map in the terrain according to the aspect ratio of the initial control map and the terrain grid, and solving the pixel mark value of the pixel;
the pixel weight list calculating unit is used for adding an offset value to each pixel mark value of the initial control chart to obtain an offset pixel mark value, determining the interval where the offset pixel mark value is located according to the offset pixel mark value, setting the weight and constructing a weight list of the pixel;
the control chart generating unit is used for constructing the pixel value by taking the weight in the pixel weight list as the value of the RGBA four channels to obtain a control chart;
and the map generating module is used for mixing the generated control map with the original map to form the map.
9. The apparatus for generating a random map tile in a game according to claim 8, wherein: the pixel weight list calculation unit sets weights as follows:
if the mark value of the offset pixel is in a mark value interval set by a certain original map, marking the weight of the subscript corresponding to the original map as 1, and indicating that the original map corresponding to the interval is sampled by the point;
if the offset pixel tag value is lower than the lowest tag value of the first original map, marking the weight of the first original map as 1, and representing that the point lower than the lowest tag value of all the original maps samples the first map; if the pixel mark value is higher than the highest value of the highest interval, marking the weight of the last original map as 1 to represent that the last original map is sampled;
if the offset pixel mark value is between the mark value intervals of two original maps, is larger than the highest value of the previous mark value interval and is smaller than the lowest value of the next mark value interval, determining a mixing proportion according to the three values of the highest value of the previous mark value interval, the offset pixel mark value and the lowest value of the next mark value interval, obtaining the weight of the two original maps, and representing that the point samples the two maps and mixes the two maps according to a certain proportion.
10. The apparatus for generating a random map tile in a game according to claim 8, wherein: when the pixel weight list calculating unit is used for calculating the weight, if the mark value of the offset pixel is between the mark value intervals of two original maps, the weight calculation of the two original maps is as follows:
the weights of the next original map are: (pixel offset flag value-highest value of last bin)/the flag value;
the weight of the last original map is: 1-weight of next original map.
11. The apparatus for generating a random map tile in a game according to claim 8, wherein: the apparatus further comprises a weight array creation module for creating a weight array for storing weight values of the pixels in the pixel weight list calculation step;
the length of the weight array is the number of pixels of an initial control chart; the number of the weight arrays is four times of the number of the original maps, and corresponds to four channels of the color of the pixels of the original control map.
12. The apparatus for generating a random map tile in a game according to claim 8, wherein: the pixel weight list calculation unit calculates the offset value as follows:
calculating an initial noise value by using a Berlin function, and processing to obtain an actual noise value; and multiplying the actual noise value by an offset coefficient to obtain an offset value.
13. The method of generating a random map tile in a game of claim 12, wherein: the offset coefficients comprise a maximum offset coefficient and a minimum offset coefficient; the pixel weight list calculation unit calculates the offset value as: if the actual noise value is less than 0, multiplying the minimum offset coefficient to obtain an offset value; and if the actual noise value is larger than 0, multiplying by the maximum offset coefficient to obtain the offset value.
14. The apparatus for generating a random map tile in a game according to claim 8, wherein: the pixel tag value calculating unit is configured to calculate a pixel tag value, specifically as follows:
firstly, according to the coordinates h (x, y) of the pixel in the initial control chart, which are mapped to the terrain, calculating a lower left grid point h0(i, j) and an upper right grid point h1(iCeil, jCeil), wherein the coordinates of the two points can obtain an upper left grid point h2(i, jCeil) and an upper right grid point h3(iCeil, j); where i = floor (x), j = floor (y), iCeil = ceil (x),
jCeil = ceil (j); floor represents the rounded down, meaning the largest integer no greater than that value; ceil represents rounding up, meaning the smallest integer no less than the value;
then, acquiring terrain marking values corresponding to the four points h0, h1, h2 and h 3;
finally, the marking value of the point h is obtained through bilinear interpolation of the four surrounding points h0, h1, h2 and h3, and the marking value of the point h is the pixel marking value of the initial control chart.
15. A computer-readable storage medium characterized by: the computer-readable storage medium has stored therein instructions that, when run on a terminal device, cause the terminal device to perform the method of generating a random map tile of any of claims 1-7.
16. A computer software program product, characterized in that: the computer software program product, when run on a terminal device, causes the terminal device to perform the method of generating a random map tile of any of claims 1-7.
CN202011518710.5A 2020-12-21 2020-12-21 Method, device and medium for generating random map in game Active CN112634381B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011518710.5A CN112634381B (en) 2020-12-21 2020-12-21 Method, device and medium for generating random map in game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011518710.5A CN112634381B (en) 2020-12-21 2020-12-21 Method, device and medium for generating random map in game

Publications (2)

Publication Number Publication Date
CN112634381A true CN112634381A (en) 2021-04-09
CN112634381B CN112634381B (en) 2024-06-11

Family

ID=75320355

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011518710.5A Active CN112634381B (en) 2020-12-21 2020-12-21 Method, device and medium for generating random map in game

Country Status (1)

Country Link
CN (1) CN112634381B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003169208A (en) * 2001-12-04 2003-06-13 Noritsu Koki Co Ltd Image processing apparatus
US20070002071A1 (en) * 2005-06-30 2007-01-04 Microsoft Corporation Parallel texture synthesis by upsampling pixel coordinates
WO2010046792A1 (en) * 2008-10-21 2010-04-29 Nxp B.V. Method of edge anti-aliasing a graphics geometry and a vectorgraphics processor for executing the same
US20150363962A1 (en) * 2014-06-16 2015-12-17 Sap Se Three-dimensional volume rendering using an in-memory database
CN107886552A (en) * 2016-09-29 2018-04-06 网易(杭州)网络有限公司 Stick picture disposing method and apparatus
CN109663357A (en) * 2018-12-19 2019-04-23 北京像素软件科技股份有限公司 Game special implementation method and device
CN110717005A (en) * 2019-10-10 2020-01-21 支付宝(杭州)信息技术有限公司 Thermodynamic diagram texture generation method, device and equipment
CN111696123A (en) * 2020-06-15 2020-09-22 荆门汇易佳信息科技有限公司 Remote sensing image water area segmentation and extraction method based on super-pixel classification and identification

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003169208A (en) * 2001-12-04 2003-06-13 Noritsu Koki Co Ltd Image processing apparatus
US20070002071A1 (en) * 2005-06-30 2007-01-04 Microsoft Corporation Parallel texture synthesis by upsampling pixel coordinates
WO2010046792A1 (en) * 2008-10-21 2010-04-29 Nxp B.V. Method of edge anti-aliasing a graphics geometry and a vectorgraphics processor for executing the same
US20150363962A1 (en) * 2014-06-16 2015-12-17 Sap Se Three-dimensional volume rendering using an in-memory database
CN107886552A (en) * 2016-09-29 2018-04-06 网易(杭州)网络有限公司 Stick picture disposing method and apparatus
CN109663357A (en) * 2018-12-19 2019-04-23 北京像素软件科技股份有限公司 Game special implementation method and device
CN110717005A (en) * 2019-10-10 2020-01-21 支付宝(杭州)信息技术有限公司 Thermodynamic diagram texture generation method, device and equipment
CN111696123A (en) * 2020-06-15 2020-09-22 荆门汇易佳信息科技有限公司 Remote sensing image water area segmentation and extraction method based on super-pixel classification and identification

Also Published As

Publication number Publication date
CN112634381B (en) 2024-06-11

Similar Documents

Publication Publication Date Title
CN107545788B (en) Goods electronic sand map system is deduced based on the operation that augmented reality is shown
EP0137108A1 (en) A raster display system
KR20080050279A (en) A reduction apparatus and method of popping artifacts for multi-level level-of-detail terrains
CN110276816A (en) Regional color filling method and device, electronic equipment and computer readable storage medium
CN104574496B (en) A kind of method and device of the static shade for calculating illumination pattern and dynamic shadow fusion
CN116071531A (en) Meta universe display method, device, equipment and medium based on digital twin
CN105574914A (en) Manufacturing device and manufacturing method of 3D dynamic scene
CN110363837B (en) Method and device for processing texture image in game, electronic equipment and storage medium
EP1866870A2 (en) Rendering 3d computer graphics using 2d computer graphics capabilities
CN112675545A (en) Method and device for displaying surface simulation picture, storage medium and electronic equipment
WO2016098690A1 (en) Texture generation system
GB2105157A (en) Simulation of a field of view with target and background
CN109615583B (en) Game map generation method and device
CN111798554A (en) Rendering parameter determination method, device, equipment and storage medium
US12026807B2 (en) Heat map generation method, server side, and readable storage medium
CN110162248A (en) Display processing method, apparatus and system
CN110221689A (en) A kind of space drawing method based on augmented reality
CN112634381A (en) Method and device for generating random map stickers in game, readable storage medium and computer software program product
CN109308394A (en) A kind of pre-buried map generalization method, apparatus of three-dimensional water power, equipment and storage medium
CN113935891B (en) Pixel-style scene rendering method, device and storage medium
CN113808246B (en) Method and device for generating map, computer equipment and computer readable storage medium
CN109325991A (en) A kind of pre-buried map generalization method, apparatus of three-dimensional water power, equipment and storage medium
CN101075277B (en) Method for simulating roadsurface in game and its processing system
KR101893793B1 (en) Methdo and apparatus for photorealistic enhancing of computer graphic image
CN106780616B (en) A kind of projector calibrating method based on the mapping of more matrixes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant