OK, so now I have a basic terrain to work with (bar some tweaking to the fractal pattern). But there’s a few things missing: all the things which make a terrain a map. I’m talking rivers, forest, plains and deserts…biomes!
Now, as I’ve said before, the gross terrain features are easy; the heightmap already gives me mountains, hills, coastlines and seas. Using some trickery with a random prevailing wind, I can kind of super-impose the mountain’s shade into a rainshadow, so I know where my deserts are. But one thing I’m missing are rivers!
So how do we get rivers? We do some water/erosion simulation. Basically we find some mountaintops and run water down the sides, carving the heightmap down where the river runs over it. Because this is meant for a game, we’re not gonna do full scale erosion/Navier-Stokes water simulations here; it’ll take to long and the player will have an empty phone battery by the time we’re done. So we’ll have to simplify things a bit.
Anyway, the very first step isn’t as obvious as you’d think; simply iterating around the whole heightmap finding the highest point will get you only one point of origin for a single river; what I want is rivers coming down from all the mountaintops, so somehow we have to iterate over all the tiles and find an AREA which defines a mountaintop and get the rivers to spring from those tops, carving a riverbed on the way down.
This would be simpler if I had the one heightmap, but we’re working on tiles and with Android’s limited memory, we’re gonna hafta do some clever iteration to get this all done seamlessly and end up with multiple mountaintops which might be spanning multiple tiles.
Hopefully next post will contain some more boring pictures resembling iso-lined geographic GIS data. It’s odd, but to get the stylistic display I want, I first have to generate a more complex set of tiles, which get uglier the further along the process goes, before I can pretty them up again…