This is a series about the basic components of a world generated LoreGen.

Note: as of version 0.11, the algorithm for generating continents has changed (now, the base shape of continents is irregular regions, not rectangles). Otherwise, the principles of this post are still accurate.

Updated as of version 0.1

Shapes and Boundaries

A basic assumption that I made when designing the basic framework of LoreGen: to create visually interesting and meaningful worlds, you need to have a system in place for creating interesting shapes. Simple rectangles don’t cut it.

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.

Another key to LoreGen’s notion of boundaries is the fact that each world block contains 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. The result of this is that you can “zoom in” on any portion of the world for more detail.

Continents before "zoomed in" edges

Continents before “zoomed in” edges

This has major implications for boundaries. It’s easier to visualize if you consider a specific example. Let’s take the beginning shapes of continents generated for the previous article (screenshot seen to the right).

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:

Zoomed in coastline

Zoomed in 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 same 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:

loregen-borders2

But once we generate and render the sub-grid for the coastline, here’s what it looks like:

loregen-borders3

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:

loregen-borders4

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.

The next post discusses the “erosion” algorithm for randomizing shapes of continents.