Rain Effects

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Rain Effects

Postby ZDL_800 » Tue May 21, 2019 1:27 pm

Hello Zdoom community hope everyone is good.

There's a brilliant mod called Aliens ACM and basically I believe the rain effects are taxing the system alittle too much, may I ask how would you reduce the render distance of the rain effect?

We added the Darkdoom lightning mod and you cannot see much at a distance so the theory is to reduce the effects view distance.

Any help would be greatly appreciated as its the only zdoom mod which seems to lag.

Thanks again.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby DoomeDx » Wed May 22, 2019 6:31 am

The way I do this:

I have two different types of rain created in Decorate. One for close range and one for long range. The close-range particles have the full effect enabled, they emit a sound, spawn a little splash when they touch the ground, are fully animated etc. The distant rain effects have none of that.

I use ACS with a while loop to spawn the close-range rain particles around the player and the far-range particles further away when the player is in a rainy area.

I'm not at home so I cant show you the code. But if you're interested, ill show you once I have my computer available
DoomeDx
 
Joined: 31 Dec 2017

Re: Rain Effects

Postby Void Weaver » Wed May 22, 2019 6:40 am

What about DistanceCheck property for the raindrop actor?
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Rain Effects

Postby ZDL_800 » Wed May 22, 2019 6:47 am

Hello DoomeDx and thankyou for the reply.

This is brilliant news, were highly interested in the code you mentioned, so I guess that the Aliens ACM mod is using the same parameters for the rain effects also?

Just searched the mod and we only see HUG.acs which I believe is the facehugger code, I can see some 'drip' parameters in the DECORATE script but not sure they have any sort of close range and long range settings?

As soon as any player walks outside and looks up, it lags really bad, especially on my friends PC, if the player is inside any building it runs fine.

Thankyou very much for helping us out, and hope to speak soon.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby ZDL_800 » Wed May 22, 2019 6:58 am

Hello Void Weaver and thankyou for the reply.

May I ask how would you allocate the DistaceCheck to the rain effect? We cant seem to even locate the parameters I'm afraid?

I believe the rain settings are located in the DECORATE script but I'm not sure?

Thanks again.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby Void Weaver » Wed May 22, 2019 9:09 am

ZDL_800, since I dunno what the "rain effect" is (and how it scripted is), I can only assume that in case if the rain mechanics presented in the mod as scripted loop of spawning droplets actors, then this property can be used directly in these actors, accordingly zwiki description:

a) define an your custom CVAR in CVARINFO lump;
b) define inside of your droplet actor the DistaceCheck property with your custom CVAR.
----
Btw, +NOINTERACTION flag can significantly reduce lags also.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Rain Effects

Postby ZDL_800 » Wed May 22, 2019 2:35 pm

Thanks for the reply.

I believe the code for the rain may be these strings I'm not sure, but its the only reference to water/drip but nothing for rain?

Here is the code sample may I ask does this look familiar to a rain script?

Code: Select allExpand view
ACTOR drippingwater replaces NonsolidTwitch
{
   Game Doom
   Radius 16
   Height 104
   renderstyle Translucent
   alpha 0.5
   +NOGRAVITY
   +SPAWNCEILING
   +RANDOMIZE
   +FORCEYBILLBOARD
   States
   {
   Spawn:
      DRIP A 0 A_jump(256,"drip1","drip2")
      loop
   drip1:
      DRIP A 0 A_playsound("ambie3",chan_Auto,0.2,1)
      DRIP ABCDE 3
      Loop
   drip2:
      DRIP A 0 A_playsound("ambie4",chan_Auto,0.2,1)
      DRIP ABCDE 3
      Loop
   }
}

ACTOR drippingwater2 replaces BloodyTwitch
{
   Game Doom
   Radius 16
   Height 104
   -Solid
   States
   {
   spawn:
      TNT1 A 1 A_playsound("lowrumb",chan_Auto,1)
      loop
   }
}


Also what exactly is a +NOINTERACTION flag and where exactly would you allocate this string? Sorry for all the questions this is quite confusing indeed.

Thanks again.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby Void Weaver » Wed May 22, 2019 3:26 pm

ZDL_800 wrote:I believe the code for the rain may be these strings I'm not sure, but its the only reference to water/drip but nothing for rain?
Sorry, bro, but that code pattern seems to aren't be a basic actors of rain action.
Now that's looks a bit pointless attempts to guess what are rain actors is.

ZDL_800 wrote:Also what exactly is a +NOINTERACTION flag and where exactly would you allocate this string? Sorry for all the questions this is quite confusing indeed.
... NOINTERACTION flag is... flag. :|
Sooo, are you new in modding, ja? If it's true then:
Matt wrote: <...> then read these.
Void Weaver wrote: <...> there will be helpful (in terms of DECORATE) the next articles:

Actor - what is it.
Actor states - describes its structure.
Sprite - about actors visual manifestation.
Using inheritance - tells about "how to make thing a bit varied aside from existing one".
Actor properties - which properties it can have.
Actor pointer - about links between actors that provides interaction with each other.
Actor flags - which "tumblers" it can have.
Action functions - list of its possible action functions.
DECORATE expressions - a bit advanced of previous.

Spoiler: Actor structure example
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Rain Effects

Postby ZDL_800 » Wed May 22, 2019 4:26 pm

Hello Void Weaver and thankyou for the reply.

That's unfortunate, I thought it was the rain script, maybe I need to talk to the devs of the Alien ACM mod and hopefully get the actual strings.

Yes I'm new to GZDoom engine modding but played the original Doom back in the day. I just never modded the games, until we discovered the Ai upscaled textures for Hexen, now I'm hooked, its brilliant, so many great games and mods!

Thanks for the links I'll take a look, but still we need to find the rain parameters to edit the strings. I guess what you are saying is once we find the rain script we add the NOINTERACTION flag to the rain section of code?

Thanks again.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby Void Weaver » Thu May 23, 2019 2:26 am

ZDL_800 wrote:maybe I need to talk to the devs of the Alien ACM mod and hopefully get the actual strings.
I think that is the best decision for your situation.

ZDL_800 wrote:I guess what you are saying is once we find the rain script we add the NOINTERACTION flag to the rain section of code?
NO, ofc! NOINTERACTION flag isn't panacea and its allowed area of implementation are strongly depends on the script\actors structure.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Rain Effects

Postby ZDL_800 » Thu May 23, 2019 11:37 am

Thanks for the reply.

I sent a message to the developer of the Aliens ACM mod and hopefully may get a response because I'm completely lost now.

Its Ok, at least you provided a brilliant optimization parameter for when or if we find the rain script.

Thanks again.

Update here.

We have applied the +NOINTERACTION to the spark and waterdrip strings and it seems to extend the game for about 5 mins until it breaks, such a shame.

If anyone has some spare time could anyone kindly test out this great mod? link here.

https://www.moddb.com/mods/acm-2014/downloads/acm-2014

Thanks again.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby ZDL_800 » Sat May 25, 2019 2:11 pm

Hello.

I received a message from the developer of the Aliens ACM mod and kindly was provided the rain scripts, may I ask could these parameters be edited to reduce the view distance?

For example, this is the in-game script that spawns drips on the first map:

Code: Select allExpand view
script 6 open
//goteras
{
thing_projectile(random(50,55),255,0,0,-100);
delay(random(5,20));
restart;
}


-And this is the DECORATE for the water drips:

Code: Select allExpand view
actor gotera 31007
{
   SPAWNID 255
   projectile
   Radius 1
   Height 1
   States
   {
   Spawn:
   BRS1 A -1
   Stop
   Death:
   BRS1 BCDEFGH 2
   Stop
   }
}


There also seems to be an issue with the skyclouds so the theory is to reduce the rain particle distance and completely remove the skyclouds seeing as the darkdoom lighting mod renders the sky black anyway, its that dark.

Thanks again and hope to speak soon.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby Void Weaver » Sat May 25, 2019 2:49 pm

First off define CVar inside of CVARINFO lump:
Code: Select allExpand view
user int YourDesirableRainDropVisibleDistanceCVar = 256; //It's our desirable distance value in mapunits.
Code: Select allExpand view
Actor gotera 31007
{
   SPAWNID 255
   +NOINTERACTION
   Projectile
   DistanceCheck YourDesirableRainDropVisibleDistanceCVar //Our CVar value were defined in actor itself and checks here
   Radius 1
   Height 1
   States
   {
   Spawn:
   BRS1 A 1 A_JumpIf(GetZAt(0,0,0)<=FloorZ,"Death") //In case if death animation will doesn't play due too high -VelZ (vertical velocity) just delete\block f-tion AND NOINTERACTION flag!
   Loop
   Death:
   BRS1 ABCDEFGH 2
   Stop
   }
}
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Re: Rain Effects

Postby ZDL_800 » Sat May 25, 2019 6:07 pm

Hello Void Weaver and thankyou for the reply.

After editing the strings the rain has drastically reduced in the view distance but unfortunately the mod still lags out, it must be the sky clouds constantly rendering.

I sent a message to the devs and hopefully get a response as to where the sky cloud strings are located.

Thanks again for your brilliant code, hopefully we can implement this with other elements like the dripping water and such.
Last edited by ZDL_800 on Sun May 26, 2019 8:08 am, edited 1 time in total.
User avatar
ZDL_800
 
Joined: 15 May 2019

Re: Rain Effects

Postby Void Weaver » Sat May 25, 2019 6:39 pm

Oh stop it, you! ^_^ That's just a pair of quite ordinary lines, no more.

Ofc main sources of lags are known a quite well: amount of dynlights and actors, unoptimized code patterns, unlimited spawning processes, different passive checks which goes in background and other things.

Well, since you are enough lucky for establish contact with the mod developer, then why you don't ask him directly about the lags? Maybe it's better to leave corresponding request in mod thread? I guess that developer should better know structure of own mod and code.
User avatar
Void Weaver
Keeper of the Diablo bestiary storage Also amateur DECORATE-spaghetti weaver ಠ_ಠ
 
Joined: 18 Dec 2014

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest