Hello!
I have started a small project with the intention of building a terrain generator / editor in order to create terrains similar to those founds in games like CIV5/6 or Age Of Wonders to name a few of the big ones (albeit simpler than those of course). Below I provide some images to serve as reference of the type of terrains I'm aiming to reproduce, specially the second one which is the closes to the kind of look I'm trying to achieve albeit in a much smaller scale :
My current approach to the problem of generating the terrain is as follow:
1 - First, we generate a hexagonal grid following the theory from RedBlobGames. Store the hexagons data (ID, vertices and anything else that may be necessary) and create a single mesh comprised of hexagonal cells, similar to the one created by CatLikeCoding at the beggining of the first chapter. (i.e the actual terrain mesh has an hexagon pattern). This is the point I'm doubtful about, more at the end.
2 - Depending on whether we are procedurally generating the world or editing it by hand, use a noise function or user input to create a texture where we store, for each hexagon ID, the type of terrain (plane, hill, forest, mountain, shore, ….).
3 - Now, for each cell in the grid two operations are necessary. First, depending on the type of terrain (plain, hill, mountain, …) add extra triangulation to the hexagon so it has enough triangles to accurately represent the terrain characteristics. I believe one could be more fancy and use tesellation or other techniques to provide better results but I will keep it simple and optimize later, furthermore I'm completly ignorant of how tesellation actually works so I will stay away from it for now. ?
4 - Afterwards, once all hexagons have been triangulated with extra triangles if it was necessary, I will use procedural generated heightmaps to create the shapes of the mountains or whatever other kind of terrain I'm trying to simulate.
5 - For things like rivers or roads, I feel I will try to generate them with curves and directly modify the terrain mesh in order to place them on it. Think of something similar to what is done in city builder games. I believe this can be a bit troublesome but right now I'm not too worried about it and I feel this approach will work quite well.
While I believe I have more or less a direction to move on there are some doubts I wasn't able to find on the Internet regarding the concept of hex meshes for terrain generation of hex grids games. Let me explain myself:
In step 1, I generate a mesh with an hexagon pattern for the terrain (like this). Do games as the ones I provided above really have an hexagonal pattern mesh (with lots more of extra triangles of course) as their terrain mesh?
As far as I see it, it could be possible to create a simpler quad mesh and then, “hexagons” (which wouldn't really exist in the mesh but instead only logically) would store all the vertices that are inside their area and influence them when creating whatever terrain the hexagon would contain. This quad mesh wouldn't adapt well for games where the terrain is quite stylized and hexes are cleary visible (as the example from CatLikeCoding is) but seems pretty good for games like CIV where the hexagons are quite hidden.
Of course, this method would give some issues for actually showing an hexagonal grid over the terrain as it would have dissapeared completely from it. Instead, a decal projection could be used to show the grid over all the terrain (as in this image) and, for cases like borders or areas of movements a second simple hex like mesh could be used for them combined with a little bit of shader trickery, maybe as a postfx rendering the area to a mask or something else, like this, or this one or this final one which wouldn't be a an pure hex.
Am I correct to think that there is no need to actually instantiate a hex-patterned mesh if my objective is to achieve a more “realistic” looking terrain and the correct solution would be to instead use a simple quad mesh for the terrain below?
Thank you very much,
Sorry for the wall of text and hopefully I made myself quite clear ?.