top of page
WorldBuilder


WorldBuilder is a procedural map generator that uses agent-based AI to create believable landmasses. These landmasses are created in stages, each led by a different type of agent. This system was adapted from “Controlled Procedural Terrain Generation Using Software Agents” by Jonathon Doran and Ian Parberry (2010).

Before any landmass generation has begun, we start with an empty ocean representing a heightmap where all heights are 0.

Initial landmass generation is handled by a set of "coast agents" that gradually raise land out of the sea. Each agent begins raising land out of the ocean near its spawn point, driven by a randomly placed 'attractor' and 'repulsor'. The agent prefers points closer to the attractor and further from the repulsor, resulting in local consistency in the shape of the land created by it.
- Technical details below -
Agents raise land up to a height specified by a perlin noise function global across all coast agents, resulting in unpredictable but smooth transitions in height across the landmass.
The number of agents spawned and limits on individual behavior are controlled via two parameters: tokens and limit. At first, a single coast agent is spawned semi-randomly on the map, with some number of tokens and a specified limit. It's divided into two new coast agents, each with half the number of tokens and the same limit. These two are further divided, and this process continues until every agent has fewer tokens than the specified limit.
Each agent will raise a number of points equal to its token count. Thus, we can think of the total token count as determining the size of the landmass. A smaller limit will result in agents being subdivided many times, resulting in more agents performing less work. This results in finer detail on the edges of the mass and a less consistent shape. A larger limit will result in few agents performing more work. This results in less fine detail and a more consistent shape for the landmass.

To give a little more texture to the landmass, some of its water-adjacent land is eroded by the beach agent. This agent identifies all land texels adjacent to water, then performs a number of laps through each of them. Each lap goes further and further inland. Each visited texel has its height reduced, and its biome type is changed to "beach" and colored differently.
-Technical details below-
To decide which eligible points are made into beaches, a perlin noise function is referenced. Only points whose height is below a defined threshold in the noise will become beach points, resulting in unpredictable but continuous stretches of beach. The discontinuity of the shoreline can be changed by altering the octave of the noise, with a higher frequency yielding more sporadic beaches.
Stage 3: Mountains

Mountain generation is handled by a series of 'mountain agents'. Each agent is assigned a unique random direction. They perform a walk along this direction, regularly turning to add variation. As the agent walks, it raises terrain over a V-shaped ridge from its position, creating mountains with smaller foothills surrounding them in its wake. The edges of mountains and hills are smoothed to create a continuous descent to surrounding land, before having some noise added for more natural variation in height.
Mountain agents are the most parameterizable of all. Users are able to specify the size, height, and shape of mountain ranges, as well as change properties of how walks are handled.
Stage 4: Rivers

The final step of the process is to add rivers to the landmass. River agents spawn at random points of land adjacent to water. They're assigned a random goal point on a mountain, and begin gradually ascending toward it. As they move they reduce the height of the points on their path, turning them into 'rivers'. They greedily follow the lowest elevation path on their way up the mountain.
If a river agent encounters an existing river, their streams will merge, forming a delta. If an agent is taking too long, it gives up, ensuring that ludicrously long rivers don't form. Because agents can give up, the number of rivers to be made can be upper bounded, but their successful creation will depend largely on the distribution of mountains.
User Interface

Agent-based AI was chosen due to its versatility and ease of parameterization, but that doesn't mean users are given direct control of all aspects of agent behavior. Some values may make the landmass look terrible, some will cause incompatibilities between agents, and some may consume needlessly excessive resources or even brick the program.
As such, the sliders in the UI are highly abstracted versions of agent parameters, bound within values that will generate reasonable maps, and processed by the core code before being passed to the agents.
For instance, users don't need to consider landmass size when specifying mountain density. They can specify a very small island with maximum mountain density, if they so desire. Rather than fill the entire island with mountains, the density is scaled by the surface area of the landmass, resulting in a small island with proportionally dense mountains. Most parameters are bound and scaled similarly.
Stage 0: Water
Stage 1: Initial Landmass
Stage 2: Beaches
bottom of page