12/11/2016 in devlog
It lives! In a game about production, transport and trade, things have actually been produced this week! Meanwhile, yet another part of our planet generation code fell into place.
Believe it or not, I actually worked on PU this week! In fact, I was quite productive, both literally as well as in game. Puns aside: As you might have guessed, my work this week revolved all around production, arguably one of the fundamental systems of the game. Because it was one of the first things to get built, the majority of this system has existed in our server-side code for almost as long as the game itself. But due to our focus on infrastructure and the massive UI changes we've been dealing with recently, the production features lay dormant for many months. Now that work on most of these low-level things is finally coming to an end, progress on actual gameplay is picking up speed again. I was able to add all the essential interface components this week so you can now place production orders again and watch your inventory fill up with merchandize!
To make things even better, I was able to integrate the latest version of Michi's work on planet generation into my code. This means that the exploitation of natural resources already uses the data from our world editor. It feels good to see things coming together eventually!
Martin and I met at simulogics HQ this week to discuss some issues regarding our other browser game AirlineSim and some organizational things that concern Prosperous Universe development. So there was not too much time left to get my hands dirty writing code but I still managed to get another of the planetary attributes implemented!
The surface temperature of a planet is one of the bigger factors in whether a planet can sustain life or not. By that I don't necessarily mean that life could have evolved there but more that human life is possible even if that means to use technological aids. So let's have a look at our own solar system again to get a feel how the temperatures can vary. Mercury and Venus are pretty close to the sun and have very high mean temperatures (167 and 464°C). Then earth and the moon follow with temperatures around 15°C and Mars has around -65°C. The big gas planets have mean temperatures that start at -110 and go well down to a freezing -200°C on Neptune.
The biggest influence on the temperature is of course the distance to the sun. The heat radiated from the sun decreases by the square of the distance. To implement this in the planet generation this is a good starting point for creating a rule. But how much energy reaches a planet in our solar system and what about other systems with larger or smaller suns? My research lead me to a concept that is called Planet Equilibrium Temperature. The concept includes a formula that describes the connection between the luminosity of the sun, the planet's distance to the sun, its albedo value and of course the planet's temperature. This was just what I was looking for.
To test the formula I put in all the parameters of the planets in our solar system and checked if the calculated temperature is equal to one we know. It turns out that the calculated value for earth is around -17°C, a bit off the 15°C we found out earlier. The reason for this is the earth's atmosphere. It acts as a greenhouse and heats up the planet. The same is true for Venus, its atmosphere is a gigantic greenhouse. For Prosperous Universe I didn't want to dive into the depths of greenhouse gases and atmospheric dynamics. Instead I reused a parameter that we generated earlier, the atmosphere density, and created a simple linear equation that would raise or lower the temperature depending on that value. This did the trick and leads to interesting and somewhat coherent mean temperatures.