17-02-2024
Map Generation
Exploring the techniques and algorithms used for procedural map generation in Highland Hearth.
One of my earliest goals for Highland Hearth was to create a world that felt large enough to explore, settle, and gradually make your own.
Because every playthrough should feel different, I knew the world needed to be procedurally generated. The challenge was making that randomness feel natural, useful, and visually appealing rather than messy or empty.
Building the World with Noise
The foundation of the map generation system is noise.
By reading noise values across a grid, the game can decide what kind of terrain should appear in each location. Lower values might become water, higher values might become mountains, and everything in between can form grasslands, forests, dirt, sand, and other terrain types.
Highland Hearth uses layered noise to shape the world. One layer controls height, while another helps decide biome variation. Together, these layers create maps with coastlines, forests, open land, and natural barriers.
Making Terrain Look Natural
Generating terrain data is only part of the problem. The next challenge is turning that data into a world that looks good.
I didn't want hard, blocky edges between every terrain type. For a pixel-art game, small details matter, so grass, dirt, forests, and coastlines need to blend together with proper corners, edges, and transitions.
To achieve this, I built an autotiling system. Instead of simply placing a tile based on the terrain type, the game checks the surrounding tiles and chooses the correct graphic based on its neighbours.
This allows terrain to connect smoothly and gives the world a more natural, handcrafted feel, even though it is generated entirely by code.
Creating a Custom Autotiler
Godot includes useful terrain and tilemap tools, and I experimented with them early on. They work well for many projects, especially smaller levels or maps designed by hand in the editor.
For Highland Hearth, however, I needed something more specific.
The map is large, generated at runtime, and split into chunks for performance. I also needed the expensive calculations to happen away from the main game thread, so the game wouldn't freeze during world generation.
This led me to create my own autotiling tool.
The tool takes the terrain data, calculates the correct tile transitions, and produces the tile information needed to draw the world. Because this work can happen separately from the visible game scene, the loading process stays smooth and responsive.
Chunking the Map
Large worlds create performance challenges.
Rather than loading the entire map at once, Highland Hearth splits the world into smaller chunks. The game only draws the chunks near the camera, while the rest of the world remains stored as data until needed.
This keeps performance much more stable, especially as the world grows larger and more detailed.
I also experimented with the idea of an infinite world, where new chunks would generate endlessly as the player explored. And their navigation would be generated around them when needed. While technically interesting, it added too much complexity for the kind of game I wanted to make.
Highland Hearth is about building a living settlement, managing villagers, and filling the landscape with meaningful things to discover. A large but finite world gives me much better control over pacing, navigation, resources, and simulation.
Keeping Villagers Moving
Navigation was another major reason I chose a finite world.
In Highland Hearth, villagers are not just following the player around. They need to move around the settlement, gather resources, haul items, and complete jobs even when they are off-screen.
That means the navigation system needs to be reliable across the whole playable area.
Instead of relying on tile-by-tile navigation across the entire map, I generate navigation data from the same world information used to create the terrain. Water and mountains are treated as blocked areas, while walkable land is converted into navigation shapes that villagers can use efficiently.
This makes pathfinding much more reliable and avoids the performance problems I ran into with earlier approaches.
The Current Direction
The current system gives Highland Hearth the best balance between randomness, performance, and control.
Each world is still procedurally generated, giving every playthrough a different landscape to explore. At the same time, keeping the world finite allows the game to support better villager navigation, more reliable simulation, and more carefully placed resources and events.
Map generation has been one of the most technically challenging parts of development so far, but it has also been one of the most rewarding.
Seeing a new world appear, then watching villagers begin to move through it, gather from it, and build within it, is one of the moments where Highland Hearth really starts to feel alive.