Sunday, October 16, 2016

Is it Windy in Here?

One of the things I'd like to add to the map generation is realistic biomes -- where grass, forest, desert, etc. naturally occurs on the map.  The biome in a location is largely a function of the amount of water available and the temperature.  This is often illustrated with a Whittaker diagram.


Temperature is pretty straightforward (warmer near the equator and colder near the poles), but the amount of precipitation is more complex.  Martin O'Leary's map generator just has a fixed amount of precipitation at every location.  (It's only used to generate rivers.)  My notion of an interesting map has a variety of biomes, so I wanted something more complex.  I could use noise to create the precipitation pattern, but I also want the map to be plausible.  Using noise could lead to some odd maps: jungle next to deserts, an isolated pocket of heavy rainfall deep in a mountain range, etc.  The human mind is pretty good at rationalizing patterns, but I wanted something a bit more realistic.  I decide to simulate a very simplified rainfall model:  moisture enters the atmosphere by evaporating from the oceans, is blown onto land by the trade winds, and precipitates out where conditions are favorable.

The first step in creating this rainfall model is wind.  Real wind models are of course very complex, but my concern is primarily with how the surface winds are affected by the land geography.  At a very simple level, this is just how the rise and fall of the land changes the direction and speed of the wind.  I experimented with a variety of different approaches, but in the end settled on two simple rules:
  1.  Wind slows down when going uphill and speeds up when going downhill.
  2.  Wind turns away from obstructions.
The simulation of the wind is a flow model.  The wind in a location is represented a vector of the wind force and direction.  At every time step of the model, the wind in every location is propagated forward based upon its direction.  If the new location for the wind is higher, then some of the wind is turned aside while some of the wind continues upward but at less force.  How the wind splits depends upon the steepness and direction of the slope.  Conversely, wind going downward increases in force and turns towards the downward slope.  All the wind entering a location is then summed to get the new wind force and direction for that location.  This repeats until all the wind has propagated across the map and disappears out the edges.

Here is an example of wind interacting with the surface geography:


The red arrows represent the wind vectors at each location.  In this example, the island rises up out of the sea and presents an obstacle to the incoming wind.  The wind splits around the island and the wind that goes over the island is slowed.  The result is a "wind shadow" on the leeward side of the island.  The peninsula has a similar effect and the two features funnel the wind between them.  (Note that there's actually wind everywhere; for display purposes I'm not showing arrows where the wind is very weak.)


Here's a more zoomed out view, showing the wind patterns up a mountainous coast.  The high hills along the sea make it difficult for the wind to reach the interior.  Along the southern part of the coast the fairly steep shore turns the wind northward. It flows up the coast until it enters an inlet, where the land to the north turns it inward. It flows up the inlet until it is forced up the slopes and onto the land. In the upper left you can see how the wind tends to flow up the rills and valleys where the path is easiest. Once upon onto the generally flat land above, the wind starts to spread out.

Tweaking the rules on how slopes affect the wind can lead to stronger and/or more chaotic patterns.


This picture illustrates how the wind can form very distinct and complex patterns.  This map has gentle slopes and a number of large rounded hills. Wind hits the land almost directly, where it gets filtered by the coast into a number of strong streams. These flow inland, generally following the topography, turning, splitting, and rejoining. In places the prevailing wind blows at 90 degrees or more to the original trade wind. Weaker winds (not depicted here) can be quite chaotic, flowing every which way.

I'm generally pleased with the wind model -- it generates complex and plausible results.  The real drawback is that it is fairly slow to run.  Because the wind vectors can split into neighboring locations and because a map based on Voronoi partitions is irregular, it can take thousands of time steps for wind to blow completely across a map with rough terrain.  At the moment, the wind model is the slowest step in the map generation.

No comments:

Post a Comment