Skip to main content
Back to Blog

From Azgaar's Fantasy Map Generator to Playable Kingdom: Building a World Pipeline in Unity

April 6, 20268 min readUnityProcedural GenerationGame DevelopmentWorld BuildingAzgaarFantasy Map GeneratorVoronoiTerrain Generation
From Azgaar's Fantasy Map Generator to Playable Kingdom: Building a World Pipeline in Unity

I'm building Kingdom Sim, a medieval political simulation game in Unity, targeting Steam on PC. You play as a king ruling over a procedurally generated island of competing kingdoms. Your goal is to survive, hold power, and expand your realm through politics, marriages, intrigue, wars, and scheming.

The world is populated with characters: dukes, barons, courtiers, rivals, each with their own traits, families, and ambitions. Your council advises you. Your dukes may or may not stay loyal. Rival kings plot against you. Succession is never guaranteed. Think Crusader Kings III but scoped way down: a focused experience built around political maneuvering and difficult choices rather than sprawling simulation.

Before any of that could work, I needed a world worth fighting over. Provinces with towns and castles. Terrain with mountains and rivers that form natural borders. Forests and farmland that affect economy and warfare. A map that players could look at and immediately understand as a place, not a dataset. Hand-crafting all of that as a solo dev was not an option. So I built a pipeline instead.

Here's how I'm turning a single export from Azgaar's Fantasy Map Generator into a playable Unity world with terrain, dynamic kingdoms, and a feudal hierarchy on top, and where the pipeline stands right now.

What Didn't Work: Voronoi-Based Procedural Maps

My first attempt was a fully procedural Voronoi-based map generator built directly in Unity. Seed random points, compute Voronoi cells, assign each cell a province, build an adjacency graph, run the simulation on top.

It worked for the simulation. Provinces had adjacency. Kingdoms could expand. The political systems ran fine.

But it didn't look like a world. Voronoi cells produce clean, geometric regions with straight edges and uniform shapes. No mountain ranges forming natural borders. No rivers carving through valleys that force armies into chokepoints. No coastlines with bays and peninsulas. Every map looked like a stained glass window, not a place anyone would want to conquer.

Voronoi-based procedural map in Unity showing geometric province cells with uniform shapes and no geographic features

That matters more than it sounds. In a political sim, mountain ranges should separate kingdoms. Rivers should define province boundaries. A coastal duchy with a natural harbor should feel different from a landlocked barony surrounded by farmland. Without geography baked into the map, the political layer has nothing meaningful to sit on top of.

The simulation didn't care, but players would.

The Solution: Azgaar's Fantasy Map Generator

I needed something that could generate believable fantasy worlds, geography that looks hand-drawn but is fully data-rich under the hood. Azgaar's Fantasy Map Generator is exactly that.

It's a free, open-source browser tool that produces detailed fantasy worlds: provinces, burgs (towns), population data, adjacency graphs, heightmaps, biome classifications. Under the hood, it simulates tectonic plates for realistic continent shapes, precipitation models that determine where forests and deserts form, and river systems that flow naturally from highlands to coastlines.

I export one JSON file and a set of image maps. That single export gives me:

  • Province boundaries with full adjacency data
  • Burgs with names, populations, and geographic coordinates
  • A heightmap as a grayscale image
  • Biome masks: forest, farmland, snow, desert, and more

The JSON becomes my simulation data. The images become my terrain.

The difference from Voronoi is immediate. Mountain ranges run in realistic chains. Rivers flow downhill from highlands to the sea. Coastlines have natural irregularity with harbors and peninsulas. Provinces follow geographic features, a river boundary, a mountain pass, rather than arbitrary cell edges.

Azgaar's Fantasy Map Generator showing a generated world with realistic coastlines, provinces, and kingdom borders

It looks like a world that could exist.

Terrain: Heightmaps and World Creator

Azgaar's color-coded elevation map converted to a grayscale heightmap for Unity terrain generation

Azgaar gives me a heightmap, but raw heightmaps are flat and lifeless. Mountains look like smooth bumps, rivers are invisible, everything feels like a plastic relief map.

The plan is to bring that heightmap into World Creator, a terrain generation asset for Unity. It takes elevation data and adds what's missing: erosion that carves realistic ridges and river valleys, proper slope distribution, sediment accumulation at the base of hills. The terrain starts looking like it was shaped by weather, not by an algorithm.

Right now, the terrain is still rough. No erosion passes, no visible rivers or mountain detail. It's a functional heightmap that the simulation runs on, but it doesn't look like a fantasy world yet. That's the next visual pass.

First terrain pass in Unity showing the imported Azgaar heightmap with basic elevation and texture but no erosion or river detail yet

Biome-Driven Spawning (Planned)

Azgaar classifies every region by biome: temperate forest, grassland, tundra, and so on. The plan is to use those masks in World Creator to drive procedural placement. Forests on forested regions. Farmland textures on grasslands. Snow and rock on high-altitude tundra. The map paints itself based on the underlying data.

This isn't wired up yet. But the biome data is already in the export, so the path from data to visuals is clear.

From Map Data to Game Entities

The JSON import pipeline runs once at startup. Azgaar's data maps to my entity model like this:

  • Azgaar burgs become Lordships. Each burg is a lordship, the smallest ownable unit. The largest burg in a province becomes the ducal seat. Population data feeds into the economy.
  • Azgaar provinces become Provinces. Direct mapping. They keep their adjacency graph, which drives border rendering, war declarations, and trade routes.
  • Azgaar states become nothing. I throw these away entirely.

That last point surprised me. Azgaar generates full political states with capitals and diplomacy. But they're fixed per export, and I wanted different kingdom configurations on each playthrough. Fixed geography, dynamic politics.

Region-Growing Kingdoms

Instead of using Azgaar's states, I generate kingdoms at runtime using a region-growing algorithm on the province adjacency graph.

The algorithm picks seed provinces, then expands each kingdom outward one province at a time, respecting adjacency. Each step claims a random unclaimed neighbor, so growth patterns vary between runs. The result is always contiguous territories: no disconnected exclaves, no border gore.

The number of kingdoms is configurable, and because growth order is randomized, the same map produces different political landscapes every run. One game might have a sprawling northern empire and fragmented southern duchies. The next might split the same continent into evenly matched rivals.

The player learns the geography over multiple playthroughs while facing new political challenges each time. Same valleys and mountain ranges, different kingdoms claiming them.

Layering It in Unity

With terrain generated and entities built, the last step is making it all visible.

Lordships spawn at their Azgaar coordinates as placeholders for now, simple markers positioned on the terrain. The visual hierarchy (towers for small burgs, walled towns for medium, full castles for capitals) is planned but not built yet. What matters at this stage is that every lordship is in the right place, sitting on real terrain, and wired into the simulation.

Borders took more work than expected. Azgaar exports border data as edge segments between cells, but those segments don't form continuous lines out of the box. I had to chain them into continuous polylines, handling T-junctions where three provinces meet and resolving gaps at corners. The border meshes are subdivided to follow terrain elevation, so they drape over hills and along valleys instead of cutting through in straight lines. Small detail, but it makes the map feel grounded rather than painted on.

The map uses zoom-based visibility layers. Zoomed out: kingdom borders, names, color-coded territories. Zoom in: province boundaries and labels. Get close: individual lordships, burg labels, settlement icons. Same data at every level, just progressively disclosed.

The Full Pipeline

Azgaar exports a believable world. Unity imports the JSON, grows kingdoms, and renders the base map. World Creator will eventually turn the flat heightmap into real terrain with erosion and biome-driven vegetation.

Kingdom Sim map in Unity showing terrain with kingdom borders, province boundaries, lordship markers, and the feudal hierarchy panel

What's working right now is the simulation layer. Every noble in the game, from your trusted chancellor to the ambitious duke eyeing your throne, is tied to a specific lordship or province. Their income comes from the land they hold. Marriage alliances connect families across provincial borders. War declarations follow adjacency graphs. When a duke dies without an heir and three barons each claim his seat, that crisis plays out on real geography.

The visual side, terrain detail, biome spawning, settlement art, is still placeholder. But the data pipeline is complete. Every province has real adjacency. Every lordship has a position and an owner. Every kingdom has borders that follow geographic features. The simulation doesn't need pretty terrain to run, it needs correct data, and that's what the pipeline delivers.

Because biome data is already in the Azgaar export, there's a clear path to tying gameplay to geography later: farmland provinces producing more tax income, forested regions slowing army movement, mountain passes becoming chokepoints. The data is there, waiting to be wired up.

Where It Stands

The data pipeline works. The political simulation runs on real geography. The map is functional, not pretty yet, but it's a foundation that everything else can build on.

What's built: Azgaar import, province and lordship entity mapping, region-growing kingdom generation, border rendering, zoom-based map layers, and the feudal hierarchy that ties characters to land.

What's next: World Creator terrain passes (erosion, rivers, mountains), biome-driven vegetation spawning, settlement art replacing placeholders, and then the player-facing systems: decisions, rival AI, war, succession.

The world generation pipeline is done. Now I get to build the part that makes it dangerous.