Once I learned some of the basics of ddf, it has been pretty straight-forward. But there are some certain effects I am having trouble pulling off correctly.
Specifically, I am having trouble with getting the lights to flicker to simulate a flame.
Some of these have come out pretty good, like the basic candle, which I made with this:
Code: Select all
[BLACK_CANDLE:34]
RADIUS=16;
HEIGHT=16;
DLIGHT.TYPE=QUADRATIC;
DLIGHT.INTENSITY=100;
DLIGHT.COLOUR=#ffe74b;
SPECIAL=NOSHADOW;
STATES(IDLE)=CAND:A:5:BRIGHT:dlight_set(110),
cand:a:2:bright:dlight_set(80),
cand:a:8:bright:dlight_set(100),
cand:a:1:bright:dlight_set(85),
cand:a:3:bright:dlight_set(125),
cand:a:1:bright:dlight_set(79);
But there are two problems I am coming across.
The first is that most things that have a flame have an animation, and adjusting the dynamic light while keeping the animation playing at a proper rate is tricky. Either A) I adjust the light in synch with the animation, which is acceptable but doesn't look as nice, or B) I have a very long sequence of instructions to loop through several changes from the light and cycling the animation properly, which isn't exactly a major problem but we should be able to set up a better system.
The second problem is that because these scripts execute in an exact order, they are all synchronized in an exact pattern. When you have multiple lights of the same type near each other, which happens fairly frequently, they all flicker in unison and it doesn't look natural at all. Areas with a lot of identical things (like the start of Map22 in Doom 2) look horribly atrocious.
As I was thinking about these problems, the first thing that came to my mind is that I could really use some sort of randomizing feature. Is there any such feature already built-in to the ddf scripts? I did not see any on the wiki page. It would be a useful option to have because it could be used in a myriad of ways, not just with these lights. Make random drops from enemies, for example.
So my first question here is, is there any options to create random variables in ddf, or otherwise to randomize elements, especially for individual instances?
As I thought more about exactly how I want to approach this issue, however, it occurs to me that the better (and in some ways simpler) solution to these lights would be to create a command to make dynamic lights flicker. I see there is already an option to make a light fade. I am thinking something that gets put into the script in the same manner, a command that says "DLIGHT_FLICKER(x,y)" where x is the lowest brightness and y is the maximum brightness, and then the dynamic light instance will follow a pattern of semi-randomly jumping its brightness value around.
This would solve both of the issues and then some. Each light can flicker independently, the script itself would be very short, and on top of that, the actual flickering pattern could written to better simulate a natural pattern than one might have done with ddf script originally.
That's my idea anyway, but I don't exactly know how feasible this is.