COMMUNITY - FORUMS - GENERAL DISCUSSION
The Shiny glint of sunlight off the water

Hail Elyrians,

Over the past few shinies, I've been talking about map making a lot. As you can probably imagine, it's on my mind as we move to complete Domain and Settlement Selection (while at the same time literally generating the game worlds you will experience when you play). One of the more vexing problems is how to deal with water.

If you paid attention to the Domain & Settlement Selection channel in our discord server, you have probably seen me talk about how Caspian has been working to tune the water simulation so that we can properly account for the various water features of each biome.

One aspect of that process is accounting for surface water. In a nutshell: Given the topology of a region, the rainfall it receives, and the quality of the soil, how does water flow and accumulate across its surface to form features like rivers and lakes?

Even more succinctly: Where does the water go when it rains in each biome?

We don't answer that question predictively, we actually simulate rainfall and water accumulation across the surface of the continent and watch where the water goes to gain an understanding of both how the water flows across the surface, and where it accumulates.

Some games have actually done this on a small scale before. One example that comes to mind is the unparalleled Dwarf Fortress which simulates the flow of water across its game's surface, though admittedly at a pretty coarse level. However, I don't think I've ever heard of a game that attempts this at the scope we are.

So, for example, here's how our test map looks at the first moment of the sim, when a year's worth of rainfall has just been dumped across the entire map:


Now, take in mind that what you're looking at here is a 2048x2048 image. I took that from the 4096x4096 debug mask that our sim spits out at the end of every iteration but that 4096x4096 map? That is, itself, a condensed version of the "full-scale" 65k by 65k dataset that we use for water simulation.

In other words, you're actually seeing only 1/32 of the overall data the sim itself is producing.

The simulation actually spits out two maps ever iteration, one that visualizes the flow of water (water that doesn't move or areas with no water appear darker than area with lots of water moving through them), and another that visualizes the accumulation of water (Areas with more water appear whiter and brighter than areas with little or no water).

Here's the water accumulation map at the start of the sim:


It appears nice and bright because a year's worth of rain has all been dumped on the map at once. So there's a LOT of water. That's why the map looks kind of flat on iteration 1.

But, if we fast forward a little, you can start to get an idea of what the water is doing on the continent. For example, if we look at the flow map we can begin to see where areas of true flow -- the likely locations of rivers and other flowing water features -- can be found:


Likewise, if we take a look at the water accumulation visualization we can begin to get a much better sense of where the water collects and pools:


These images from the first and the 36th iteration of the sim, but we actually run several hundred iterations of the sim to get a complete picture. Actually we run so many iterations of the sim to get it down to the right level of specificity that the OS has a tendency to deprioritize the running process, which is incredibly annoying - it makes the whole thing take longer, damnit! ;)

But, that irksome problem aside, the resulting data tells the world where the permanent rivers are (and where the wadis are too, though we don't actually simulate those in the live game), how fast they flow, how deep they get at each point, and where they pool and collect into ponds and rivers.

Now, that data gets analyzed pretty heavily by the system and any rivers or streams that analysis step deems "not active enough" or any lake or pond that isn't "deep enough" or large enough will be marked as "Do not show in-game," so don't expect to see quite as many rivers and lakes as you may see in these images. But, and this one of the things I love about this approach, we can say with some amount of authority that our rivers, streams, lakes and ponds are all real. Every rapids, every waterfall, that exists in Elyria does so because it would be there if the world were a physical place.

Nothing is placed simply because it looks cool (though, I'll admit, they will look cool) and that's because Elyria is more than just a "level" or a "Zone" -- Elyria is a world. Everything is there because it has a reason to be there, and a part to play in the massive clockwork mechanism that brings that world to life.

Stay Shiny friends!


  • Snipehunter
6/13/2019 3:14:33 AM #31

Posted By Snipehunter at 1:15 PM - Wed Jun 12 2019

Posted By Lodrig at 02:04 AM - Wed Jun 12 2019

Not really impressed, a proper wold gen involves erosion to sculpt the land forms and create the rivers simultaneously with the drainage topography. SBS clearly generated terrain first without the influence of erosion and then tries to model water flow with no alteration of terrain.

Whoah, hold up. No one said that. There is a difference between "We don't use this process for that" and "we don't do that at all" - and the space between them seems to be where you leapt to the wrong conclusion. If one looks at the coastline of the images we've shared, it should be pretty obvious that erosion has, in fact, been factored into the process. If that isn't clearly seen, then please allow me to say it explicitly: Erosion has been factored into the world generation process. In fact, this water sim doesn't touch the world until after erosion has been factored into the terrain data.

At a certain point in the process, we "freeze" the terrain - it becomes static data, a heightfield, that we then use in further world generation steps. From then on, the terrain is not malleable and cannot be terraformed. Once the terrain is static like this, we then model flow and water storage conditions for the static terrain data, that's the water sim we're talking about here.

Hope that helps! :)

I'm not making any judgment based on anything anyone said, I'm simply looking at your maps and inferring your processes from it as I know a bit about both the geology and standard techniques of map generation.

In any case your explanation seems to be that you did exactly what I said you did. Any "erosion" you did prior to water simulation was an emulation to try to make terrain that LOOKS eroded, as you can't actually simulate erosion without simulating flow. I suspect the you did what's called 'thermal' erosion on the world but that can't substitute for the lack of proper 'Hydraulic' erosion which is what I'm talking about.

Also the coastlines are not even the places one looks for erosion effects as coastline shape on a continental basis is dictated by plate tectonics. I would wager that you generated the coastlines shapes via fractal subdivision, a standard approach which produces decent results at a macro scale.

But I see no evidence of deltas, sandbars or any other deposition features that would form where a river meets the ocean and which only come out of a true simulation.


Seneschal for the Hrothi County of Iskar, Recruiter for the Duchy of Aritaur

https://discord.gg/qRQ3Zj6

6/13/2019 4:31:34 AM #32

Posted By Lodrig at 1:14 PM - Thu Jun 13 2019

Posted By Snipehunter at 1:15 PM - Wed Jun 12 2019

Posted By Lodrig at 02:04 AM - Wed Jun 12 2019

Not really impressed, a proper wold gen involves erosion to sculpt the land forms and create the rivers simultaneously with the drainage topography. SBS clearly generated terrain first without the influence of erosion and then tries to model water flow with no alteration of terrain.

Whoah, hold up. No one said that. There is a difference between "We don't use this process for that" and "we don't do that at all" - and the space between them seems to be where you leapt to the wrong conclusion. If one looks at the coastline of the images we've shared, it should be pretty obvious that erosion has, in fact, been factored into the process. If that isn't clearly seen, then please allow me to say it explicitly: Erosion has been factored into the world generation process. In fact, this water sim doesn't touch the world until after erosion has been factored into the terrain data.

At a certain point in the process, we "freeze" the terrain - it becomes static data, a heightfield, that we then use in further world generation steps. From then on, the terrain is not malleable and cannot be terraformed. Once the terrain is static like this, we then model flow and water storage conditions for the static terrain data, that's the water sim we're talking about here.

Hope that helps! :)

I'm not making any judgment based on anything anyone said, I'm simply looking at your maps and inferring your processes from it as I know a bit about both the geology and standard techniques of map generation.

In any case your explanation seems to be that you did exactly what I said you did. Any "erosion" you did prior to water simulation was an emulation to try to make terrain that LOOKS eroded, as you can't actually simulate erosion without simulating flow. I suspect the you did what's called 'thermal' erosion on the world but that can't substitute for the lack of proper 'Hydraulic' erosion which is what I'm talking about.

Also the coastlines are not even the places one looks for erosion effects as coastline shape on a continental basis is dictated by plate tectonics. I would wager that you generated the coastlines shapes via fractal subdivision, a standard approach which produces decent results at a macro scale.

But I see no evidence of deltas, sandbars or any other deposition features that would form where a river meets the ocean and which only come out of a true simulation.

While I completely understand nitpicking this if you're an expert/hobbyist on the topic... from a gameplay standpoint, where's the problem? They're not going for 100%, absolute realism, and they really shouldn't be, either. We do want the game somewhere shy of 2030 :P


To touch Divinity, one must be prepared to brave Reality.

6/13/2019 11:36:35 AM #33

Going into that much detail might be a bit much. Deciding which server's have which biome connected to which plate to create mountain ranges or volcanic activity or how erosion is affected by which climate based on both rain intensity (simulating weather is going to be another hurdle) as well as general soil type and etc might be a bit much for a game where they've decided to mix and match jig saw pieces of biomes as a form of map generation. It's going to get to the point where they're going to just need to manually touch up bits rather than simulate because everything is already so unrealistic. I mean getting the basic information on general flow rate per location alone has a lot of variables they're probably not taking into account.

-puts on civil engineer hat-

For example when getting just a rough idea on a flow rate there's the Rational Formula, but that's just a quick fire from the hip style of info.

Q = CIA

Where: Q = maximum rate of runoff (cfs)

C = runoff coefficient representing a ratio of runoff to rainfall

I = average rainfall intensity for a duration equal to the tc (in/hr)

A = drainage area contributing to the design location (acres)

However to get "C" you have to know which parts of the area you're calculating has what type of surface, from forest to grassy to rocky and etc and if they're a mix you have to ratio it out.

Getting "I" is a whole other ball game based on region to find out return periods and intensity's based on recorded rainfall in the area (which again, they gotta simulate weather and that's hecka hard to do accurately).

After getting just the basic flow, then you gotta go into the detail on the velocity of the blasted thing as well as calculate the time of concentration because you have to determine whether or not the flow that's going to said location is a spread, sheet, waterway, or a mix and then some.

-takes off civil engineer hat-

Point is, it's unrealistic to assume they can make an accurate erosion system because of how they decided to allocate their maps land mass via biomes. And the examples of those proven "map" generations are already excluding a lot of realistic values. They just need to make a general topography of the location, run a "trickle" calculation to see where rivers would form, and then they'll manually go in and just make the rivers and other channelized locations more realistic through artistic touch up. If there was a way to easily do this crap, I'd be having less headaches at work atm.


6/28/2019 1:54:55 AM #34

I learned something the other day I thought would be worth sharing here. When researching one of the centuries old trading trails near my home I found that its route follows the divide separating the watersheds of two river tributaries. The reason for that is that along the divide, one never has to cross any creeks or streams. That seems like a pattern that would be found over and over again, and it explains why "high ground" has anything to do with trade and commerce.