Personal Project:
Map Creator
/
Recreation of Hearts of Iron IV

Genre: Tool

Engine: Unity

Platform: PC

Time: 4 weeks


This tool is a recreation of how Paradox especially Hearts of Iron IV handles their maps and how to keep track of "provinces".

The concept works is currently that I randomly place points on a map and use voronoi to make shapes from the points.
I then you give out the a colour id to every shape. Using rgb i can get around 16 million different combinations before I run out. The colour of a province act as a kind of key which can be used to get information about the "province" or tile. Such as an owner country or if the unit is allowed to pathfind there.

Every tile has various types of information about themselves and other tiles around them, such as their neighbours. This easily allows pathfidning on the tiles.

Later iterations of the tool add a centroid of the tile using the average of the tiles border to establish where the closest thing to a center is.

If the player would wish to set the target for pathfinding then a ray is cast from the screen space to the map and gets the colour of the pixel that was clicked, and using the colour key it is possible to get the node attached.

This system is expandable, making it possible to have tiles within tiles depending on how close the camera is to the map. Because a colour is a key, one can set it so that if the camera is far away enough all the child tiles take on the colour of the tile. This makes it possible to have layers of related. One such use case could be planets that are able to be "orbited" and then clicked in on to move on the surface.

Instead of having a bunch of colours displayed to the player. I made it so that tiles can have a display colour only visible to the player. This can for example create countrie, like in the picture where i crudely recreated Hearts of Iron IV.

Tiles can even be owned by "countries" so if a unit from france would take all the provinces from italy then all tiles owned by italy would convert to being blue, the colour of france.