If you wish to make an apple pie from scratch, you must first invent the universe.
Possibly the most difficult part of developing a game is the sheer volume of work necessary to get from "nothing" to "something". Even the most rudimentary sort of 3D combat mechanic — just two goobs auto-attacking each other with hit sounds, Runescape-style — requires you to have 3D rendering, an animation system, a world within which those two goobs can exist, audio systems to play the hit sounds, art assets for the goobs, and so on. The more you start to dig into it, the more complications become apparent. Combat does not exist in a vacuum — under what circumstances does the player get into this auto-battler? Is this combat with an NPC, or another player? It has to be one of those two, but one requires at least a primitive AI and the other requires networking. How is combat initiated? The game could open directly into the arena with the two combatants, but there's a layer of navigation functionality that's expected — a main menu, escape menu, saving, loading, pausing, etc. What about UI and other player feedback? The list stretches on for as long as you keep asking questions.
You can hand-wave away a lot of these concerns by using a preexisting game engine. I have never once in my life been accused of taking the practical route, and as such Untold Lore is built on a custom engine and a custom UI framework. Most of my effort is currently going into setting up underlying systems rather than implementing an actual game on top of them. The primary focus over the last few weeks has been terrain generation: being able to design a map on a 2D canvas and then see the 3D world generated from that document. Mountains, oceans, trees, rocks, buildings, people — pretty much everything in the game world needs to be defined in the map editor. So let's dig into that.
The map editor
There are three conceptual layers to the editor: the map document, the assembled map, and the baked terrain. These layers are defined by the direction data flows. An author edits the document, the rules in that document (e.g. "here is the area of the map covered by the city of Baldur's Gate") get assembled into a concrete shape (e.g. "here are all of the buildings generated to fill the area covered by the city of Baldur's Gate") and then that assembled shape gets baked into usable terrain (e.g. "here is the grid of finalized heights and textures that can be rendered into a 3D terrain so that people can walk around in the city of Baldur's Gate").
Document
This is the layer that map makers actually work in. This system went through many, many iterations leading to dead ends before finally landing on a set of rules that have proven to hold up under scrutiny while being as dead-simple to edit as possible.
You can use a brush to paint biomes. A biome determines what ground materials and props exist in the painted area: a meadow biome, for instance, might have a grass texture where the ground is flat and a rocky slope texture where the ground is steep. It might also procedurally place clusters of trees, or scattered boulders. Those are all customizable in a separate editor, but as a map maker it gets simplified down to painting a shape.
You can also paint settlements or manually place places and roads. A settlement is an area that needs to be filled with roads and buildings. You can manually draw roads and put points of interest (e.g. "blacksmith goes here" or "main road cuts through town here"), then let the rest of the settlement get filled in with procedurally-generated plots of land, buildings, roads, etc. This gives a good balance of precise control (the procedural generation will never override something you manually placed) and extremely large-scale edits (with a single brush stroke, the editor can fill in hundreds of buildings that you might have otherwise had to manually place).
Finally (well, not really finally — I'm cutting out a lot of in-progress stuff for the sake of brevity and somehow still failing at brevity) you can create people. The generator will automatically populate towns with procedurally generated inhabitants, but you can also explicitly create individuals with their own names, appearances, etc.
Assembly
After the map maker has drawn their map, it needs to be assembled — this is the point where a vague instruction like "settlement covers area" gets converted into individual plots of land, houses, connecting roads, etc. Building generation is all procedural — there are no premade houses that get modeled in a 3rd party application like Blender and then imported into the game. This gives a great deal of flexibility, but also adds a lot of complicating factors — hence why all the buildings in the game currently look like they were rendered by a boiled potato. It's very much a work-in-progress.
Baking
This is the final, most computationally-expensive step. All of the biomes, all of the settlements, all of the roads — it all has to get converted into a set of 2D texture tiles that represent the terrain's height and materials. The minimum scale that needs to be supported is 10 square kilometers, and I'm aiming to eventually support much larger maps. Optimization is critical here: if you paint a biome over a 50 square meter area, it's unacceptable to naively re-bake the entire map. Right now the current performance is Good Enough™, which is to say I'm going to have to repeatedly revisit this in the near future as the world I'm building grows. One must imagine Sisyphus happy.
What's next?
Now that a world can exist, the next objective is to make living in that world difficult enough to be fun. The exact level of difficulty is customizable on a world-by-world basis, so you can make your setting Kenshi-level brutal or Animal Crossing levels of comfy, but in all cases Untold Lore is a survival sandbox and there has to be some sort of pressure on the player.