Sign in to follow this  

Procedural rivers - from origins or estuary?

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

If you intended to correct an error in the post then please contact us.

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?

Any thoughts about that alternatives?

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this