Sunday, December 14, 2014

Time, weather, and geography on the island

I implemented time, some seasonal weather, and a small bit of geology this week.


Time and seasons. Time on the island is pretty straightforward. One turn equals one minute. 1440 minutes in a day, one day per season, and 12 seasons a year for a total of 17,280 turns per year.

One thing I haven't decided is how to implement night time. I could slowly redden and darken the tiles as the sun sets, shrink the view distance, or maybe do something else. Any ideas?


Climate and weather. Most weather on the island is a mix of calculations and simulation. Idealized temperature, cloudiness, and precipitation is calculated by adding sine waves for seasonal variation.

Sine waves added together.

Throw in a bit of randomness and minor feedback from the island height map and you get some interesting things. For example, the ideal temperature is the sum of a daily cycle, yearly cycle, and a short, medium, and long term cycle. The real temperature also includes elevation, cloud cover, and the previous temperature. Current precipitation is affected by random seasonal variation, local geography, temperature, and where the clouds currently are.

This is all simulated at the map level, which is now a 60x60 grid, and rain and snow are animated on the screen when walking around.
Elevation view of an island.

Precipitation view of an island.

I implemented an auto-turn feature too. It's pretty neat to go the map and watch time go by at about 10 to 15 minutes per second. You can see clouds form and move and drop rain and dissipate. Cold rainy winters, brief dry spells, and warm summer days. It's always neat to try tweaking a variable or interaction and watch it actually work.

Walking through the hills during the most extreme downpour I saw.
I'll skip the implementation details but share some funny bugs from when I was trying different ideas:

  • I tried making the temperature, clouds, and precipitation flow like in a fluid simulator. Nothing fancy, just a super simplified Navier Stokes thing that never quite worked. The island was soon covered in a freezing uniform cloud that was always snowing. Except the tops of the highest mountains, they were a comfortable temperature.
  • I tried implementing clouds as particles that would be deflected by high elevations. The first attempt caused them to bounce off mountains like beach balls and scatter everywhere. I was able to tweak it so that didn't happen and added wind that would nudge them back to their original direction but it wasn't very interesting.
  • I tried making temperature affect cloud formation and have clouds affect temperature. I soon had areas with 2000000% cloudiness and over 1000 degree heat.


Geology. The land generation has been tweaked quite a bit. Also, there's a few different types of land that are somewhat determined by climate. No lakes or rivers yet though.

A transition between dirt to the southwest and grass to the northeast. The grassy area probably gets more rainfall.



Thinking of all the different ways to model weather has ben fun despite all the dead ends I ran into but I'm really looking to this upcoming week and adding some randomized plant life.

3 comments:

  1. awesome :D I mean.. awesome! I hope you would like to share codes on github and versioning it, so anyone could in the future follow your progresses.
    anyway.. are you sure about your "simulation limit" ? In few words: do you want to replicate dwarf fortress?

    ReplyDelete
    Replies
    1. Thanks Marte! It will probably be a few more weeks until there's anything to do other than walk around, but I'm pretty happy with it so far.
      I'm using a local git repository that I might open source later.
      I don't know if it will become as complex as Dwarf Fortress or not but I do want to have other people and small towns eventually.

      Delete
    2. I'm trillied about this experiment and as always I'm going to follow you, share ideas and thought :D

      Delete