Have you ever asked yourself how these huge maps are generated?
I’ll try to provide some behind the scenes information.
First, some information about the architecture of a Minecraft generator. In vanilla Minecraft exists a ChunkGenerator and ChunkPopulators. A Generator has the job to build some basic landscape, this happens on a chunk by chunk order. It is very important that such a Generator can generate chunks that have seamless transitions, no matter when or in which order they get generated. If it had to depend on the neighboring chunk, your generator would end up with a Stack Overflow Exception. In the case of Metropolis, this only places stone from zero to the height where buildings are placed (i. e. around 65).
Populators, on the other hand, decorate your landscape. Metropolis has around four or five of them. One distributes ores, another makes sure there is bedrock, one builds caves and the most important one places buildings and streets.
But how does one place buildings without any gaps forming?
First we divide the map into smaller parts which are independent, I call those Grids. They are 64 by 64 chunks wide and completely surrounded by highways. Highways are streets that are 2 chunks wide. That’s why the highways go straight from one end of the map to the other. The next step is separating the grid into two approximately same-sized areas with a road between them. Then each of those two gets divided again into two approximately same-sized areas, again with roads in-between. This is repeated until the areas are smaller than some constant which is usually around 15 chunks wide. We call such an area District.
Each district gets subdivided again into smaller parts, but without any roads in-between. If a building fits into such an area, it may now get placed. However, this depends on a random number, sometimes a building is placed, sometimes the area gets split into two smaller areas. If such an area is as big as one chunk by one chunk, something gets placed for sure. This splitting in two parts recursively is also called Binary Space Partitioning.
There is much more logic behind this, one has to decay the buildings, another decides which areas are industrial or residential or another context. Also, have you noticed that there are never exactly the same buildings next to each other? I’ll tell you more about Metropolis (or Maria as I like to call her) another time.