Better Rivers

Last weekend I said I was done with the river generation algorithm... I wasn't.

I couldn't help myself and went back to it. I was deeply unsatisfied with the algorithm in multiple ways. It was too slow (for my taste), inefficient, and, on top of that the rivers looked very ugly. So I spent most of the weekend replacing parts of it and tweaking parameters to get something better, and I think it's slightly better this time around.

Here are some screenies:













To get these rivers I had to really abuse the algorithm and put in place some unintuitive constraints. Like making rivers evaporate more at lower temperatures and lose less water the closer they are to sea level... It's all a mess, but it works better somehow. I also replaced the drainage expansion algorithm to make it more efficient and I managed to reduce cell evaluation repeats to less than 0.5% (previously, it would do more than 25% repeats per drainage expansion).

To test an extreme case I created a flat world with almost no oceans and high overall rainfall. Here's River World:





The generation process does slow down quite a bit trying to expand drainage all over the map. But it isn't nearly as bad as I expected, with a slowdown of perhaps 4 seconds total on my 5 year old laptop.

I must say that the rivers on all of the above maps are highly unrealistic. Most Earth rivers wouldn't even be visible at the scales I'm working with. But at some point realism must be sacrificed to get interesting results... In any case, I would lie if I said I'm satisfied with the new rivers. I'm going to keep pushing at it for another weekend but now from another angle. This time I'll revisit the terrain generation algorithm once more to get the terrain to look more natural. If anything, these new rivers make ugly terrain artifacts way more obvious and I want to give it another try to hammer those out of the simulation. I promise though that I won't spend more than one extra weekend working on the algorithm. I already started working on the editor tools so I don't think it will take that long to get them working after being done with the drainage algorithm.