Around The World, Part 9: Climate

Last time, I described how I’m generating different weather patterns based on the season. That data is already useful for the game, to decide the weather at one particular place and time, but it’s also essential when figuring out the local biome, which is what we’re doing today.

First: what do we need this for? Most importantly, the local climate is the main factor in deciding vegetation, i.e. what grows where. If it’s hot and humid, we get rainforest. If it’s cold and somewhat dry, we get taiga forests. And so on. This would make an interesting visual difference in the game, but could also affect the availability of trade goods.

Classification systems

The most popular way to classify climates is a scheme developed by Wladimir Köppen as far back as 1884, and enhanced almost a century later by Rudolf Geiger. It’s known as either the Köppen-Geiger or just Köppen classification. It divides climates into five main groups: tropical, arid, temperate, continental and polar. Within each group, there are several subgroups, for a total of 31 different classes. Each class is indicated by two or three letters, for example Cwb for temperate (C) with a dry winter (w) and a warm summer (b). There are a series of relatively straightforward rules to decide what class a climate belongs to, for example “if the coldest month is between 0 °C and 18 °C and at least one month is above 10 °C, assign class C”. Here’s the world according to Köppen:

Earth classified by Köppen-Geiger system
Source: Wikimedia Commons, CC-BY 4.0. See there for the legend.

Köppen designed the system based on his experience as a botanist, so his classification is based on the vegetation we encounter in each climate class. That aligns perfectly with my goals.

There are alternative classifications. For example, in 1966, Glenn Trewartha modified Köppen’s system to try and fix some of its shortcomings. Here’s the world according to Trewartha:

Earth classified by Trewartha system
Source: Wikimedia Commons, CC-BY-SA 4.0. See there for the legend.

It also has just 12 classes, compared to Köppen’s 31, but further subdivisions are possible. From what I can tell, the Köppen-Geiger system remains more widely used than Trewartha’s to this day, at least among folks doing procedural world generation. That’s my main reason for sticking with Köppen.

There’s also the Holdridge life zones system, which superficially looks like it should be easier to implement:

Holdridge system
Source: Wikimedia Commons, CC-BY-SA 2.5

However, I couldn’t quite follow how to use this diagram. What are the inputs, what are the outputs? If the three sides of the triangle are independently varying inputs, how can we get a 2D point, since the system is overconstrained? The text on Wikipedia doesn’t make it fully clear, and I couldn’t find a link to the original publication. So I decided to leave this system alone and proceed with Köppen.

Köppen classification

In the previous post, I mentioned how we can approximate the year-round weather based on the weather in January and July, by assuming that the parameters in between those extremes behave like a sine curve. That gives us enough information to apply even the trickier rules in Köppen’s system, such as “at least four months averaging above 10 °C”. A series of tedious if statements later, we have a result:

Köppen classification of a procedural world

To be honest, this is the result after I already tweaked some of the parameters. But is it good? Is it bad? Hard to say. I certainly see some good things, such as rainforest (dark blue) around the equator and oceanic climates (green) around the middle latitudes. But I also see an awful lot of cold desert (pink) where I’d expect continental climates. Is that because my climate code is wrong, or would a world with this topology actually have that much desert?

Since the only solid reference point we have is Earth itself, let’s skip part of the procedural generation, and take a height map of our actual planet as our starting point. It took some searching, but eventually I found discovered the unimaginatively named Earth2014 height model, which can be downloaded here as a raw array of 4320×2160 integers representing meters above sea level in big-endian signed 16-bit format. Astoundingly, the import code I hacked together worked on the first try:

My Köppen classification of Earth

We can now objectively compare this to the map I showed before:

Earth classified by Köppen-Geiger system

The most notable difference is across Asia. Indeed there’s supposed to be some pink, but not nearly this much. Continental climates (teal, pale blue) are entirely absent.

How bad is that? The coasts are where most of the gameplay will take place, and they show a pleasing diversity of roughly accurate climate zones. So I could just ignore this problem. But then… how would I sleep at night?