The Case of the Penrose River

For the past little while, rivers have been the priority for world generation. I’m hoping to have rivers entirely finished by the end of this week, ideally, so that I can then move on to working on mountains in more detail. So, without further ado, let’s talk about the mechanics behind river generation; how I’ve got them tracking their way across the landscape; and the uses of rivers to the aspiring URR player:

Why have rivers at all?

Well, for a start, they will play a role in determining where cities and villages spring up. Both are naturally more likely to appear near rivers due to fresh water access. Cities, however, will greatly prefer wider, more substantial rivers (especially if near the coast; fresh water & trading potential) while villages will be much more content with smaller supplies of water.

They also, obviously, provide fresh water for both the player and the majority of other creatures in the game. Sticking to rivers will make sure you always have a supply of water – and many useful plants, trees, and similar grow nearby – but other creatures of all shapes and sizes might have to come down to feed at some point. Cyclopes might be intelligent enough to create a well, but would a Behemoth be as sensible?

Thirdly, and most obviously, it wouldn’t be a world without rivers. Mountains generate rainfall, and rainfall has to flow somewhere, after all. Regardless, following rivers will always take you in the direction of either the ocean, or a lake, and likely passing by some signs of civilization en route. There will be a visible sign of the direction of flow; I simply haven’t added this yet, since it’s currently more important to get the rivers generating correctly for now.

Click to see full size! A river cutting a valley.

How are rivers formed?

Once height and mountains have been established, the game checks for mountains on the outsides of mountain ranges, and generally those that are part of a long-chain. Then, it attempts to make it the source of a river, which will happen if there are no other rivers in the immediate 3×3 grid around it. Assuming that’s the case, then the river draws itself across the map, moving orthogonally from square to square.

Rivers move from locations high on the heightmap to low ones. When they try to go through a higher square, they either a) go around it, b) carve a valley through it, or c) turn into an underground river which empties into the ocean somewhere else. If they reach the ocean, they turn into a delta or waterfall. If they have to terminate elsewhere, they end in a lake or a larger basin, depending on the flow of the river.

Rivers can also combine. If one river finds another, they will connect, and the flow of the two source rivers will combine to lead a stronger river in the future. As mentioned above, cities and civilizations are likely to grow up around larger sections of a river than smaller ones. The flow of a river determines its width, and the size of the delta or lake it might eventually create.

What is the Penrose River?

I have spent quite a lot of the time I’ve been working on rivers making sure they can never loop. Which is to say, a river cannot turn back upon itself and join up again, and end up in a loop. As was pointed out to me on Twitter, this effectively turned the ever-flowing-downhill rivers into Penrose Stairs.

Water cannot do this any more than stairs can.

Happily, this has now been dealt with, along with all issues of flow, loops, multiple lakes, and other kinds of garbage. Now it’s just a matter of, on the ‘local’ map – ie the human-scale one the player walks around on, rather than fast-travelling on the world map – making sure that rivers work out correctly along with all the cliffs, hills, coastlines, biomes and everything else…

Coming Monday 26th: Winter Screenshot Update!

Coming Monday 2nd: Thoughts on ‘realism’ in games, and in URR.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *