Dynamic Light lag issue

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Dynamic Light lag issue

Post by Major Cooke »

Several folks thought I should report this as an issue since I wasn't quite certain...

But if you have a dynamic light with a massive size, it causes lag - with and without the option to have them enabled on.

Code: Select all

FlickerLight2 SuperBigBlueLight2
{
	Color 0.0 0.25 1.0
	size 1000000
	SecondarySize 2000000
	Interval 0.0250
}
And for the record, no, I would never DARE make such a light. I found it in a mod I'm working to convert from Zandronum to GZDoom. Now, if I were to hazard a guess, I'd say because it's FlickerLight2: said light constantly readjusts its size even when disabled (the option in the menu turned off).

The biggest takeaway here however... The greatest speed boost I gained was just by disabling the GLDefs light section altogether. That one I'm attributing to the case of "it's simply not there to tick".

Side note, I always wondered what was causing this sort of problem. It's amusing to think about... I couldn't have ever guessed this would've been a thing without ProfileThinkers. That is seriously one awesome tool. :mrgreen:

But even toning it down to 512 and 1024 respectively can still cause some lag. Not as exponentially but still some.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Dynamic Light lag issue

Post by Graf Zahl »

Yeah, of course it causes lag - it needs to process the ENTIRE map to be linked to surfaces - every time something about it changes.

The time is lost because in order to affect a wall or sector it needs to be linked to it - the larger the light, the more parts of the level need to be processed. This linking also happens when lights are switched off.

This is a clear case of "don't do that!"
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Dynamic Light lag issue

Post by Major Cooke »

Thought so myself. Welp, I'll tell the owner he should tone it down on his side too.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Dynamic Light lag issue

Post by Apeirogon »

I found it in a mod I'm working to convert from Zandronum to GZDoom.
Is zandronum works right with such "giant" light source?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Dynamic Light lag issue

Post by Graf Zahl »

Zandronum uses a very old version of the light code in which the size is limited to a single byte in many cases,
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Dynamic Light lag issue

Post by Major Cooke »

That would explain why it never lagged so much in older versions. It was clamped. Huh...
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: Dynamic Light lag issue

Post by drfrag »

Wouldn't that be a good performance option?
User avatar
Rip and Tear
Posts: 185
Joined: Tue May 02, 2017 3:54 pm

Re: Dynamic Light lag issue

Post by Rip and Tear »

Why does light linking need to happen when dynamic lights are disabled?
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Dynamic Light lag issue

Post by Major Cooke »

Also, curious... If dynamic lights are linked, why are they render-only data?
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Dynamic Light lag issue

Post by Rachael »

Because no play objects actually access the dynamic light data. Just because it is linked to sector data does not actually mean it is automatically in the play sim. In fact there are a lot of things in the rendering loop that access playsim data directly - but all efforts are made to ensure the integrity of the playsim, even with interpolation and whatever other fuckery happens in the render loop.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Dynamic Light lag issue

Post by Major Cooke »

Not to mention there's other render modes. That just reminded me of it... Fair.
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Dynamic Light lag issue

Post by Rachael »

I will say this though: I see no harm in exporting and read-only allowing access to the actual dynamic light definition of actors to the playsim itself ZScript. (Just the definition only, not ever the light's current actual state) This would include the light type, flicker type, color, and min/max radius.

@ Graf: Does the renderer actually fuck with these variables? I know that ye olde classic GL 2.0 renderer had the caveat that attenuated lights would be shrunk by 1/3rd in radius, but we don't use that anymore with modern GZDoom, anyway. And I really doubt that there's much to worry about with flicker lights, since that should be handled externally, as far as I know, instead of actually using the actor's light data to do its work.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Dynamic Light lag issue

Post by Major Cooke »

Well, he had something in the works that would allow directly defining and giving a dynamic light to the actor. I'm uncertain what its status is now though. As in, it bypasses the need to make a GLDef entry or to create an inherited light that constantly calls SetOrigin...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Dynamic Light lag issue

Post by Graf Zahl »

I added two ZScript functions for that recently. All this hackery with dynamic light actors was entirely unintended and merely an unforeseen side effect of the implementation.
Post Reply

Return to “Closed Bugs [GZDoom]”