Patch: The Rainfall River Generator
Posted: 30 Nov 2014 19:49
I hereby publish the Rainfall River Generator.
It is a completely new, sophisticated river generator. Features / the basic idea at a glance (more information in the attached manual, and if you want to dive a level deeper, in extensive source code comments):
- Each tile gains one unit of water
- Water flows downwards, sums up, generates rivers once a certain flow is exceeded
- Lake basins fill with water
- All rivers are connected, i.e. there are no gaps between the spring and a destination lake or the ocean.
- Islands in lakes
- Optionally wider rivers, if flow exceeds certain bounds, a river gets e.g. two or three tiles wide.
- Optionally wider valleys, to get usable space if the small valleys of a heightmap would otherwise be completely consumed by a river
- Extensive configuration options, e.g. the flow needed to actually form a river can be chosen freely; choosing 201 gives a bit less rivers than 200
- Adds a dropdown for the to be used river generator to the map generation windows
- Maintains the "Few", "Moderate", "Lot of" simple settings, and transforms chosen values into the configuration world of the Rainfall River Generator
- NEW since version v9: Generate cities preferable somewhere near rivers and lakes
Look at the attached screenshot for a first impression of what it does.
I publish this patch after about two months of occasional evening-work in an already quite mature state, the calculation should be finished, things like lake generation (which was probably the most complicated thing in terms of algorithms) - hopefully - simply work. Basically, beside some small flaws I have currently no TODOs with it left.
Of course I wouldn´t have done that work if I wouldn´t aim at something that can finally be a second river generator beside the existing one in trunk. Thus, any feedback is welcome, as long as you don´t ask me to completely switch algorithms...
The primary aim of the generator is producing qualitatively good, real-world-looking rivers and lakes. What should be clear is, this comes at some performance cost, especially because several of the calculation steps (e.g. calculating number of lower tiles, calculating flow) don´t actually depend on the number of rivers the player finally sees, but just scale with the map size. But in terms of landscape generation I personally regard it as quite ok, if it runs for some dozens of seconds and finally produces a good result; after all I then typically play that result for days or weeks of real-world-time.
Especially, people who like 2048x2084 or 4096x4096 maps will wait relatively long when using that generator. But my aim are more the 512 or 1024 maps anyway; I would never play a 4096 map simply because I cannot fill it with railroads etc.
Anyway, it does what I want, have fun with it.
It is a completely new, sophisticated river generator. Features / the basic idea at a glance (more information in the attached manual, and if you want to dive a level deeper, in extensive source code comments):
- Each tile gains one unit of water
- Water flows downwards, sums up, generates rivers once a certain flow is exceeded
- Lake basins fill with water
- All rivers are connected, i.e. there are no gaps between the spring and a destination lake or the ocean.
- Islands in lakes
- Optionally wider rivers, if flow exceeds certain bounds, a river gets e.g. two or three tiles wide.
- Optionally wider valleys, to get usable space if the small valleys of a heightmap would otherwise be completely consumed by a river
- Extensive configuration options, e.g. the flow needed to actually form a river can be chosen freely; choosing 201 gives a bit less rivers than 200
- Adds a dropdown for the to be used river generator to the map generation windows
- Maintains the "Few", "Moderate", "Lot of" simple settings, and transforms chosen values into the configuration world of the Rainfall River Generator
- NEW since version v9: Generate cities preferable somewhere near rivers and lakes
Look at the attached screenshot for a first impression of what it does.
I publish this patch after about two months of occasional evening-work in an already quite mature state, the calculation should be finished, things like lake generation (which was probably the most complicated thing in terms of algorithms) - hopefully - simply work. Basically, beside some small flaws I have currently no TODOs with it left.
Of course I wouldn´t have done that work if I wouldn´t aim at something that can finally be a second river generator beside the existing one in trunk. Thus, any feedback is welcome, as long as you don´t ask me to completely switch algorithms...
The primary aim of the generator is producing qualitatively good, real-world-looking rivers and lakes. What should be clear is, this comes at some performance cost, especially because several of the calculation steps (e.g. calculating number of lower tiles, calculating flow) don´t actually depend on the number of rivers the player finally sees, but just scale with the map size. But in terms of landscape generation I personally regard it as quite ok, if it runs for some dozens of seconds and finally produces a good result; after all I then typically play that result for days or weeks of real-world-time.
Especially, people who like 2048x2084 or 4096x4096 maps will wait relatively long when using that generator. But my aim are more the 512 or 1024 maps anyway; I would never play a 4096 map simply because I cannot fill it with railroads etc.
Anyway, it does what I want, have fun with it.