Jump to content
m0nkey

MKY Sandstorm script

Recommended Posts

EDIT: Jan 19, 2016

V 003

Sample Mission on Shapur_BAF using my sand EFX script

 

Dependencies - none, although the sample mission requires AiA_TP or CUP Core/Terrain addons

 

Steam

http://steamcommunity.com/sharedfiles/filedetails/?id=604564772

 

Box

https://app.box.com/s/aqvn0gz0mvw4mh2vouvz829vk8pk4l65

 

* fixed a few server related issues

* added some documentation

* tweaked the particle emitter values a bit for visual presentation improvements

* modified units in group to be playable for coop test

 

Still a WIP at this point, but here are some videos of what I am working on for desert maps. I have learned a lot since I started on the snow maps. The more I learn, the more tricks I "think" I am finding to keeping the effect good while reducing resource footprint. You just have to be creative.. and read a bunch and experiment even more.. basically you don't play the game at all, you just code for it... hmm. ;)

 

 

 

 

  • Like 3

Share this post


Link to post
Share on other sites

I wonder, would it be possible to utilize this sort of script to make a "brownout" effect with helicopters? Either way, nice work! I'm a big fan of your snow storm script.

Share this post


Link to post
Share on other sites

I think I have already made that lol. I will try that tomorrow maybe and see what it looks like. With the rotor wash already there, it might look good or might not. Its a good idea though for one effect I just learned how to use.

Share this post


Link to post
Share on other sites

Too bad A3's default soldier animations aren't reactive to wind, dust thrown into the eyes, etc.

 

No chance that soldiers would be walking so relaxed in the middle of a duststorm IRL.

Share this post


Link to post
Share on other sites

I wonder how's the Ai working together with the dust? But very good work so far! Keep it up this would be very nice in rashmaan and of course the brownout would be amazing, too! <3<3<3

Share this post


Link to post
Share on other sites

Too bad A3's default soldier animations aren't reactive to wind, dust thrown into the eyes, etc.

 

No chance that soldiers would be walking so relaxed in the middle of a duststorm IRL.

They need goggles, gloves, baklava, and a PT belt. Mostly just rhe PT belt, it. beings safety and warmth.

Share this post


Link to post
Share on other sites

I wonder how's the Ai working together with the dust? But very good work so far! Keep it up this would be very nice in rashmaan and of course the brownout would be amazing, too! <3<3<3

 

On local machine, AI would be impacted by it, I would guess in a similar way to fog, although there has yet to be an exact answer that I have seen. 

 

What is known (or should be known) is that there is a parameter true by default to affect AI, and that has not been set false that I can tell. 

Share this post


Link to post
Share on other sites

So here are a couple videos illustrating a completely different approach to a "normal day" of blowing sand (I would imagine anyway). Its really lightweight compared to many (in terms of the dropinterval aka how many particles are used at one time). You can see the frames in the videos. I was getting 90-120 depending on what the AI were doing or where I was looking. Its not a large drop at all for this effect. Thats a few hours of tweaking parameters there...

 

 

  • Like 3

Share this post


Link to post
Share on other sites

Here is an updated video of the sand fx. Have fog, overcast and ppeffects working. Have ability to check if player is in house or vehicle, but adjusting wind volume is proving difficult. Trying different methods to stop the blowing sand in/near a structure player is in (this applies to snow as well). If only Killzone Kid had revealed how he did it.. I've tried many creative ways but cannot find the solution yet. 

 

Anyway, here is the latest. With a much, much better understanding of how all of this works, I can only say when you see the "glitchy" effect of a blowing "sand colored cloud" coming towards you, and then it "disappears", you just have to live with it. Its the nature of things and one that I don't like really but have to accept. The alternative is to shrink the particle down so its model space is not in the players model space, thus it remains much more visible, but that not only requires more resources for more particles but also does not look quite right. It works for snow to a large degree though ;)

 

  • Like 2

Share this post


Link to post
Share on other sites

Just gorgeous !! :)

 

For the wind sound, I don't know what trick KZK used but in my case I played the wind as music and adjusted the music volume through script. That did it fairly well.

Share this post


Link to post
Share on other sites

Fantastic. I can't wait to use this in missions. Did you ever mess around more with the brownout and rotor wash effect?

Share this post


Link to post
Share on other sites

Fantastic. I can't wait to use this in missions. Did you ever mess around more with the brownout and rotor wash effect?

Yes, I did. Brownout is fairly easy, and rotor wash is also pretty easy. I will see about a sample tonight. The hard part is syncronizing the vehicle with the emitter with the altitude haha. But thats the hard part about all emitters is vehicles and the speed at which particles have to live and die and spawn at different locations based on velocity etc. I've been focusing first on infantry because its easier.

 

As for volume, I am using playMusic and fadeMusic, but it does not seem to work, even from console. But in fairness I only just started that today. The next week or so should give me ample time to finish up the dust effect. Or so I hope.

Share this post


Link to post
Share on other sites

For the music, in initPlayerLocal.sqf:

 
0 = [] spawn {
	while { alive player } do {
		playMusic "sandstormsound";
		sleep 59.3;
	};
};



0 = [] spawn {
	while {alive player} do {
		if (vehicle player == player) then {
			if (lineIntersects [
					eyepos player,
					[
						eyepos player select 0,
						eyepos player select 1,
						(eyepos player select 2) + 10
					]
				]
			) then {
				1 fademusic 0.25;
				//hint "dedans"; // you are probably indoors
				}
			else {
				1 fademusic 0.5;
				//hint "dehors"; // outside
			};
		};
		sleep 2;
	}; 
};

You need to tweak the fademusic volume to suit the volume of your sound.

Share this post


Link to post
Share on other sites

Here is example of heli sand efx. This is really really simple, uses an ingame efx. This is just create the emitter, and attach to named object (heli). I have not taken the time to try all efx out, there are a few I tried and they all looked good, but this one was easy on resources. Spending some time tweaking could produce a really nice effect I can imagine, if one can get the logic down as to movement velocity and altitudes, etc.

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you. I may have to give that a whirl.

 

I was going with this, as performance is supposed to be better than sleeps I think

// start audio
if (bUseAudio) then {
eh_MKYaudio = addMusicEventHandler ["MusicStop",{playMusic "MKY_Blizzard";}];
playMusic "MKY_Blizzard";
};
 
 
Meanwhile, this piece was in the wiki, and I did not see it for a long time i guess, but it works really well
 
KK_fnc_inHouse = {
lineIntersectsSurfaces [
getPosWorld _this, 
getPosWorld _this vectorAdd [0, 0, 50], 
_this, objNull, true, 1, "GEOM", "NONE"
] select 0 params ["","","","_house"];
if (_house isKindOf "House") exitWith {true};
false
};
// use BIS func (recommended)
["buildingCheck","onEachFrame",{bInStructure = player call KK_fnc_inHouse;}] call BIS_fnc_addStackedEventHandler;
 
And then its simple enough to check that boolean and check if vehicle player == player or not. Issues comes in the fadeMusic. Even manually setting it does not seem to work. Might be related to EH, have to test, but here is the very basic logic I was using in a main loop
if ((vehicle player == player) || !(bInStructure)) then {
1 fadeMusic 1;
} else {
1 fadeMusic 0.5;
};

 

Share this post


Link to post
Share on other sites

The heli sand efx is really great !!

 

Just for info, the indoor/outdoor code detection I'm using is the one given by one of the JSRS author on this very forum section.

  • Like 1

Share this post


Link to post
Share on other sites

Now here is a little look at Shapur. The effect is performing very well, and looks good IMO. This is almost mp ready. Do still have to make some better algorithms though for varying of the effect and some input parameters. Still not found what I think is a good method for dealing with vehicles, and audio in vehicles/buildings not finished.

 

What does anyone think? Too much? It is hard to see at times. But what amount ruins gameplay vs makes it more immersive? I want to be immersed, but I realize if others don't know much scripting I can be nice and make it have more options  :)

 

  • Like 1

Share this post


Link to post
Share on other sites

Man, the ways you can mess with particles is simply mind blowing. Soooo many things affect each other. At least in terms of the looks.

 

Here are a couple vids of the sand efx now. Its getting really nice. As I have been finding, the lifetime of the particle combined with the number of particles, along with the velocity (like the wind blowing it, how fast it moves toward/away) coupled with the sizes and colors the particle can go through over its lifetime each have a large effect to the whole effect. These last two clips show how close its becoming to a realistic "blowing sand" sort of day. Not so much a huge sandstorm like most of the others.

 

Its quite satisfying though to see it :)

 

 

Share this post


Link to post
Share on other sites

Agreed......207 looks the best so far, very natural and realistic.  :thumbsup:

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

×