Many things happening as always and feel like I need to do 10 devblogs. For now, here's a new thing:
Basically, terrains now aren't bound to only be the core "base" tile that defines the terrain type. There is also a "detail" layer that exists on top of that, that allows you to not only change the look of the tile, but can also alter the properties of a tile. This is just a simple example with some flowers and mushrooms with some units standing in it, but detail terrains can be anything from roads to mountains, etc.
What's really interesting about this as well was that it is REALLY pushing the isometric-ness of the game to the limit. There's actually a fairly complex pipeline to make a lot of this stuff happen, and the game effectively has ~5 layers of stuff in it that all have to overlap in the right way and not look weird.
The detail terrains themselves were really interesting to implement — instead of creating another full map and interleaving the mesh of it with the mesh of the base terrain, I'm now using geometry shaders on the map to "emit" the detail layer on the tile. This means I can keep the whole map to a single class and not worry about having to juggle multiple maps.
One other thing:
Notice how you can see the detail terrains on top of the infantry units, but don't see the same overlap on the buildings (despite those buildings be on tiles with detail - I promise). This was a surprise as part of this process — basically, all units don't actually "feel" like they should interact with the detail in the same way, despite them all existing as the same types of entities on the map. What I did here to do this was added in a flag to the data file of a unit, stating if it should be drawn on top of detail terrain. Then, when that unit is placed on the map or moved, I offset it slightly closer to the camera if it's meant to be drawn on top of the detail terrains. I don't bring it
too far forward though because then it would break the sorting of the tiles "below" it, drawing on top of elements that are meant to overlap it. It's a delicate balance!
The
other part of this was managing the sorting of tiles more general as well. If an infantry unit appears
under the flowers, and the flowers are detail, doesn't that mean it would appear
under the road as well because the road is detail? Well if everything was sorted to the same layers, yes! This is where the five layers of the game come in though to make sure that doesn't happen.
Cantata's map has 5 layers (6 if you count both interactable layers), ordered here from farthest from the camera to closet
1. "Flat" terrains — these are terrains that don't have elements that are meant to overlap tiles behind them (think grass, flat lands, sand, etc.)
2. "Flat" detail — these are detail terrains that always draw on top of flat terrains
3. "Non-flat" terrains — mountains, forests, etc. - terrains that overlap elements behind them
4. Interactable layer with "blocks detail" not checked
5. "Non-flat" detail — these are elements on top of those non-flat elements
6. Interactable layer with "blocks detail" checked
It's worth noting as well that if a flat detail terrain is put on a non-flat terrain, it gets bumped to the non-flat detail layer, that way the detail is always visible. TBH I had no idea this was going to be such a pain to do! The original target concept art had this stuff and it seemed like a no-brainer, but it also makes sense why so many isometric games don't do this mixed approach we do, and instead will just have two layers. However, I do think it looks wonderful now and I'm glad it's in!
Here's one last shot of me messing around with detail terrains in the editor:
Hope you enjoy!