Are any of you familiar with DiamondSquare algorythims? I started to use these last summer to create beautifull randomly generated terrains (in my opinion these give the most natural looking shapes to random terrains).
www.youtube.com/watch?v=9HJKrctqIJI

I implemented this for terrains in 3DGS and with help from EvilSOB and JibbSmart I learned to write shaders in order to texture my massive randomly generated terrains at runtime.
www.youtube.com/watch?v=gjGJeNkAO3M

Currently I am back to this idea, but my game has changed from terrains to tile-based (thanks to Superku, sivan, and Uhrwerk for dynamic array allocation) because I find this approach easier for pathfinding, line-of-sight, creating random buildings/dungeons, etc... So my new "terrains" are made out of cubes/tiles and look like this:

*No texturing has been implemented yet (still working on a new shader) so they seem very flat, but believe me they are not. They are just massive (2048,2048 tiles). Each cube is "only" 32 (each edge) in size, but the map's heights range from zero to 2048. So believe me there is a lot of variation in the terrain even though it is not aparrent from so far away.

Now I am tackling a new problem... Creating realistic river paths. I do not want any code, what I am stuck with is the logic.
With the heightmap that this algorythim produces it is easy to create seas, oceans, and sea-level lakes. All I do is choose a height I want the sea level to be, label all the tiles at that level or below as "water texture" tiles, and raise them all to the chosen sea-level height.
The problem now is to create rivers and their origins (above sea-level lakes). I cannot place these lakes and rivers randomly on the heightmap because they look completely wrong if they dont look like they could flow in those directions according to the terrain inclination.

So I know I have to use the height data to create them, but I am stuck on the logic I would need to implement...
How would I decide where to place the origin of a lake?
How would I decide to what height the lake covers (what tiles to label as "water texture")?
How should I decide how the river should extend?
How would I decide where the limits are that differentiate the lakes from their rivers so I know which tiles (lake tiles) I have to raise and to what height?
All this using my height data and withough flooding the whole level...

Any ideas on how to approach this problem are welcome


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1