Improved precipitation map

As you can see on the previous post, the precipitation map was really poor, with visible geometric patterns near tropics and few propagation of humidity from the sea to the land. It was generated from a land(0) / sea(1) map blurred and multiplied by a latitude coefficient.

I found a better method, simulating winds. Imagine a point on the map following the wind. When it is over the sea, it accumulates water in a waterCount variable. When it travels above land, it drops a part of its accumulated water at each step. To simulate orographic rains, the percentage of waterCount that is dropped on ground is proportional to the land slope in the wind direction.

This method has two benefits over the previous one :

  • precipitations are nicely spread from sea to land and don’t stop a few kilometers after the coast
  • mountains acts as barrier for precipitations

You can see below a comparison between the previous method and the new one :


final aspect

Now I didn’t try to do some wind simulation. I simply apply 4 steps, one for each cardinal direction. This is the altitude map used for this test :

On first step, for each map x coordinate, I simulate a wind that goes from north to south. I get this precipitation map :

North winds only

See how the precipitations are increased on the north flank of the mountain on the east continent ?

Now I can do the same thing with south->north winds and cumulate both precipitation maps, and again with east->west and west->east winds :

North + south winds

All winds

Note that lands near the map border are dry because no water can be accumulated before reaching them. You could fix this by initializing the waterCount with some random value.

The next step consists in adding the effect of latitude on precipitations. I want a desert area and a tropical area. I’m using a sinus function to alter the precipitation map near the equator. To keep it from creating geometric artefacts, I add a 2D noise to it.

Latitude impact

latitude impact

The precipitation map is used for biome generation, and we want the noise to be removed from the different biome (the player doesn’t want to swap from savanna to desert every kilometre, but rather have a big desert followed by a big savanna. This is why I blur the precipitation map as a final step, using a 5×5 kernel with all weights == 1 (you can do this easily with libtcod’s heightmap toolkit). The final precipitation map and associated biome map :

after blur

biome map

14 comments so far

Add Your Comment
  1. This is great and all but will you be releasing something we can play

  2. Well, I’m not sure I’ll release something playable one day, but what’s sure is that I’m having a lot of fun trying to 😉

  3. You could easily simulate the winds and archieve a more realistic rainfall map by using an approximative Coriolis effect.
    That is easily done by using two winds instead of four and directing them in north-east and south-west direction, in the area marked in this map:


  4. Woah Jice! I always wanted to create a realistic landscape, you are in the way of doing it. Congratulations! And keep up the good work!!! Next steps: rivers, lakes and swamps?

  5. I would love it if you could work in continental drift somehow to create more realistic larger continents.
    I’ve done some research on this subject, but best I can come up with is this:

  6. This is really interesting. I have just started playing around with Libtcod to create a Python roguelike. I happen to be experiementing with worldbuilding algorithms at the moment. These posts have been great inspiration.

  7. Hehe yeah, no problem, plus this makes for a nice screenshot filled entry!

    At first I thought that the simulationist approach was overkill, but looking at the result, the placement of terrain makes a lot of sense! Especially since the mainland is typically dry and wet areas are mostly near the coast. Lots of players may miss this detail, but at least they won’t deny that the generated maps are “cool” 😛 This has got to be one of my favorite entries in your blog so far.

  8. @Altefcat : ah. rivers and lakes. I’ve been trying to make them work for months. They’re my pet hate… But yeah, I definitely need them. Once the biome renderers are ok, I’ll jump in the river business… 😉

  9. @Antagonist : That’s totally insane ! That’s a huge and awesome worldgen resource ! Thanks, I’ll dig it ! I’m particularly interested in the erosion algo since mine really sucks right now…

  10. @Jotaf : Heheh thanks 🙂
    I’m not after the oversimulationism stuff. I only do what I think is important for the gameplay. Of course, with this map, I’m not after “The cave”‘s gameplay. I’m rather investing for the future TCOD. Still, it’s cool to have a realistic map in the cave even if I barely use it.

  11. Well, if you’re interested in links, heres a page full.
    They are intended mostly for 3D rendering, but I’m sure you’ll see alot of the generation concepts still apply.

  12. oh yeah, I already know this page. I’ve been lurking in its articles for a while 😉 In fact, I think the current libtcod’s erosion algorithm has been inspired by some of the articles there.
    I started to look at the erosion code from your previous link, and it’s.. erm.. hairy 🙂 But full of great ideas. I’ll try to distil something hot from it 😉

    @Worthstream, sorry I didn’t reply to your post. I’m not sure simulating Coriolis effect would have any interesting effect for the player. As for realism, only meteorologists might notice the difference, or am I missing something ?

  13. Well, only real advantage to the Coriolis effect other than the ‘wtf, awesome, they thought of everything!’ part is that it could help gain greater climate differences across regions without you having to force a sinus wave as you do right now. Whether it will actually cause this desired effect though I have no idea.

    By the way, if you ever feel the need to port any of this to CUDA, let me know 😛

    In my habit of links, I present to you this:
    specifically this page:

    No code, primarily a site for hand crafted worlds, but alot of interesting food for thought about how to provide variaty in the worlds you generate.

  14. I must admit that the “wtf awesome they thought of everything” side is tempting 🙂
    But in my simple model, winds only affect precipitations, not temperature. As far as I understand, I would need a more complex model, including pressure.

    Speaking of simulationism, the sketchmap in your CARPTIPS link is epic !!