Monday, 8 October 2012

What's The Weather Like Outside?

As I was doing a test run on the module, I noticed it started to rain in the area. This was expected (as I had set it to rain), except that I felt it lacked the atmosphere I had hoped it would achieve. So I started to think about how I could improve on the basic rain settings and (thinking to save some time), I decided to check the Vault to see if anybody else had put together a weather system for NWN2.

After a quick search, I was pleased to find a few systems and briefly looked at each of them to see which would suit my needs. I found four systems that I may have been able to use, and thought the Abyssya Weather System seemed to be the best of the lot. However, once I looked at it more closely, I found a few bugs in the scripts and felt it was rather too cumbersome to implement easily. Don't get me wrong, I liked it and gave it a vote score of 7.00 (Very good. Deserves a look.) However, I hope the system I now offer to builders will be more useful from the point of view of being much easier to implement by being less cumbersome in code and more flexible in what it can do with just a little know how. You don't need to mess with the default settings, but if you have just a basic scripting knowledge, it offers a great deal of flexibility.

A stormy day at New Edgeton
The Althéa Weather System

After working out what I wanted the system to do, I managed to write the script as a single include file, called by one line from an area's ON CLIENT ENTER hook. From this call, the weather system is activated for the area in question, and the frequency of the weather checking can be modified from the default of every minute. A GLOBAL variable can be set at any time to change the weather to (currently) one of 12 weather conditions (if you include 0, which means SUNNY and no precipitation). Note, however, the system is flexible enough to allow a competent scriptor to add as many weather conditions as they want. Kamal even suggested a possibility of it raining frogs, which is possible with this system ... if you can design the "frog" VFX.

Furthermore, there are currently two area LOCAL variable settings available to allow the builder to set the weather for "desert" or "snow" regions, which limits the weather types to sun (no precipitation) and "downpour" (for the desert region) or "snow" instead of rain (for the snow region). Although, once again, a competent builder can alter their needs for an area and add it to the script easily enough. The system uses three types of snow: light, heavy and blizzard.

The system also manages seasonal changes. For instance, it is more likely to snow than rain in the winter months. The system also tries to keep weather directional flow as logical as possible. e.g. If it starts to rain lightly, it is more likely to continue to get worse before getting better, and vice-versa. The addition of "rain sounds" and "rain splashes", as well as the sound of distant thunder and nearby thunder claps (with lightning) all add to the immersive feel of the weather, adding atmosphere to any module that makes good use of it.

Note also that the script is very versatile and the VFX's used can all be altered if the builder prefers different settings. For example, the cloud effects (of which there is currently grey, dark grey and black) are all set to a height of 20 by default, which may be too low if you have many tall buildings in the area. It is easy enough to make these float higher, but bear in mind the higher you make them, the less the player will see on their display (unless looking upwards).

I will add this custom content to the pane on the left, under "My NWN2 Material", and for those who want a direct link to the Vault now, here is The Althéa Weather System. Below you can see a couple of video's as I was designing the system. The first shows how simple the weather can be changed, and the second shows the system with its clouds.

Recommendation: Switch to the HD video quality settings and allow buffer to fill before watching. Lower video settings you do not see the rain very well, or such things like the "splashes".



The Althéa Weather System - Showing Easy Switching


The Althéa Weather System - Showing Cloud Cover

6 comments:

Kamal said...

Does this do linked areas? ie make the weather the same between two areas that are both part of the same forest for example.

Lance Botelle (Bard of Althéa) said...

Hi Kamal,

Yes. Basically, the weather system always updates the same global variable ("CURRENTPOWER"), so as long as the area has the weather system call on it, it will always make the weather the same in every area - EVEN BETWEEN DIFFERENT MODULES OF A CAMPAIGN IN THEORY! :)

And of course, if you don't want the weather to be the same for the players when the go to a new area, you can always set that global variable yourself and then let the weather system take back control after that.

E.g. If you want the weather to be sunny when the players enter an area, make the On Area Enter script set this global variable to zero. i.e SetGlobalInt("CURRENTPOWER", 0); Then, the weather will start sunny, but as long as you have not set the global override variable ("SETWEATHER"), the weather system will continue to be random from the moment they enetered and found it sunny.

Does that make sense?

Cheers,
Lance.

Casa said...

Lovely work, I almost want to start building again with the inspiration I got from it... hmm... maybe I'll do.

Lance Botelle (Bard of Althéa) said...

Hi Casa,

Good to see you!

It would be great to have another fellow NWN builder around. :) Please be a regular follower and keep commenting, as I take feedback seriously and try to work with it as best I can, especially if they have experience, like yourself.

Lance.

Casa said...

Actually I thought I did already, but checking the link list on my blog I see I was wrong. Fixed. :)

Lance Botelle (Bard of Althéa) said...

Hi Casa,

I have also added you to my list of NWN2 bloggers so others can link to your site from mine.

Always good to get as much of a following as possible I think, especially as our numbers are dropping.

Lance.