Jump to content
Sign in to follow this  
tortuosit

Dynamic weather script and addon: tort_DynamicWeather

Recommended Posts

NEW, REWRITTEN VERSION (SP/MOD only) - TORT_DYNAMICWEATHER2

Go here: http://forums.bistudio.com/showthread.php?193159-New-Dynamic-Weather-script-and-addon-V2-tort_DynamicWeather2

==============================================

Hi guys,

I used this script for my personal needs, maybe it is useful for someone.

The script/addon creates dynamic and semi random weather based on a random seed, is heavily configurable, has starting presets, weather trends and min/max values.

Standard behaviour is that script lets weather cycle between min and max values. But you can also pin the weather at a specific level with the "constant" trend.

Random weather outbreaks can occur depending on your settings.

- Presets are respecting min/max values.

- Generally, fog levels are more likely to be low.

- Semi-Randomness, it uses a random or user defined random seed (always logged to rpt): with the same seed number and arguments you will get the same weather progression.

Weather changes / trend changes are executed with no brute force, i.e. no abrupt changes and no cpu spikes (except at startup) will occur.

The script is derived from a script of forum user Meatball, credits to him.

SCRIPT USAGE:

Step 1)

Put the file script\tort_DynamicWeather.sqf on top level of your mission folder

- OR -

call it directly from my addon folder, examples below.

Step 2)

Call script from editor, e.g. from initialisation of player unit

- OR -

call script from other scripts.

Examples of script calls below in examples section.

ADDON USAGE:

a) Copy "@tort_DynamicWeather\" folder from inside the zip file into your Arma 3 directory.

b) Start @tort_DynamicWeather\CopyOrEditConfig.cmd in order to copy and/or edit the mods config file.

The mod searches for its config file here:

.\Steam\SteamApps\common\Arma 3\userconfig\tort_DynamicWeather\tort_DynamicWeather_config.hpp

Example calls:

** Initial weather, Trend, ProbRndChange, Variance, MinMaxValues, Debugmode, Seed **

0 = ["random", "better"] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";

Weather initially random and will definitely become better.

This is the call when the script resides in the "Arma 3\scripts\" folder.

0 = [[0.5, 0.3, 0.1, 0.8], "constant"] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";

User defined values instead preset. 0.5 overcast, 0.3 fog, 0.1 wind and 0.8 rain.

Weather will stay constant.

0 = ["bad", "pBetter", [0.1, 0], [0, 0.2], 0, [0, 1, 0.4, 0.8, 0, 1]] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";

Bad starting weather, probability to tend towards better. 10% probability of a

completely random change. We have a constant fog level of 0.4-0.8.

0 = ["foggy", "constant", [0.2, 0], [0.05, 0.2], [0, 1, 0.4, 0.8, 0, 1], 0, 0] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";

Foggy starting weather, 20% probability of a completely random change. Weather

will stay like this (+/- 0.05); - weather will then always return back to

starting weather in maximum 0.2 steps. Uses a random seed (default)

0 = [[0.35, 0, 0.2, 0], "constant", [0.1, 0], [0.1, 0.25], [0, 0.7, 0, 0.5, 0, 0.6], 200, 1337] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";

Nice Altis weather with a light chance of not overly extreme breakouts. Debug level n with [n>10] will output <n> weather calculations to rpt, so here it will output 200 calculations. Randomization based on random seed number 1337.

ARGUMENTS:

initial            "clear"|"sunny"|"cloudy"|"foggy"|"bad"|"random"|"rndGood"|"rndBad"
                  Alternative: [0.2, 0.5, 0.4] (order: overcast,fog,wind) Negative values randomize, -0.6 means "random 0.6".
trend,             ("constant"|"worse"|"pWorse"|"better"|"pBetter"|"freeCycle"|"random"|"oscillate")
                   Weather trends towards this direction.
                   "pWorse"/"pBetter" have a 2/3 chance to trend towards their direction
                   "better"/"worse" trend to their direction in any case
                   "constant" keeps the weather as applied initially and in case of
                    random breakouts, weather slowly returns to constant level.
                   "oscillate": weather always oscillates between extreme values
probRndChange[]    [a,b] Probability of a random change per cycle.
                   [0.2, 0.1] means:
                   20% chance of next weather being random, respecting minMax[] values.
                   If a random event happens, then in 10% it does not respect
                   minMax[] values, but chooses values in the whole weather range.
variation[]        [min, max] Example: [0.05, 0.2] If weather trend leads somewhere,
                   a change per cycle is at least 0.05, at max 0.2.
                   If trend is "constant": 0.2 is the max change per cycle, to return to
                   constant level. +/-0.05 is the max variance around constant level then.
                   - No effect if you choose "random" trend.
minMax[]           [minOvercast, maxOvercast, minFog, maxFog, minWind, maxWind]
                   Here you can define the minimum and maximum values in which
                   overcast, fog and wind have to be.
debugMode         (0,1,2,3,n) 0 = no messages, 1 = show hints, 2 = change weather every few seconds and
                   show hints, so you can observe what happens. 3 = write 100 calculations to rpt, n>10 = write n calcs to rpt.
randomSeed         seed number (1 - 999999) / 0=script chooses a random seed number
delaySeconds         script delayed execution in seconds || neg.values: smooth transition to initial weather

SCREENSHOTS:

2014-08-29_00002visal.jpg 2014-08-29_0000398shm.jpg 2014-08-29_00007vfs94.jpg2014-08-29_00004tcsth.jpg 2014-08-29_00005c8sk2.jpg 2014-08-28_00002n2sjg.jpg 2014-08-26_000011zsmw.jpg

CHANGES:

[1.3.3] Fix: "freeCycle" trend (did not cycle at all)

[1.3.1]setovercast problem workaround, oscillate trend fix, island template improvement. more...

[1.2.7] Script version: random events can be defined more precisely now. [more...]

[1.2.6] Minor bug fixes

[1.2.5] Some slight preset changes; added internal control of rain

[1.2.4] Support menu: refinements, added templates, fixed bugs

[1.2] Changes to support menu (0-8). [more...]

[1.1.9] Wind workaround due to ArmA bug (http://feedback.arma3.com/view.php?id=19024)

[1.1.8] 0-8 menu fixes and additions

[1.1.7] You can delay the script execution two ways, interesting for coexistence with missions which set initial weather. [more...]

[1.1.6] Mod version: Added support menu UI interaction, press 0-8. [more...]

[1.1.5] Added two initial weather presets, added possibility for randomness in initial weather array. [more...]

[1.1.4] Bug fixes, added new trend "oscillate" - weather always oscillates between extreme values. probRndChange and minMax still apply.

[1.1.3.6] MULTIPLAYER... No hint if debug=0; multi instance check

[1.1.3.5] Initial weather values and "constant" trend have precedence over to minimum/maximum value array.

[1.1.3.4] Addon: initial setting in userconfig file now supports both, preset name and weather array.

[1.1.3.3b] Fixed a bug that made script/addon restart after one cycle.

[1.1.3.3] Bugs fixed, better logging to rpt

[1.1.3.2] Changed argument order, script users please change args order (debug=forelast, see arguments section above). Fixed PRNG flaw. Fixed rpt. Seed always to rpt

[1.1.3] Added a Debug mode 3: does not apply weather, but writes 100 calculations to .rpt file (see %userprofile%\AppData\Local\Arma 3\) and then quits.

[1.1.2] 20141620 Bug fixes, additional option for random event probrndchange,PRNG changed, added a preset script, mission makers can check if script/mod is running by "if (tort_dynamicweather)"

[1.1.1] 20140615 Bug fixes. Uses own random number generator and a random seed. With the same seed, you get the same random weather.

[1.0.9.3] 20140615 Bug fix release

[1.0.9.2] 20140615 Bug fixing. pbo version: please replace your user config file with the new one. Array of init values for _preset now possible as in script version.

[1.0.9.1] 20140614 Internal _turbulence variable (values 1-5) splits cycles to 30/_turbulence minutes.

[1.0.9] 20140614 Less supressing of fog on random changes. Debug level 2 improved.

[1.0.8] 20140612 (Ground) Fog tuning. Less probability at daytime. pbo version.

[1.0.7] 20140611 Ground fog

[1.0.6] 20140610 Higher chance of fog between 4 and 7 AM. Fixed hint.

[1.0.5] 20140610 Reorganized arguments, solved problems with variable scope and

abrupt fog change. Rain again more under ArmA control.

[1.0.4] 20140608 If Trend == "constant", maxVari controls the speed at which

weather returns to init, after a random event. minVari=range around constant

[1.0.3] 20140608 Some slight rain handling. Debug values = 0,1,2

If you notice a hole above the player:

It's ArmA. The higher your cloud settings, the smaller the hole.

DOWNLOAD:

v1.3.3: https://www.dropbox.com/s/cazvj59fkhu1zgo/%40tort_DynamicWeather_1.3.3.7z?dl=0

v1.3.1: https://www.dropbox.com/s/922sic2nip5njf0/%40tort_DynamicWeather_1.3.1.7z?dl=0

v1.3: https://www.dropbox.com/s/9zdf06lxap5eipl/%40tort_DynamicWeather_1.3.7z?dl=0

VERSION 1.3 onwards needs "Steam\SteamApps\common\Arma 3\userconfig\tort_DynamicWeather\tort_islands.sqf" in order to work.

v1.2.7:https://www.dropbox.com/s/jg9ye1vo9hmnbaa/%40tort_DynamicWeather_1.2.7.7z?dl=0

v1.2.6: https://www.dropbox.com/s/d79i84wb8rr6rxx/%40tort_DynamicWeather_1.2.6.7z?dl=0

v1.2.5: http://www8.zippyshare.com/v/64168983/file.html

Mirrors

Armaholic

withSIX

Arma3.de

Mod version 1.x will be discontinued!

Edited by tortuosit
  • Like 2

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest
updated to latest version

Share this post


Link to post
Share on other sites

Thank you for sharing this,

Im trying to have light to medium fog come and go in the quickest/smoothest cycle possible without the abrupt change (i guess thats 20mins?) with constant maximum cloud but without rain, so im calling like this:

0 = ["foggy", "constant", 0.5, 0.5, 0.1, 0.4, 0, 1, 0.1, 0.1, 0.2, "false"] execVM "tort_DynamicWeather.sqf";

Do these arguements here:

min change per cycle,   [0-1]
max change per cycle,   [0-1]

Change just the fog min/max or the weather in general?

Share this post


Link to post
Share on other sites

Sorry for the late reply.

0 = ["foggy", "constant", 0.5, 0.5, 0.1, 0.4, 0, 1, 0.1, 0.1, 0.2, "false"] execVM "tort_DynamicWeather.sqf";

All weather, the initial and the followup, will respect the minimum/maximum borders (marked in red). I.e., the preset will be adjusted by min/max borders.

Yes, 20 minutes per cycle.

What you chose means:

- "foggy" preset as the starting weather.

- Overcast always at 0.5

- Fog between 0.1 and 0.4

- Wind between 0 and 1

- minimum and maximum (i.e., change will be exactly...) change per 20 minutes: 0.1

- Probability of a complete random next weather cycle: 20% (weather will return softly to what is defined as initial weather, because of "constant" trend)

I think it's impossible to achieve "no rain" at full overcast, the ArmA weather engine will likely start the rain independent from if you do setrain 0 or not. Not sure here. Thats why I have no min/max rain arguments.

Maybe you may want this:

0 = [[0.5, 0, 0.2, 0.5], "freeCycle", 0.45, 0.55, 0.1, 0.4, 0, 1, 0.05, 0.1, 0.2, "false"] execVM "tort_DynamicWeather.sqf";

BTW, I have not yet tested the script with useless or conflicting values, also I do not plan to make checks for useless values.

min change per cycle, [0-1]

max change per cycle, [0-1]

Change just the fog min/max or the weather in general?

In general. Lets say it is ... 0.1, 0.2.... It means: Overcast/Fog/Wind will change at least +/- 0.1 per cycle, at max +/- 0.2. Each gets an own value. It is possible that fog gets +.0142, but overcast -0.19. The probabilty of them trending to the same direction is bigger, depending on the chosen trend.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Thanks for getting back and thanks for that extra rundown, I'm getting how it all works now and will mess around with those values.

Share this post


Link to post
Share on other sites

Updated. Fixed some errors and, sorry and beware, changed the argument types and orders.

I removed some internal rain handling because I found if I do it, it has to be managed completely. Example: A problem appeared, if overcast trended from low levels towards high levels AND if script already has set whatever rain level > 0, the rain started at some overcast level around 0.5, 0.6.

But overcast at that level in ArmA world can be, some thicker clouds at the horizon, but no clouds on top of player. Rain is not very good then.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Ah right, the rain with no clouds trick! Thanks for the update, look forward to messn with the arguments.

Share this post


Link to post
Share on other sites

Yeah, I want to change things according to that fixed times of changes you wrote about. That weather application at :30 and :00 - is that ingame time? I am not sure because I guess this is coming from the MP department.

I'm not sure yet if I want to handle rain myself, or just leave it to the ArmA engine. I feel it requires some organisation, some more flexibility than those currently monolithic weather cycles I use, and also may be heavily influenced by what ArmAs weather engine thinks is right...

Share this post


Link to post
Share on other sites

Ground Fog!

If there's fog, now there can be that nice fog which only is in the valleys. Fog layout is random and changed every new cycle. I think the formula I chose for the setfog array works pretty well. Because with wrong values you can achieve easily, that nothing can be seen, not even your own weapon.

You can leave it as it is, but ground fog can be configured inside the script. I don't want to expose as arguments, because command line gets too complicated.

The other rules still apply: better chance of fog in the morning, high chance of zero fog at daytime (I have Altis map in mind, it's a Greek island after all).

2014-06-11_00003jws2m.jpg

2014-06-11_00004pns4e.jpg

2014-06-11_00001z3sfx.jpg

2014-06-11_00002lzsor.jpg

Edited by tortuosit

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest
updated to latest

Share this post


Link to post
Share on other sites

Version 1.08:

Ground fog

...turned out to be nasty, I've tuned it. Also, it's now more likely at dusk and unlikely the other times. Fog overall is very unlikely at daytime (except, of course, if you force fog via min/max values). Fog is heavily WIP. I'm also under the impression that ground fog behaves different on Stratis than on Altis. On Stratis there were much lower fog altitude levels, but I need to test it more.

Changed weather trends a bit: Fog has a good probability to decrease even in the "worse" trend. Also it has good chances to fall to it's minimum level. Because otherwise it would stupidly trend against 1 and you won't see much most of the time.

Addon included: @tort_DynamicWeather!

I distribute an addon version with it. You find the script in the addon folder. The addon is not yet ready for promoting it in the "addons and mods" forum.

- Load the addon as you are used to

- copy or move the userconfig folder to the ArmA 3 directory, so that you have: "..\Arma 3\Userconfig\tort_DynamicWeather\.."

You must be clear that if a mission or another addons set fog/overcast or wind, they may win over the addon at some moments, and the addon on the other hand will strike back. So unexpected behaviour possible. I'm still in doubt if a weather addon is useful, but hey, it's for teh lulz.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Hey tortuosit, I haven't had a chance to mess with the latest version, will we still be able to use arguments on the mod version?

Good luck with the fog, it would be nice to still have the ability to force it with min/max and have it come go all hours, more for effect rather than realistic weather.

Share this post


Link to post
Share on other sites

Yes, all arguments are in the config file, which you have to place as described above. Have a look into the config file. One exception: currently you cannot use an Array for the preset, you have to use the strings ("good", "bad" etc.) - I want to also have the array possibility in the mod version, but not yet know how to handle the different data types (string/array) when loading them from the userconfig file.

You mention "effect". Currently fog is rather an unlikely story. Maybe I shouldn't supress its probability and amount too much when random weather comes into play.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Ok i love userconfigs, as for 'Effect' i was imagining random weather with random fog but its no biggie, i just currently have a fog fetish lol.

On a side note theres a nice effect when the weather does change in that the lighting seems to change and give the effect off clouds maybe clearing, i dont mean when looking up at the sky but when looking at the terrain, hard to explain but looks cool, would be cool if it was somehow intensified and faded out again to give the feeling of the sun breaking through, just rambling man, i know thats not in scope with your script/mod.

Share this post


Link to post
Share on other sites

As of now, I'm just aware if setRain, setOvercast and setFog as weather modifiers whose results you can see. Only setfog has some more options, I think what you describe cannot be controlled.

There are some very nice weather effects indeed, which are dependent on the engine and time of the day.

Share this post


Link to post
Share on other sites

New mod v1.8 available at withSIX. Download now by clicking:

@tort_dynamicweather.png

@ tortuosit;

Soon you will be able to manage the promo pages of your content on our web platform and publish new content yourself.

To do so, please hit 'this is me' button on the page while logged in and you will get connected to your work.

For now you can send new content or releases our way through withsix.wetransfer.com or add your notification at getsatisfaction.withsix.com.

Share this post


Link to post
Share on other sites

I've tested the cloud building in ArmA and as zapad pointed out, setovercast command is only actively executed at :00 and :30 ingame time. And it takes a full hour from clear sky to full overcast (or even more!). So my plans are: a) making the script respect the ArmA cloud cycles in a decent way b) making the cloud cycles independent from fog/wind (their commands apply immediately) and c) adding some skiptime into the debug mode 2 so that we can see better how weather progresses with the chosen values.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Version 1.0.9: I changed the debug mode 2. It skips time pretty quickly so that you can test your weather settings. Also fog is not as supressed as before, when a random change occurs.

Edited by tortuosit

Share this post


Link to post
Share on other sites

New mod or update v1.0.9 available at withSIX. Download now by clicking:

@tort_dynamicweather.png

@ tortuosit;

I also updated the versioning :)

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest
updated to latest!

Share this post


Link to post
Share on other sites

Thanks for all the updates man, i havent downloaded the latest yet as I write this but testing the mission is a bit of fun in the beginning, ya never know what you might get, I was thinking it would be nice to somehow capture the setting and somehow apply it or keep it as a kind off permanent weather setting as sometimes the weather looks awesome,.

Skip time good it can be like watching paint dry otherwise :)

Share this post


Link to post
Share on other sites

Hmm, maybe you want a way to exit the script, but then you cannot return... I think I don't want to do UI interaction, this is beyond my Arma scripting knowledge, also other problems may appear. I think you need to use debug 1 and keep values in mind...

I made changes again. I've added an internal turbulence variable which is 1,2,3 or 4. Likely to be higher when overcast is higher. It is recalculated every 30 minutes. It splits a 30 minutes cycle in 30/turbulence pieces and applies fog and wind in that smaller time cycles, but also softer. I've adjusted the skiptimes in debug level 2 accordingly.

There can be a lot of randomness, best is you observe the behaviour with the debug level 2. Also keep in mind, you can speed up simulation in ArmA to 2x/4x.

Share this post


Link to post
Share on other sites

Tbh I'm really happy with how it is just using the presets :)

Share this post


Link to post
Share on other sites

New version. As for pbo version, replace or change your userconfig file.

- Array values in userconfig file did not work at all, fixed bugs

- Now array with user defined values (instead of preset name) is also possible in pbo version

- added a cmd batch file for conveniently copying (or if it's there, editing) the userconfig file. Click it!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×