Automatic map block means that when a map block is placed on the map, it will automatically adjust itself and other map blocks adjacent to it according to the adjacency state, so as to achieve a coherent transition between it and nearby related map blocks.

As shown in Figure 1, there are 48 different transition modes for the same graph block according to its adjacency. If you rely on the map designer to manually select the map block according to the adjacency state, it is time-consuming and error prone. Therefore, we need to introduce automatic map block algorithm into the process of game engine or programmatic generated game map (PCG).

Figure 1. The same block has 48 different transition modes according to its adjacency

We use 0 (blue ocean) and 1 (green land) to represent the state of a map block. An intuitive automatic map block algorithm is to encode the eight neighborhoods with the target position of 1 in the clockwise order of northwest, north, northeast, east, southeast, south, southwest and west, and then determine the transition picture displayed at the target position according to the coded value, as shown in the figure below:

Figure 2. What image is displayed in a block according to its eight neighborhoods

In fact, there are 256 (2 ^ 8) different adjacency states according to the different states of the 8 adjacent blocks of a block, but the same adjacent picture may be selected in different adjacency states. As shown in Figure 3, under the two coding states of 0001100 and 0000100, the states of the 8 neighboring areas of the center point are different, but the same graph block material is used at the center. This shows that encoding with 8 adjacent positions of the graph block will introduce more redundancy. Remove the redundancy, in fact, each map block only needs to store 48 images, namely the 48 map blocks in Figure 1.

Figure 3. In both cases, although the types of eight-neighborhood maps are different, the map block in the center is no. 13

If we do not store the whole map block, but split each map block into four parts: upper left, upper right, lower left and lower right, then each corner only needs to consider 3 neighborhoods. For example, the NW corner in the picture below only needs to consider the upper, left and upper left directions of the current block to determine the type of the current corner. So the number of images that need to be stored in theory is 2 ^ 3 times 4 1/4 size blocks, the image capacity is significantly reduced.

Figure 4. Further divide a map block into four parts for drawing and assembling

The automatic block system in THE RPG Maker editor divides a complete block into four quadrants, each of which determines which alternate corner pattern it should be composed of based on its three neighborhoods. As shown in the figure below, we put the pictures of the material is divided into 20 regions, including superscript green area is the map in the first quadrant (NE) candidate corner images, the top left corner marked with the red area is the second quadrant diagram block (NW) candidate corner images, the lower left corner with yellow sub area is the third quadrant diagram block (SW) of the candidate corner images, The subregion marked blue in the lower right corner is the candidate corner image of the block’s fourth quadrant (SE).

Figure 5. Tile footage format used in RPG Maker

The candidate graph for each quadrant needs to be determined only by the three adjacent regions of the corner. For example, which candidate graph should be adopted in the first quadrant of the graph block, only the states of the three adjacent graph blocks of upper, right and upper right need to be considered. Candidates for the other three quadrants were identified in the same way.

Figure 6. There are 5 alternative patterns depending on whether the type of the upper, right, and upper right neighborhood block of the point on the upper right corner is consistent with the current block

Assuming that the resolution of each map block in the game is 64 * 64, the size of the map block set material of each terrain is only 128 * 192, which is much smaller than the storage space of 256 or 48 map blocks.

After implementing the RPG Maker auto-map block algorithm, I made an RM auto-map generating tool that can generate map data for RPG Maker MV and RPG Maker MZ editors with one click. Are interested can try: huanggaole. Making. IO/autoRMmap /

【RMMV】RM map automatic generation of online tools to use instructions – automatic generation dungeon maze _bilibili _bilibili