Procedural rivers - from origins or estuary?

This topic is 2800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Note: I am currently working on algorithm, not on implementation.

My algorithm for procedural filling a predesigned world is as follows:
1. Take input: areas (like mountains, hills, plains, barrens etc.; first of all of course coastlines of islands/continents), climates, pre-placed cities, roads, rivers and lakes.
2. Generate heightmap based on predesigned areas from input (probably using jasjas' libnoise, as it looks friendly with all it's modules).
3. Carve predesigned rivers and lakes.
4. Generate random rivers (and, in the process, lakes) to fill the land (and erosion here).
5. Place pre-placed cities and roads (and some landmarks, if present on input).
6. Generate random cities, villages, roads and so on.
7. Generate vegetation based on: slopes - their angle and direction, near watersources, (generated in this step or before, dunno at this moment how exactly do this - but does not matter now) soil and so on.

I am not exactly sure about few points in detail, but this is about point 4. I want to use pathfinding algorithm to generate rivers (and lakes), with node cost as height, not distance. And here is the question: should I start at river origin (in mountains) and seek for another, "nearest" water (lake/ocean/see/river/w/e) or start at random point at coast and create first river, then it's tributaries?

Share on other sites
I'd *definitely* start at the coast.

Why?

Because it's really obvious if your pathfinding ends up making rivers not end at the coast.

Whereas it's *much* less obvious if some of your hills don't have rivers to drain into properly.... Who's going to look at a hill and say "There isn't a river close enough for rainwater to drain into"??

Always start with the more obvious bit (which is the estuary in this case) and the less obvious will often just hide itself.

Share on other sites
Heh, for me more obvious is starting a river from spring, as rivers flow to coastline/other rivers, not from them ;p

As for river ending in the middle of nowhere: if I use pathfinding algorithm, I tell it to say that it found a river, when that river hits other river/lake/coastline.

And as for "there should be a river", I though about making a river by erosion algorithm: if to much water flows there, then find a way to make realistic river.

Share on other sites
As an alternative (as you seem to be approaching anyway), you could simulate the real world. Water accumulates in an area and flows downhill to local low areas.

If you have a heightfield, start at some high location. From that location follow the local horizontal or downward tangents to the terrain, accumulating distance traveled. The size of the "river" depends on the distance traveled, assuming total drainage at a location is proportional to the length of the river. If you reach a local minima, look for a "close-by" location that is lower, "erode" to that location and continue.

If your heightfield is reasonable, most rivers will reach the coast.

Note: it's sort of backwards as real-world drainage paths are determined (mostly) by erosion to begin with.

1. 1
2. 2
Rutin
19
3. 3
JoeJ
16
4. 4
5. 5

• 36
• 23
• 13
• 13
• 17
• Forum Statistics

• Total Topics
631703
• Total Posts
3001814
×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!