Note: There is an updated version of this article!
This is a series about the basic components of a world generated LoreGen.
Note: As of version 0.11, the algorithm for defining the shapes of continents has changed, meaning large portions of this article are outdated. Specifically, the world is not broken into rectangles, but irregularly shaped regions.
Updated as of version 0.1
Last post discussed how LoreGen lays out a rectangular grid for a map, then defines its border with outer oceans. What you’re left with, then, is a large rectangle of land in the center of the map ready to be carved into continents.
The basic process for separating that land mass — that Pangaea — into continents has three steps:
- Take a current continent and divide it into two continents
- Place an ocean between those two continents
- If you want more continents, repeat steps 1 and 2
Continents are always divided vertically or horizontally, so the resulting continents are (for now) rectangles.
The WorldRules.csv file defines the maximum and minimum number of continents that a planet can have. It also defines how big and small continents can be when they’re divided: In other words, when one continent is split into two continents, the smaller of the two new continents must be at least a certain percent the size of the original continent. By default, this number is 25%. (Making that number smaller will make you more likely to have small and oddly-proportioned continents.)
During each iteration of this process, the largest current continent (by area) is always the one selected to be split into two new continents. This ensures reasonably sized continents and prevents the world generator from having to deal with extremely small continents.
Let’s ignore step 2 of the continent generation algorithm described above for a moment, and just deal with splitting land masses. Once this process has occurred n-1 times, the world is left with n blocks of land that, together, make up the initial block of land. See the screenshot for an example of what five continents might look like.
Obviously, the rectangles of various sizes in the example screenshot are a long way from anything that actually evokes a world map.
The next step is to create bodies of water that separate the continents. Every time one continent is split to make two smaller ones, an ocean is created between those two land masses.
The size of these bodies of water is defined by the “Ocean size” rules in the “WorldRules.csv” file, and is relative to the size of the continent being split. In other words, smaller continents results in smaller oceans.
Take a look at the screenshot to see what the same planet looks like when intercontinental oceans are generated. (Note that the size and position of continents vary, as the smaller continent sizes affect the algorithm for generating them.)
Obviously, the continents are still lacking any meaningful shape, but you can start to see them taking form.
A few words about continent arrangement
Note: as of version 0.11, this has been addressed.
If you look closely at any generated worlds, or think through the algorithm described above, you may draw the conclusion that it has a fairly basic limitation: continents are completely insular. No continents touch each other or wrap around each other in any interesting ways. This means that, while individual continents may have interesting shapes, their arrangements will always be kind of boring.
I intend to address this in future versions of LoreGen (in fact, I’ve already spent multiple hours working on it with some success, but always with buggy or unpredictable results). The main challenge is the oceans — it’s easy to form the bounds of an ocean that splits two rectangular continents, but if the base shape of those continents is irregular, it becomes a lot more difficult.
I will probably update this article or append a new article whenever I address this issue.
The next post begins exploring the notion of detailed continental coastlines.