Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
asmcint

GZDoom Builder Dynamic Lighting

Recommended Posts

Okay, so I need a lot of help here. I've been trying to figure out how to make lamps that cast dynamic lighting in GZDoom Builder. So far I've learned how to create an actor, and have that actor inherit most of its properties from an existing one. Cool. But then there's no information I can find to bridge that with the information on GLDefs. I'm guessing it's because you're expected to have a base level of coding knowledge so that you can piece together where stuff needs to go yourself, but I can't even get that base level of knowledge, because I can't even find out what language DECORATE scripts are based off of!

I'm just so completely lost, and I would really appreciate any help y'all can offer.

Share this post


Link to post

If your actor is defined like this in DECORATE:

actor MyActorName [...] {
  [...]
  States {
    [...]
    ABCD E 10
    [...]
  }
}
Then this is how you assign a dynamic light to its "ABCD E" frame in GLDEFS:
pointlight MyLightName {
  [...]
}
object MyActorName {
  [...]
  frame ABCDE {
    light MyLightName
  }
  [...]
}
The thing that bridges DECORATE and GLDEFS is that the actor name in DECORATE is identical to the object name in GLDEFS, and the sprite names and letters in DECORATE match the frame names in GLDEFS.

Share this post


Link to post

If you have a custom actor with its own states, the Light keyword will be an easy way to bind a dynamic light to that precise frame.

GLDEFS Binding can be used to add dynamic lights to pre-existing actors, and actors that inherit from a pre-existing actor.

Ninja'd by scifista.

Share this post


Link to post

Wait, so GLDefs are actually separate pieces of code from the actor? ... That makes a lot more sense.

Share this post


Link to post

Yeah, DECORATE and GLDEFS need to be in separate files/lumps, named DECORATE and GLDEFS respectively (or in files that are referenced from within either DECORATE or GLDEFS via #include).

asmcint said:

I'm guessing it's because you're expected to have a base level of coding knowledge so that you can piece together where stuff needs to go yourself, but I can't even get that base level of knowledge, because I can't even find out what language DECORATE scripts are based off of!

ZDoom lumps are languages unique in their own right, and the zdoom wiki documents their syntax and semantics thoroughly. You shouldn't need knowledge from anywhere else in order to make those lumps.

Share this post


Link to post

Okay, I'm not sure what I'm doing wrong now, but I'm getting compiler errors when I try to test and the code editor has the compile option grayed out for my GLDEF lump. I decided to try affixing the light to an existing actor, as can be seen by my referencing the column class for the floor lamp.

pointlight lamplight
{
	color 0.5 0.53 0.45
	size 48
	[offset 0 0 0]
	[subtractive 0]
	[dontlightself 0]
}

object column
{
	frame COLU A -1
	{
		light lamplight
	}
}

Share this post


Link to post

The square brackets also look like something that shouldn't be there. In syntax definitions on the wiki, square brackets signify optional inclusion. In other words, "[offset <X> <Y> <Z>]" means that either your definition should contain a line with the word "offset" followed by 3 numbers, or it should omit that line completely.

Share this post


Link to post

Ohhh, see, the square brackets were in the full examples as well as the teachy bits so I figured they, as well as the contents within, were necessary. My bad. So now I've got

pointlight lamplight
{
	color 0.5 0.53 0.45
	size 48
}

object column
{
	frame COLU
	{
		light lamplight
	}
}
It doesn't throw the compiler error anymore, but neither am I seeing any lights coming off the actors I've placed. Do I have to make the script run somehow, or is it supposed to do so automatically?

Share this post


Link to post

Can you see any dynamic light coming out of any other objects in the game? If not, make sure that you are playing in a port with an OpenGL renderer and with dynamic lights enabled in the options.

Share this post


Link to post

These are the only objects set up with dynamic lights, I literally just made a square room to test this stuff in. I did forget to switch GZDoom back to the OpenGL renderer, but it's still not showing dynamic lights now that I have.

Share this post


Link to post

You need to make sure whether you have dynamic lights enabled at all, either by scouring the options or by loading a map that's known to contain objects with GLDEFS-defined dynamic lights and check if you can see them.

Share this post


Link to post

I do have them enabled, even when I was using the software renderer while my PC was in dire condition I kept them on so that I could switch renderers and have the full glory of OpenGL lighting effects available to me again.

Still, just to be on the safe side I used the exact same version of GZDoom and loaded up Project Brutality. All the special lighting effects there worked just fine.

Share this post


Link to post

Then there's some difference in how we're using the code. Is there a predefined place for GLDEFs I was supposed to use, or a specific way to execute the code beyond just having it in Script Editor?

Share this post


Link to post

Nothing special is needed. What happens when you just load the wad I linked you in GZDoom while using the OpenGL renderer and "Display Options -> OpenGL Options -> Dynamic Light Options" having all entries set to "Yes"?

Share this post


Link to post

I get Map01, trying to load it in GZDoom Builder says that it can't find maps in any game configuration. What did you DO?

Better yet, just walk me through the steps you took to load the script I produced. We're doing something differently, and I need to find out what. While it may be nothing special to you, I am so green behind the ears with this I could lay face-down and hide in short grass.

Share this post


Link to post

The wad doesn't contain any maps, it contains only one lump named GLDEFS, and this lump contains only the code from your post above. If you type "summon column" into console in the game, it will summon the object, and the object will have a dynamic light on it.

I get it now, you were writing your code into a script editor in GZDoom Builder! GZDoom Builder is a map editor, you can't use it to edit non-map lumps. You need to use a wad content editor such as SLADE3 to create a lump named GLDEFS and put the code there, to apply globally in any maps that will be loaded while the wad is loaded.

EDIT: GZDoom Builder can edit GLDEFS in the script editor if you choose "Open File -> GZDoom GLDEFS". Putting it into your wad seems to require SLADE3 anyway, though.

Share this post


Link to post

Oooooh, okay. See, that wasn't explained in any of the ZDoom wiki articles I was trying to get information from! It's absurd just how sparse their documentation actually is! Alright, lemme get SLADE 3 installed and I'll get back to you with how that goes.

Share this post


Link to post
asmcint said:

See, that wasn't explained in any of the ZDoom wiki articles I was trying to get information from!

https://zdoom.org/wiki/Editing_tools

Editing tools are independent on the content they're being used to edit, that's why articles about editors and content are separate.

Share this post


Link to post
scifista42 said:

https://zdoom.org/wiki/Editing_tools

Editing tools are independent on the content they're being used to edit, that's why articles about editors and content are separate.


That's a weird way of handling it, but oh well. Tried making things that way myself, and it works! Just gotta tweak the values a bit, but it should turn out juuuuuust fine. The color's even exactly what I wanted, and I was just guessing the values on that and would tweak it by eye once I had it working! Thank you!

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×