Sunday 27 July 2014

Weather

Got distracted by real life stuff for a while, the dev blog is a bit behind on current developments. On the other hand, the features are nice enough not to summarize in a few sentences, so here goes the first one, namely support for weather.


The weather was a bit of a puzzle to make. The basic idea is to make the world look brighter on a sunny day, and more grey on a clouded or rainy day.

The first requirement was of course the ability to lighten or darken the entire world view. It's like recolouring, but a) every pixel changes instead of only a few, and b) colours only get lighter or darker. The previous step of getting proper recolouring some months ago also solved the gradient shifting, so that was already available.

Interestingly, the more tricky part was deciding what weather should be displayed. In reality, weather "just happens". In a game, you have to program it. To program it, you need an algorithm to decide what weather should be displayed!

In the end I made a table for each month, how often each type of weather in that month occurs. Then by drawing a random number (uniform distribution over the sum of occurrences of all weather types), the 'new' weather is decided.

Immediately jumping to that new weather would be a bit weird however, you'd have sun one day, and thick rain the next. To make the transition more smooth, the change is done gradually in a few days.

The temperature is interpolated between the average temperatures of each month. This may be a bit too simplistic but it will do for now.


With the weather type and temperature decided, smoothly changing to new weather over a couple of days, and connecting the current weather to the gradient shifting, we have bright sunny days and dark cloudy days now as you can see in the pictures. Other effects of the weather still have to be programmed.

6 comments:

  1. I don't ride on rollercoaster 1 when it's raining. *g*

    ReplyDelete
    Replies
    1. Indeed, and perhaps our guests should also do that. They should all buy umbrellas instead! However, this is all "stuff to be programmed".

      Delete
  2. Are you using a single set of weather data? I'd really like to see weather based off location. A park in London would be colder and rain more often than Arizona.

    ReplyDelete
    Replies
    1. Currently it's a single set of weather data, just to have varying weather.

      Adding this data to a scenario would be useful I think. I am not sure whether you should allow users to add their own weather. A scenario for a park at the North pole, with 25-30 degrees on average day? :D

      Delete
    2. Yeah that would be a weird park, but it adds to the immersion and challenge of a scenario. To solve that, I'd have to tailor my shops for the cold and dry.

      Tying scenarios to weather would add to the immersion.

      Delete
  3. Yeah, weather is always difficult to add in any wip, but if you can pull it off, it has an overwhelmingly positive impact on the immersion and atmosphere. Good job man, keep up the good work. :)

    ReplyDelete