Layer Brush

Turns out adding a brush to paint 'layers' was much more troublesome than I expected it to be. The biggest complication came from the fact that, internally, layers are a completely different beast than other terrain properties like altitude, temperature and rainfall. First I had to take into account that I needed to use the same tool to paint all layers available. So I needed to configure the brush to be able to switch between layer types on the fly. Then I had to create a unique data structure type to store layer changes in order to be able to undo and redo layer changes made by that tool. Finally, I had to make sure that layer changes would be stored to file when saving an edited world. With all that, I was still able to fully implement the Layer Brush after three days of work:





One thing to note about the layers brush is that it cannot paint beyond the terrain constraints defined for the selected layer. For example, in the GIF above, you can notice that the 'mycosystem' can't be painted in ocean tiles nor in arid tiles. This is because this specific layer is defined to only be available in above-sea-level tiles that have high rainfall. Of course, these limitations can be changed or removed by altering the mod file definition of the mycosystem layer. Though the mod would have to be reloaded after being edited.

My hope for this past weekend was to implement, aside from the layer brush tool, a level tool for layers that would work more or less in the same way as the other 'level' tools (sea level, average world temp, yearly global rainfall, etc). But my weekend ran out before I could even start with it. So I'm still not done with layers yet. Again, my hope is that implementing the level tool won't take that much time. At least it should be less complicated to implement than the brush tool and it should make use of the same data structures I implemented for the layer brush. Yet, thousand times before, I have been wrong when estimating these kind of things. Game development can be quite tricky...