Temperature, it’s a rather important measure of how hospitable a planet is for life. So, given that this is a terraforming game it’s pretty high on my list. But how to go about implementing it? Ultimately any object will have a steady temperature when the heat coming in is equal to heat going out. For most objects there’s a lot going in that statement. Thankfully (as a first approximation) planets are simple. The only way heat comes in is from the Sun. Heat only goes out by the planet’s black body radiation (also why the Sun glows). Both of these are fairly easy to calculate. So let’s do it, we know that the sun provides 1.361 kilowatts per square meter of heat to the earth. We also know that the Earth loses heat by the equation \(Q=\sigma T^4\). Solve this for temperature and there we have it. \(\sqrt[4]{\frac{Q}{\sigma}}= \sqrt[4]{\frac{1.361{kw} m^{-2}}{\sigma} \sigma}= T = 393.6 K = 248.8^oF\)
Not quite right is it. Although the Sun does provide that much heat it only provides that heat to the side of the Earth facing the Sun. Averaging over the surface of the Earth give a value of 1.361/4 = 0.340 kilowatts per square meter. Plugging this number in gives \(\sqrt[4]{\frac{0.340{kw} m^{-2}}{4 \sigma}}= T = 278.3 K = 41.2^oF\) A much more reasonable answer, although the actual number is closer to \(58.3^oF\). To get the temperature up those last 17°F we need to look at the greenhouse effect. Thankfully there’s a simple model for this, the idealized greenhouse model. Now the average temperature is given by \(T = \sqrt[4]{\frac{Q}{4 \sigma}} \sqrt[4] {\frac{1}{1-\frac{\epsilon}{2}}} \) . It turns out that \( \epsilon = 0.25\) finally gives us the right answer. Now what is \( \epsilon \) and how do we find it ? Basically, \( \epsilon \) is the factor of thermal radiation reflected by the atmosphere. Unfortunately there isn’t a nice equation, but we can cheat. We know that \( \epsilon \) is related to the amount of greenhouse gasses. We also know the temperatures and atmospheres of Earth, Venus, and Mars. Now we can construct an exponential relating \( \epsilon \) and atmospheric composition. This gives \( \epsilon = 1.92e^{-2.79{P_{GHG}}} \) where \(P_{GHG}\) is the partial pressure of greenhouse gasses in atm. Using these equations we find that to raise the Martian temperature to Earth levels the atmosphere needs to have 0.38 atm of greenhouse gasses. This is great and all but we can’t just assume that the entire planet is at the average temperature. It should be colder near the poles and warmer at the equator. To do this we can multiply the incoming flux by the cosine of latitude. Because planets are spherical the closer you get to the poles the lower the Sun is and less light hits the ground per area. At the poles the Sun is directly overhead so there is much more light per area. Now our equation looks like this: \(T = \sqrt[4]{\frac{Q Cos(\theta_{lat}) }{4 \sigma}} \sqrt[4] {\frac{1}{1-\frac{\epsilon}{2}}} \). But wait, if we just add a cosine that means the equator is only at the average temperature. So we need to stop averaging over latitude. Fortunately this is as simple as swapping out that 4 for a 3.4 (really mostly to get the equator temperature right. Game dev, not climate science!) \(T = \sqrt[4]{\frac{Q Cos(\theta_{lat}) }{3.4 \sigma}} \sqrt[4] {\frac{1}{1-\frac{\epsilon}{2}}} \). Now, for Earth, the average temperature on the equator becomes 80°F and the average temperature at the poles becomes 0 K or -459.67°F. Not quite right, this is because cosine goes to zero at the poles. In reality the poles get more light in the summer and no light in winter. A simple way to solve this is just to clamp latitude in our equation to ±66.5°. Why 66.5° ? Well the Earth’s axis is tilted at 23.5° so 90° - 23.5° = 66.5°. If we do this then the polar temperature becomes a nice -30.8°F. Now we finally have model for planetary temperature that takes solar flux, atmosphere, and latitude into account. This is clearly still very simple and doesn’t include things like altitude, weather, and oceans but it’s a good starting point.
1 Comment
I like games, I suspect most people do in one form or another. The best games are those that just pull me in and I can’t get out of my head. Then eventually I finish and maybe I play through it again but eventually it goes away. Probably a good thing too as these games destroy any productivity my free time has… Most recently this was Subnautica but other games (in no particular order) include the Sid Meier's Civilization series (starting with IV), Factorio (also has a fantastic dev blog), Heat Signature, Endless Sky, Endless Space, RimWorld, Fallout NV, Antichamber, Crusader Kings II, Clone Drone in the Danger Zone, Kerbal Space Program, Minecraft, and many others. Recently I added my first board game to this list, Terraforming Mars. I still don’t fully understand everything about it that grabbed me but it got a lot of ideas going. They eventually started settling into something resembling a new game. Making that game (and related game thoughts) is what this blog is about. So what will this game look like? Well, your goal will be to terraform a planet (Mars, maybe Venus ? climate disaster Earth?) but to do this you need to first build a small colony importing resources. Then start up some manufacturing/mining eventually building up a small civilization worth of infrastructure to support massive terraforming machines. I’d like the gameplay to be somewhere between Civ 5 and Factorio with a planetary model similar to how SimEarth worked. This isn’t a fully fleshed out idea by any means but it’s enough to get started. I figured Unity is a good place to start, I’ve already used it for a few other things and there’s plenty of help available. Next, I decided that hex maps look better than squares. There was just the minor problem that I had no idea how to do that. Squares are nice and easy to work with, just store things in an array and everything lines up. They don’t have hexagonal arrays. Thankfully there is an absolutely wonderful tutorial series for hex maps in Unity here. After finishing those this is what I have: Noting does anything yet, but I think this is enough for now. Next we can talk about planetary temperature models!
|
ArchivesCategories |