Filed under Desktop Development , Game Development
So now that we’ve calculated elevations and somewhat created the Y axis on our map , we can now create some rivers! Rivers will turn or boring looking island into a much better , interesting environment. We’ll also use rivers and watersheds to calculate moisture and biome later on so we definitely need them.
We’ll use a simple method to generate them , we’ll get a few random points on the map and then create the river down to the ocean or a lake using the elevation datas. The number of rivers and the starting points will all be random for now.
First of all , we’ll iterate through all corners and create a “Downslope” property for them. Downslope will be the adjacent corner with the lowest elevation or in other words , the way which water will run.
Then we’ll do pretty much same for the calculation of watersheds. Iterate through all corners and set the Watershed of the Downslope corner as the current corners Watershed until it reaches water.
Then we’ll actually create the rivers , take a random corner between statically set elevations ( like 0.3 and 0.9 , since we don’t want rivers starting at the beach or at the top of the mountain ) , follow downslopes till water and calculate river width depending on the watersheds we calculated earlier.
Huh I don’t even know why did I bother to explain it like this , it should be much more easy to explain with code!
[More]