In open landscape games, rivers can add a realistic touch to the look of the terrain. I am going to discuss a method for adding rivers to randomly generated terrain that adds this realistic touch we are looking for. Unfortunately, when we are dealing with random terrain this is not always a menial task. In real life the terrain is usually formed by water carving away at the land and forming valleys and other such terrain features. When generating terrains in a decent load time, however, we don't have this luxury. My final project at Full Sail was a real time tactical game called Liege on random generated terrain with rivers. Throughout this article I am going to discuss the methods I took to create rivers for Liege.
The plan of attack
First we need to formulate a plan of attack. The method that I discuss here is the one that I decided to implement as it best suited my targeted river idea. The goal of my river implementation was to create a single non branching river that passes through a territory in a realistic looking fashion. Using this goal we know that the river will begin and end on an edge of the map as it is only passing through the territory not beginning in it. Another thing we know is that water likes to flow downwards as it would be defying gravity to flow upwards. This implementation brings simplicity to the process while still adding key detail to the map.
What do we need?
To pull this off we are going to need a couple key algorithms:
Many of these may vary depending on the overall look you are trying to achieve with your river but I will step through the basics and what I have done to accomplish the look I have been going for.