Procedural Map Generation in C++ — Part 1: The slow, the bad and the ugly

David Delassus
16 min readFeb 11, 2023

This is the 6th devlog of Warmonger Dynasty, a 4X turn-based strategy game made in C++/SDL. If you want to read the previous entries, take a look at my reading list.

In my previous devlogs, I talked more about the engine than the game. I felt it was an interesting topic so that you can appreciate more the next devlogs. It is now time to tackle the game 🙂

Every 4X strategy game needs a map, you can have a handcrafted map like the Total War Warhammer series, or a random one like Civilization.

Let’s start by saying that I’m not very good at level design, or art. Therefore, I choosed to go with a random one.

NB: For the art, I’m using assets bought on the Unity Store from David Baumgart.

Part 1 : The map data structure

Because hexagons are the bestagons, I’m using a hexagonal grid for the map, with pointy-top hexagons.

Therefore, I implemented, thanks to this great article, a hexagonal coordinate system and storage:

  • hex::coords::cubic : Cubic coordinates (…

--

--