This is a series about the basic components of a world generated LoreGen.
Note: As of version 0.11, the method for determining the base shape of continents has changed; they are now irregular regions, not rectangles. However, the techniques described in the post are still used, both on a “macro” and “micro” basis.
Updated as of version 0.1
The previous post discussed the way LoreGen represents and renders boundaries (specifically, as an example, continental coastlines) in finer detail than the regions around it (in this case, oceans and land masses). What might or might not have been clear is how this allows us to generate more interesting boundaries.
Before we jump into that, though, let’s talk about how, in general, LoreGen generates shapes and borders.
It uses what I’ve always called “the erosion algorithm.” I have no idea if there is a formal or more descriptive name for this process, but I think of it as simulated erosion of one region into another, so let’s stick with that in this description.
Here’s how it works:
- Randomly select a block from the boundary.
- Set that block to be part of the outer region.
- Redetermine the boundary.
Re-stated in the context of continental coastlines: Select a coastline block, “erode” it away to water, and figure out what the new coastline is. When LoreGen determines the shape of continents, it uses two phases of erosion: macro-level, to determine the overall shape of the coastline, and micro-level, to contour the coastline.
Macro-Level Erosion to Shape Continents
Let’s take a look at our continents before we started worrying about more detailed coastlines:
Here’s what these continents look like after LoreGen applies the erosion method to the continental coastlines:
Immediately, you can see the continents are starting to have somewhat interesting shapes. You can immediately see some of the implications of this method for generating outlines. For example, it allows continents to split into multiple parts, creating islands that are sometimes big and sometimes small. (Notice the continent on the bottom right split into two parts, and the several smaller islands on the upper left continents.)
Micro-Level Erosion to Contour Coastlines
While the previous screenshot shows continents starting to take shape by “eroding” away the coastlines, it also appears visibly “blocky” thanks to the relatively large size of world blocks.
But as the previous post went over, we have the ability to render blocks in finer detail.
Let’s look at what the continents looked like after we rendered the coastline in finer detail, but before we applied any “erosion” to give the continents shape.
Now, let’s apply the erosion method to the sub-grids of the coastlines and see what it looks like.
This is where it starts to become obvious why it’s useful to render the coastline blocks with greater “zoom.” Though the overall shapes of the continents are not very interesting, the borders are much more interesting and visually appealing with the finer detail of the sub-grid of coastline blocks.
Combining Micro- and Macro-Level Erosion
The real payoff comes from combining “erosion” of the continents on the macro level to continental coastline with “erosion.” Here’s what it looks like:
At last, we have continental coastlines!
But there’s still something glaring about the shapes of the continents: even if the edges have finer detail, their overall shapes are still very blocky. Fortunately, there’s a solution to this that starts to give us pleasing and interesting continents: edge patterns, which are described in the next post.
Configuring “Erosion” Rate
The “erosion rate” — i.e., what percent of blocks LoreGen erodes away anytime it’s working on the border of something — can be configured in the World Rules file.
The rules regulating the “erosion rate” are defined separately for different types of border “erosion.” The macro-level continent shaping “erosion” is defined by “Percent of continent worn away” minimum and maximum. By default, the minimum and maximum are 20% and 40%. Each continent has an erosion rate between the max and min determined when the continent is created, as does each world block on the coastline.
Here’s what it looks like when you bump the minimum and maximum erosion rates each up 20%, to 40% and 60%:
You can see that the continents have been worn away a bit. Honestly, it doesn’t look too bad at all. This might be closer to the ideal default erosion rates; I will certainly play with it in future versions of LoreGen.
And here’s what it looks like when you bump the minimum and maximum erosion rates down 20%, to 0% and 20%:
So little has been eroded away that you can still see the basic rectangles.
And… why the hell not?… here’s the largest possible range, 0% minimum to 100% maximum. Any amount allowed.
And that’s why you set bounds for erosion. One continent completely gone; others in very erratic shape.