This is a series about the basic components of a world generated LoreGen.
Updated as of version 0.12
Shapes and Boundaries
A basic assumption that I made when designing the framework of LoreGen: to create visually interesting worlds, you need to have a system for creating interesting shapes.
And having interesting shapes really boils down to having interesting edges and boundaries — or, at least, that’s how LoreGen “thinks” about making interesting shapes.
Reducing the world to a 40×30 grid is insufficient for creating compelling shapes. The rest of this post will discuss how LoreGen uses fractals (i.e. recursion) to store information to create finer levels of detail.
Each world block within the grid can contain a sub-grid of world blocks. Specifically, each block within the main world grid contains its own 10×10 grid of world blocks. And you can repeat that process for each one of those sub blocks, etc. The result of this is that you can “zoom in” on any portion of the world for more detail to any level you’d like.
This notion of each world block being broken down into smaller blocks has important implications for boundaries. Let’s consider how this works for a specific case: determining the shapes of continents. Below is how we left the world map at the end of the previous article, which discussed the first steps in creating continents.
Continent Borders as a Case Study
Each continent has a border that is one world block thick, represented by yellow on the screenshot. For a continent, “border” is synonymous with “coastline.” Remember that each block is supposed to represent 1000k by 1000k. Obviously, there are no coastlines in the world that are perfectly straight for thousands of kilometers at a time.
So let’s consider what those massive squares of “coastline” actually represent. First contrast it with the land and ocean world blocks: If a world block is colored green here, it means that it’s fully inland, and all of its sub-blocks are also land. Meanwhile, the blue blocks are fully out at sea; all of their sub blocks are water.
The definition of a border block becomes obvious, then: its sub-blocks are some land, some ocean, and some are coastline, which is maintained as a one-block barrier between water and land, though this border is now one order of magnitude smaller.
Zoomed In Coastline
Let’s see what the map looks like once we create sub-grids of blocks for all of the coastline world blocks. This is effectively zooming in one further level, just on the coastline:
What’s actually happening here?
It still looks essentially the same, but here’s what’s different: The coastline is now being represented at finer detail, even if it’s difficult to tell in this rendering. This is why the yellow coastline appearing much thinner than in the previous screenshots. We can’t really tell because of how blocks are drawn, but the land and water blocks are drawn at the previous magnitude, while the coastline is drawn at “a more zoomed in resolution”.
Each world block of coastline that had been one large yellow block is now 100 smaller blocks, most of which are green, some of which are yellow.
Here’s a demonstration of how it looks “under the hood”.
Before we start creating a “zoomed in” coastline, here are the world blocks:
But once we generate and render the sub-grid for the coastline, here’s what it looks like:
The squares that appear almost solid green around the border are each a 10 by 10 grid replacing the yellow squares. Here’s a screenshot of just a continent’s corner showing this in greater detail:
This will allow us to prepare more detailed and interesting coastlines.
There are two important implications about this that are hopefully not too difficult to see: First, this process of creating sub-grids of blocks to represent detailed borders can be used for simulating any kind of border or shape, not just continental coastlines. Second, you can repeat this with a fractal-style approach: the smaller blocks can each have their own sub-grid of 10 by 10 of blocks, as can each of those 100 blocks, etc. LoreGen can represent a world with as much detail as you’d like.
Of course, we haven’t actually generated interesting borders yet, but we’re on our way there.