Rivers in "Alpha"

So, rivers are in what I'd call an alpha stage right now. They need finetuning to look better, more natural, and with features (real deltas, mid-river islands, varying river width), but the harder parts are done. At least, I believe so. Unless everyone thinks they look like shit, of course. This is a short post, I just thought I would show a couple of examples of what you can come to expect.

Feedback is very much appreciated, as rivers are very hard, and I want to get them right!


  1. Hmm. It may be a function of the scale, but they look too curved to me. I'm thinking this is a zoomed out view, so these rivers are Hudson River sized. At that scale, I'd expect them to be straighter. If the scale is different, the curves may be fine.

    Also, how are you placing the river's head? You mentioned placing the delta along an appropriate bay.

  2. Hi. The scale is neither zoomed in our out (It's a 1x part of a 4096*4096 image).

    I've experimented a bit with the curvation. At this point it's still somewhat random (otherwise the rivers would look totally unnatural), but it's basically just a tweakable option that can be increased or decreased. Perhaps I'll try some lower values again.

    As for the river mouth, I think the images show that the rivers run out into the ocean at places with typical bays or small fjords? Or did I misunderstand your question?

  3. Actually, I was wondering about the head of the river, not the mouth. How do you decide where to place the inland end of the river?

  4. Ah, I see.

    Due to performance challenges on large maps, I opted to go for a "good-enough" scenario.

    - The river has a given length.
    - From the river mouth, I find an optimal angle for the river.
    - I plot a straight line that is "river-length" long, from the river mouth, along the optimal angle.
    - I check if any point along that line crosses ocean. If so, I deem the angle infeasible.
    - I then shift the angle a few degrees, and repeat the process. If I have made a full revolution (360 degrees), I try it again, but this time with a shorter river length.
    - The process goes on until either a) The river length is shorter than some threshold I've set, or b) we've found a good angle.
    - Once the angle is set, I create a bezier spline to replace the straight line I used before. I make some tests (again, check that no points cross water, for instance), and the river is generated.
    - Afterwards, I have to erode and reduce the height of the river's surrounding lands, so that it fits in the landscape. (As opposed to most approaches, where the landscape makes the basis for where a river should fit. I tried this approach first as well, but generation took too much time).

  5. Very meandering rivers, that requires a pretty flat landscape and leads to oxbow lakes.

  6. Since these screenshots were posted, I've tuned the algorithm in several ways (including a factor that specifies the possible bend angles, or meandering). But even with a really high factor, I've not allowed for oxbow lakes... I never considered it very important to achieve, but I could be wrong. 100% realistic maps are still not my goal though, - I'm going for good-looking and believable.

  7. Hi, Terje,

    FWIW, I would want the ability to edit the river path afterwards, or erase it entirely, so that I can draw one in manually if desired. Auto-generated rivers may not always be in the place I want them to be, depending on other terrain features or the requirements of my fictional setting.

    Also, regarding the logic of first drawing the river, then eroding surrounding lands to justify its path: I would be concerned that on a large scale this could create rivers in nonsensical places. For instance, if local terrain is eroded to create river path, but on a regional scale the elevation and mountain watershed angle does not give a reason for run-off to flow through that river path, then the river appears unlikely in its given location.

    You say you tried the reverse (terrain first, then trace river path) but the rendering times were too long. How is it that a product like Campaign Cartographer achieves this? As a user I'd like to have the ability to tweak terrain to some extent (must have high peaks **here**), and then let rivers autogenerate from that geography. I'm wondering if there are some algorithms that are open source that you can borrow from that would accomplish this in a more practical rendering time.

  8. Hi Teramis.

    Thanks for the feedback!

    As for your first paragraph; I see what you're saying and it does really sounds awesome. Unfortunately, I believe that implementing this would be too huge a scope creep at the moment. I'd offer the options of generating (the same) maps with and without rivers though, - so you could at least post process it in photoshop or gimp.

    To your second point, I can only say: Yep, I'm very aware of this challenge. It's not optimal, and since rivers are seperate entities, I *can* redo this later without ruining the rest of the map, doing the more realistic approach.

    Algorithms for these kind of problems are usually either highly specific, or very generic (A-Star, Best-First, - typical path-finding algorithms). But, I would love to be wrong, so if you or anyone else know of any good links that I've missed, I'd be very happy so dive in.

    I'm not very familiar with CC, so I'm obviously curious, what's a large map in CC ( pixels * pixels ? ), and how long does it take to generate it?

    Thanks again!

  9. Unless the new version is vastly different than the old, I think Teramis misspoke. CC itself is a drafting suite, and does not calculate rivers. Fractal Terrains is available as a companion product, though. FT uses fractals to produce land forms, and does have a function to calculate rivers from there.

    As you surmise, it takes a long time on a large map. FT maps can be large, but I think (at least with my PC) anything larger than 2048*2048 takes longer than I'm willing to wait.

  10. Oh, this is interesting. My benchmark for a "complete" world is done with an 4096 * 4096 world. This currently takes around 5 seconds. Though including rivers, it excludes a few things like cities, language, lore, ruins, and other ...things. My goal is to provide a 4096 * 4096 world within 10 seconds. A map of 2048 * 2048 should take no more than 4 seconds. (Mathemathically it should take 2,5 seconds since (4096*4096) / (2048*2048) = 4, but there's considerable overhead).

    How does other software you've tried compare? 4 seconds for 2048*2048, 10 seconds for 4096*4096?

    I have no illusions that my algorithms are the best, but it's nevertheless interesting to see how others perform, and whether I should worry about performance (so much) or not.