How do the new 4.2.0 attached dynlights work?
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
How do the new 4.2.0 attached dynlights work?
How do we attach them, remove them, define them, etc.?
If this is documented anywhere it should be linked in the wiki entry for [wiki]Dynamic light[/wiki].
If this is documented anywhere it should be linked in the wiki entry for [wiki]Dynamic light[/wiki].
-
- Posts: 4949
- Joined: Sun Nov 14, 2010 12:59 am
Re: How do the new 4.2.0 attached dynlights work?
There are functions. That's about all I know.
- Rip and Tear
- Posts: 185
- Joined: Tue May 02, 2017 3:54 pm
Re: How do the new 4.2.0 attached dynlights work?
I haven't been able to play around with it yet, but it seems like this doesn't allow for the same level of dynamic light manipulation as ZScript-defined lights. Not being able to add custom behavior to a light's tick makes this a no-go for my use case.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How do the new 4.2.0 attached dynlights work?
If you want to custom-manipulate a light you'll have to call A_AttachLight with the same light ID repeatedly in the tick function. The lights themselves are now pure renderer side objects for performance reasons. The function allows changing all properties a light can have.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: How do the new 4.2.0 attached dynlights work?
Performance question then: In DarkDoomZ my flashlight works by having an inventory item spawn a dynamic light as a world actor since it sways and rotates somewhat independently of the player. Obviously with large radius lights and constant light movement, this leads to performance issues on maps with lots of linedefs, due to relinking I presume.
Would I gain any appreciable performance if I used an attached light on a dummy world actor or the player? Or is it going to be negligible in comparison to the movement relinking I presume will still be happening?
Link to my dynamic light class for reference
Would I gain any appreciable performance if I used an attached light on a dummy world actor or the player? Or is it going to be negligible in comparison to the movement relinking I presume will still be happening?
Link to my dynamic light class for reference
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How do the new 4.2.0 attached dynlights work?
That won't make any difference. The light linking didn't get any faster with the change, the main advantage is that it doesn't require a full actor and all its overhead just to attach a light to a single state.
Re: How do the new 4.2.0 attached dynlights work?
So now I cant do
in zscript file and need create light definition in gldefs and then constantly (re)attach it to actor? Am I right?
If no, tell me a way to create dynamically controlled dynamic light.
Code: Select all
class light : pointlight {}
If no, tell me a way to create dynamically controlled dynamic light.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: How do the new 4.2.0 attached dynlights work?
Thanks for the clarification! I suppose I'll leave it as-is, since a single actor isn't much overhead.Graf Zahl wrote:That won't make any difference. The light linking didn't get any faster with the change, the main advantage is that it doesn't require a full actor and all its overhead just to attach a light to a single state.
- 22alpha22
- Posts: 303
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: How do the new 4.2.0 attached dynlights work?
I'm pretty sure the old lights are sticking around, otherwise that would break compatibility with older mods which isn't something usually done.Apeirogon wrote:So now I cant doin zscript file and need create light definition in gldefs and then constantly (re)attach it to actor? Am I right?Code: Select all
class light : pointlight {}
If no, tell me a way to create dynamically controlled dynamic light.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: How do the new 4.2.0 attached dynlights work?
What's a lightid?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How do the new 4.2.0 attached dynlights work?
What it says on the plate. It's an identifier for the light, so you can call the function repeatedly on the same light. The number is maintained per actor and entirely in user space, i.e. it's you who decides what number to use.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: How do the new 4.2.0 attached dynlights work?
How are they defined then? Is there a light struct within the Actor class?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49071
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: How do the new 4.2.0 attached dynlights work?
They are defined by calling A_AttachLight. Yes, there is a list of attached lights in each actor, and the lights in there are searched by the ID.