Thursday, March 18, 2021

First Steps: Creating the terrain and wall systems

The first step in creating the game was the terrain, I went through a fair amount of trying stuff out myself, I good some decent results but they didn't work the way I needed them to work for the game.

One thing I experimented with is shallow water equations (that's how they implemented the water system is Cities: Skyline) with all kinds of erosions and tectonics.
rocky terrain rises from the fractures and erodes into sand the water can carry, it was very cool and I planned soil to be generated from organic decomposition - but it didn't go with the well with the rest of the design and didn't scale to the map sizes I need... just too much for me, let's save that one for Hex Hold 2 ;)

Finally I decided on using Catlike Coding's Hex Map tutorial.
The terrain, water and river mesh triangulation code is pretty much what is featured in Catlike's tutorial, changes I made to them are very minor.
I created my own chunk/batching system, and used Amit Patel's hex guide for all the hex related math, coordinate system and etc.

What I changed on the visual side is the textures and the terrain shader - I added specular, smoothness and AO textures.
Also tried adding normal maps, but it didn't go well with the aesthetics.

The terrain textures reflect the state of the climate, you can think of them having 3 layers.
the bottom is the rock layer, it shows the terrain hardness, terrain can be either soft (showing no rock), medium ( 1/3 of the texture is rock) or hard ( 2/3 of the texture is rock)
the middle layer is the main layer, it goes from sand-earth-grass depending on the total humidity (ground and surface water) and salt levels (I need to add temperature here too)
the top layer is snow, it comes in 4 levels (none, light, medium, heavy) and it shows when it's cold and wet enough (ground temperature and ground water)


You can see a video of all different terrain textures on youtube



After the terrain system was completed I began work on the castle walls, I wanted something similar to the walls in stronghold, the requirements I came up with are:

  • each wall segment takes a full cell

  • can connect to neighboring segments and to special buildings

  • can be made into a gatehouse and have stairs 

  • can have battlements: crenellations, machicolations and murderholes

Creating a system that does all of this wasn't trivial(at least for me), I spend about 2 weeks figuring out how to triangulate and implement it, here are some of the sketches I made during that time:




Pen & paper? where'd I get such ancient technology? anyway, you can see a video of the wall system in game on youtube


And that's how the game started to materialize..
Thanks for reading, if you have any questions feel free to ask.

No comments:

Post a Comment