Jump to content
tortuosit

[New] Dynamic Weather script and addon, V2: @tort_DynamicWeather2

Recommended Posts

2018-08-25: This mod is now obsolete. Tort_DynamicWeather3 mod exists, go to https://forums.bohemia.net/forums/topic/218994-dynamic-weather-3-by-tortuosit/

 

 

2018-08-08: tort_dynamicweather3 as script only, with no addon dependency see this posting.

 

2018-04-09: Development is at least paused

I rewrote my old script/mod because basically wind/rain/fog/overcast were not independent. In this rewrite, they are own threads. I'm not progressing too well due to no time and I feel somewhat uncomfortable at some points... about how I wrote it... time will tell. Its WIP and quite early, but works. I'm currently not thinking about MP, this may change. It's done with using from missions/scripting (call via execvm) in mind, but not yet documented and tested. All code open, pbo is just a loader. Usually you can change settings/code and restart mission for changes to apply.

Dynamic weather 2 WIP, Version 0.9.8.8

- WIP
- SP ONLY
- MOD usage only (external script calls not yet documented and tested)

DOWNLOAD

0.9.8.8 https://www.dropbox.com/s/zysgc9q3wa7x0cl/%40tort_DynamicWeather2_0.9.8.8.7z?dl=1

0.9.8.6b https://www.dropbox.com/s/0qw00fx1zc1ymtt/%40tort_DynamicWeather2_0.9.8.6b.zip?dl=0

0.9.8.5 https://www.dropbox.com/s/xs6n01ie1krl4t9/%40tort_DynamicWeather2_0.9.8.5.zip?dl=0

0.9.8.4 https://www.dropbox.com/s/915qmle1vjl06u0/%40tort_DynamicWeather2_0.9.8.4.7z?dl=0

0.9.8.3 https://www.dropbox.com/s/nxw57bodb7dhson/%40tort_DynamicWeather2_0.9.8.3.7z?dl=0 (changelog)
0.9.8: https://www.dropbox.com/s/7gxilgnx6ujmrjg/%40tort_DynamicWeather2_0.9.8.zip?dl=0

0.9.7: https://www.dropbox.com/s/i2sjx88jprses71/%40tort_DynamicWeather2_Version_0.9.7.7z?dl=0

Archive has a (not 100% accurate) readme.txt

INSTALLATION
- Copy the directory to [arma3dir]\@tort_DynamicWeather2\ (do not rename! It will not work!)
- Load mod as you are used to.

- [EDIT] Dev version and future ArmA stable: Add "-filePatching" argument to the ArmA command line call (otherwise it will not appear in map). deprecated since 0.9.8.5
- Thats it, no use of [arma3]\userconfig\

If mod is loaded successfully, you will find my mods machine room in the map view:
2015-07-02_00001nysbj.jpg

USAGE
- Open map ingame, you find all presets and settings there. (support menu from v1 works, but is somewhat obsolete)
- Find settings and templates in @tort_DynamicWeather2\script\config\

How to COEXIST WITH ACE3?
It interferes with ACE3. In an SP environment you can still use all functionality of ACE - most important: bullet ballistics etc., but you have to turn off ACEs weather handling, otherwise my mod will not do its job. And in that case ACE would calculate ballistics based on its internal variables, no matter what storm you set via my mod.
How? ACE is tricky here. You need to create an ACE serverconfig.hpp as I described here -it goes to userconfig\ace\ - and you load it by adding ace_server to ACEs "addons" dir. This is the best way to fine tune ACE, learn it. You do it only once.

Those are the important settings in ACEs serverconfig.hpp:

 

class ace_weather_enableServerController {
value = 0;
typeName = "BOOL";
force = 1;
};
class ace_weather_useACEWeather {
value = 0;
typeName = "BOOL";
force = 1;
};
class ace_weather_syncRain {
value = 0;
typeName = "BOOL";
force = 1;
};
class ace_weather_syncWind {
value = 0;
typeName = "BOOL";
force = 1;
};
class ace_weather_syncMisc {
value = 0;
typeName = "BOOL";
force = 1;
};



Control of weather also via global variables. Description:

GLOBAL VARIABLE NAMES:

tort_
overcast_
fog_
wind_speed_
wind_dir_
rain_
amount - current target value
min - minimum amount
max - maximimum amount
weighting - tendency of movement direction
turbulence - rapidness/amount of changes
now - if you create this variable, this aspect of weather will be applied instantly (in less than 5 seconds)
tort_rain_threshold - it can only start to rain if overcast is >= threshold.

VARIABLE RANGES:

overcast|fog|rain: [0..1] (ArmA range)
wind_speed: [0..13] (Beaufort scale)
wind_dir: [0..360] (Azimuth in degrees)

weighting: [-1..1]
turbulence: [0..1]
rain_threshold [0..1]

Example:
- "tort_overcast_now = 0.85" - 0.85 overcast will be applied instantly.
- "tort_overcast_min = 0; tort_overcast_max = 0.5;" - weather will start to move slowly into that range and then stay inside it.
- "tort_winddir_min = 340; tort_winddir_max = 20;" - wind will always come from north.
- "tort_rain_weighting = -0.5" - at every next forecast, there's a 75% chance that rain will decrease (25% chance of increase)

  • Like 4

Share this post


Link to post
Share on other sites

You are right with "The Dynamic weather addon is no longer maintained" (the old version). Will answer questions etc., but I don't use it personally any more, so not much happens there. And also for this I must admit, RL is heavy this year. I do what I can.

OK, in this mod, I think I was pretty conservative with fog. I linearly limited it depending on time of day. Fog gives me headaches because I don't want to destroy other peoples gaming :). If I find some more time, I need to look for calculations on fog. If it stays SP, maybe based on elevation of the player.

Edited by tortuosit

Share this post


Link to post
Share on other sites

just noticed controls menu on map screen, awesome! ty for this great mod

Share this post


Link to post
Share on other sites

Yes and I just realized I distributed the mod with support menu = off. But hey, get used to the control via map entry, because I am no longer maintaining the support menu (not using it myself any more).

---------- Post added at 12:46 ---------- Previous post was at 12:36 ----------

Overcast progresses very slow, i.e. after all it can't be too dynamic. It is simply not doable with ArmA engine. Quick cloud change can only be achieved by abrupt apply which mean a harsh FPS drop for ~1 second. I don't do that.

But I also found my maths are wrong here, I made a mistake. With the granular approach (very small changes in a small time frame) and weighting = 0 on average there wouldn't be any change at all, I have to make a change in the overcast department. Will do next.

Share this post


Link to post
Share on other sites

Mod is currently defunct, at least with ArmA 3 1.52 on dev branch.

EDIT: It sucks and is not easy, more debugging required, but no time for ArmA atm. In general, a lot of things are not executed in my mod.

Share this post


Link to post
Share on other sites

There's a new security mechanism in dev branch, which affects my mod. Seems like I have to restructure code. Until I know more exactly what I have to do:

 

Add "-filePatching" argument to the ArmA command line call.

  • Like 1

Share this post


Link to post
Share on other sites

Is this supported on Dedicated Servers where we would play alone?   ALiVE Missions for example?

 

Also if it is, would it work for AI as well?  Like if Fog is present, would AI be affected by it?  Or will weather be out of sync?

Share this post


Link to post
Share on other sites

Just found this thread (been following the old - LOL) and I just wanted to say that I love your work, can't play without it!

Thanks for making and sharing it tortuosit.

 

/KC

 

Share this post


Link to post
Share on other sites

Thx KeyCat for your kind words. I must say unfortunately cannot spend as much time one it as I wish, I had quite some ideas... What also prevents me in a way... "Dynamic" is not really dynamic when it comes to clouds, because things go slow in ArmA. After all, I find myself using the mod rather for setting some specific weather, which not necessarily has to change afterwards. Also, typical ArmA missions are rather short for me.

 

As for the scope of this mod, I am not interested in "real weather" kind of thing, I know some people want this. Like weather depending on map and season. It's a bit out of my interest and scope - at least currently.

 

Is this supported on Dedicated Servers where we would play alone?   ALiVE Missions for example?

 

Also if it is, would it work for AI as well?  Like if Fog is present, would AI be affected by it?  Or will weather be out of sync?

 

Jcae I'm sorry I reply late. Have overlooked it and have to sort out my thread notifications...

I am not supporting MP with this mod, could be easy, but cannot afford time atm. I have no idea about dedi servers to be honest.

Fog is normal ArmA fog, i.e. yes, AI is affected by it.

Share this post


Link to post
Share on other sites

Understand that you mostly play SP but would be awesome to have something like this in any co-op mission. If you ever get the time and motivation Code34 made a script that you can take a peek on (maybe you already are aware of it and I'm sure there are other scripts floating around).

 

  https://forums.bistudio.com/topic/159002-real-weather-dynamic-weather-for-mp-games/

 

/KC

Share this post


Link to post
Share on other sites

Thanks for the reply.

 

Yea at the moment i am using real weather.  It works great, but this mod offers a lot more randomness of course  :)

 

Either way i appreciate this mod when i play SP, and if you do find the time, i am sure many would love it on Coop/MP.  I also usually play by myself, but i run a DED because of ALiVE mod.

Share this post


Link to post
Share on other sites

Just a remark on MP compatibility: When this script is only called at the server (if(!isserver) exitwtih {};) it should work splendid on dedicated server (because that is how weather in MP works).

Has to be tested of course ;)

Share this post


Link to post
Share on other sites

I don't even know what a dedicated server exactly means in Armasphere.

My mod is controlled mainly by the map views entry.

 

Is it possible it runs server side and someone controls it (as he controls things with Zeus) - and all actions on server, lets say mod does "20 setfog [0.1, 0.01, 0] are being distributed to clients? Plus, the clients don't have to run the mod? Would be nice this way.

Share this post


Link to post
Share on other sites

I don't even know what a dedicated server exactly means in Armasphere.

My mod is controlled mainly by the map views entry.

 

Is it possible it runs server side and someone controls it (as he controls things with Zeus) - and all actions on server, lets say mod does "20 setfog [0.1, 0.01, 0] are being distributed to clients? Plus, the clients don't have to run the mod? Would be nice this way.

 

The map controls won't work in the dedicated server, but every "setfog" or "setovercast" command executed by a script on the server will be automatically synchronised to all clients.

When you want the map control to send the commands to the server, you have to wrap them in a remoteExec, for example:

[some,parammeters,and,stuff] remoteExec ["my_fnc_changeWeather", 2]; 

Will call the my_fnc_changeWeather function on the server which then can change the weather, for example.

Share this post


Link to post
Share on other sites

Thx Neo. This mod currently has no 100% proper command line interface yet - focus was on usability via UI.

 

 

I use spawn[]/execvm[] which call loops for every weather aspect. If I detect a server, I think that does not change?

 

Map control basically alters global variables. Because the disadvantages of scope problems and checking for existence/destroying variables/isnil things were too big (time consuming debugging) for me. Is that a problem in such a client/server infrastructure? Who can change the variables there?

To me it feels like someone on server must have the possibility to click appropriate weather, then submit it to clients?

Also I am thinking about fog dependent on player position (things like 0 setfog [0.2, 0.2, ((getPosASL player) select 2)];) but this will be only useful in SP. "The fog of death follows you" ;-)

 

Will come up with a new version soon, some changes to fog calculation and also exposed negative "turbulence" values to every aspect. In my logic, if something cannot have negative values, I use the absolute value, but enforce some aspect.

I will describe the two attributes which range from [-1..1]:

 

"Weighting": Example: FOG - Negative values = higher probability to less fog, positive values: probability of increasing fog. 0 means 50/50. -1 / 1 means fogwill go straight to this direction.

"Turbulence" (rapidness of changes): Example: FOG - Negative values: Turbulence value is enforced, the closer to -1 the more ridiculous fog will be. Positive values: Some dependencies are taken into account (on Overcast and Wind)..

 

The mod currently has Island presets (loaded at mod start: @tort_DynamicWeather2\script\config\islands.sqf) and presets for ingame menu (@tort_DynamicWeather2\script\config\templates.sqf)

Will have a look on the templates again. I like the presentation of islands.sqf, but not the templates.sqf. It currently is this way due to the nature of that html-map thing. I will re-think about it.

Share this post


Link to post
Share on other sites

Tested a bit and I think player altitude dependent fog works pretty well. In my testing I made fog randomly changing between two variables min/max, where min = n*player_asl, max=m*player_asl. E.g. n=0.5/m=1.5

Of course this is just a scenario in SP. In fact, fog will always follow the player. This is not realistic, but can be dampened, e.g. by measuring player asl only sometimes. The pro side is, thicker fog etc. can be used. It cannot be used independent from player asl, because very likely player will see no fog at all, if on higher terrains, or see nothing but fog, if too low.

Share this post


Link to post
Share on other sites

In the islands preset I added an array like this:

tort_island_fog_arr = [0, 0.2, 0.5, 1.7, true];

 

First two variables are min/max "Decay" (as in setfog command). 0 is very "stretched" fluffy fog, 1 is super thick/pressed, sharp edges.

Variables 5 is "Player altitude dependent on/off"

Variable 3/4 is min/max "Base" in meters as in setfog command.

BUT if you set 5 to true, min here means: 0.5*playerASL, max=1.7*playerASL- i.e. if player on 100m, fog stretches at least to 50m, at max. 170m

 

The normal and simple failsafe fog distribution is:

tort_island_fog_arr = [0, 0, 0, 0, false];

Share this post


Link to post
Share on other sites

 

I use spawn[]/execvm[] which call loops for every weather aspect. If I detect a server, I think that does not change?

 

Map control basically alters global variables. Because the disadvantages of scope problems and checking for existence/destroying variables/isnil things were too big (time consuming debugging) for me. Is that a problem in such a client/server infrastructure? Who can change the variables there?

To me it feels like someone on server must have the possibility to click appropriate weather, then submit it to clients?

 

 

Then you have to do two steps, to make your script server compatible:

 

1) Make sure, the loops are only called on a server:

Add them to the init.sqf and add if(!isserver) exitwith{}; //your code or the better variant: if(isserver) then {//your code} else {//nothing};

 

2) When clicking one of the controls on the player side and you assing a variable, add a publicvariable. That is not the best solution but works:

MyGlobalVariable = 123.456;
publicvariable "MyGlobalVariable";

The server will than be synchronised with the new value of "MyGlobalVariable".

 

Also keep in mind: Every weatherchange on the server is automatically broadcasted to the clients. No need to run a loop for weather change on the clients, hwne the server is taking care of that.

Share this post


Link to post
Share on other sites

Also keep in mind: Every weatherchange on the server is automatically broadcasted to the clients. No need to run a loop for weather change on the clients, hwne the server is taking care of that.

 

Yes. From how I understand you, the client does not need my mod at all in such a scenario... Correct?

Share this post


Link to post
Share on other sites

Yes. From how I understand you, the client does not need my mod at all in such a scenario... Correct?

 

Exactly!

 

BTW: I am still using your first weather script in co10 Escape but wanted to replace it lately (mostly because of rain without clouds), so I am very interested in helping with making your new version MP compatible ;)

 

Another idea: Why don't you use the function library? That would make everything much more portable!

  • Like 1

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

×