GDMC 2019 - Procedural settlement generation in Minecraft (Round 2)
Post date: Mar 09, 2019 7:23:45 PM
The approach I have taken to settlement generation involved identifying plots of existing landscape that can accept a building and then placing clusters of rooms on them. I populate the buildings with contents and then connect the buildings together with paths. The areas between the building plots are strung with low wall sections, and some farm land with various crop types are placed where possible. Building types include houses, towers, and a village square with a fountain.
Placement of generated schematics on the landscape requires some minor adjustments to parts of the landscape. Sometimes it is necessary to create sections of building foundations to prevent parts of the flooring floating over air.
Buildings are a collection of rooms packed close to each other using a simple packing algorithm. The contents of the rooms are determined from a simple blueprint that associates the room type with a generation procedure. Orientation of blocks to line up with walls and avoid windows is done through the generator inspecting the area and making appropriate layout decisions.
Windows, lighting, and doors are punched through the assembly at intervals to provide passage for the inhabitants.
Carpet, crafting tables, furnaces, chests, beds and chairs are placed according to the room type to provide simple functional capabilities that an inhabitant might require.
The algorithm profiles the landscape using a heightmapping approach. It then attempts to isolate areas of severe terrain height change, and then searches the remaining gently sloping areas for square sections that can be used to place buildings.
Each settlement is defined by a blueprint which is a collection of feature generator names. The generators are delegated the responsibility to populate the region of the landscape with features. This framework is extended by adding a generator to the blueprint for a village.
The tower variant of building has been introduced to provide a watchtower to the settlement. It was primarily created to show how generators can be created using python and the features of the pymclevel library. A worked example is in this thread: https://twitter.com/TheWorldFoundry/status/1087616035992170496
The structure of a tower shows some of the procedural methods used to create it:
Paths between plots
Each building plot centre is an anchor point that can be used to mark paths between the plots. By adjusting the number and weights of path plotting the settlement can get a ‘lived in’ feel.
Establishing a voronoi graph for the plots in the settlement creates sections of landscape where walls can be placed.
Adding a farmland generator was then as simple as creating a blueprint entry and writing the corresponding generator to create farmland, water source, fences and crops.