One of the benefits of the way I’ve implemented the entity logic in Elium is that the skybox now gets it’s parameters from an XML file, rather than having them set by a script. This has greatly simplified the skybox code (because it’s not a “pull” model of building up the parameters, but rather it’s a “push” model). But the other benefit is that it’s allowed for a relatively simple “weather system” implementation.
Basically, the parameters of the skybox include things like cloud colour, amount of clouds, sky colour, sun position and so on. The format of the file is basically just a listing of times-of-the-day and the value of these parameters at that particular time. The code simply interpolates between the times for the actual values to use.
So today I extended that model slightly so that we can set the particular weather effect you want to see. You can see an example of “fine” and “stormy” weather in the screen shots below.
The actual parameters I’ve used here will obviously need to be tweaked (I only fiddled with them a little bit…) but the idea is there.
Also, one big problem which you can probably notice in those screenshots is that the ocean doesn’t change colour. Even when the sky is gray and gloomy, the ocean is a nice bright blue! That’s something that I’ll need to fix up, since it looks really out of place.
One of the cool things is, when you change you the weather, it fades from the current weather to the new one over a period of time. I basically extended the interpolation code so that it gets the current weather and the “new” weather and then blends smoothly between the two. It actually looks pretty realistic when you see the clouds gathering before the storm…