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

It Seems I Don't Understand Effect 17 Light Flicker After All


The more I mess with it, the more I have no idea what it actually does. How are the two light levels determined?

Share this post

Link to post

6 answers to this question

Recommended Posts

  • 1

Hey guys, I'm no Doom code guru, but looking at The Old Testament original source...

... uh, in retrospect I am full of regret.


Near the end of P_SpawnSpecials() there's a section initializing sector special effects, and type 17 calls P_SpawnFireFlicker():


      case 17:


In the interesting part of P_SpawnFireFlicker we can see:


    flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
    flick->sector = sector;
    flick->maxlight = sector->lightlevel;
    flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
    flick->count = 4;

So, we set up the T_FireFlicker() thinker.

Max light is always the starting light level of the sector, min light is "whatever P_FindMinSurroundingLight() returns plus 16".


The light level search is here, not quite attractive to quote code bits, but if there's no surrounding sector with lower level, it'll return the second parameter - so our flickering sector's starting light level.



So, uhhhh... that means that if all surrounding sectors are brighter or the same then maxlight is flickering sector's starting level, and minlight is flickering sector's starting level + 16. So, maxlight < minlight.

We can also get maxlight < minlight if there's no surrounding sector darker by more than 16.

And finally we can't get perfect black, minlight is always at least 16.

I need aspirin...


Now the T_FireFlicker thinker itself is here:



The interesting part goes like this.

    amount = (P_Random()&3)*16;
    if (flick->sector->lightlevel - amount < flick->minlight)
	flick->sector->lightlevel = flick->minlight;
	flick->sector->lightlevel = flick->maxlight - amount;

... okay, screw aspirin, that calls for rum.


First we roll the dimmness amount. 0/16/32/48 possible.


Then check if current light level minus the amount would end up below the minlight level. That can be "always true" for the cases where maxlight < minlight as above. In that case just reset to minlight (possibly our original+16).


Otherwise, take the rolled amount and subtract it from maxlight (the original level).


I'm absolutely unable to guess whether these checks are a bug-that's-a-feature or deliberately asymmetrical...





I think this is how it works...


1. If out of the whole list of neighbors and self, nothing is darker by more than 16

Mostly stuck at ((darkest sector found, which may be self)+16) level, which is the brighter state.

1-in-4 chance to switch to (original) level, which is the darker state, but will always switch back to brighter state on next roll.

2. A neighbor darker by exactly 16 exists

Permanently stuck at (neighbor+16) level - which happens to also be the same as (original).

3. A neighbor darker by 17-32 exists

Roll 1d4, choose from: (original) (neighbor+16) (neighbor+16) (neighbor+16)

4. A neighbor darker by 33-48 exists

Roll 1d4, choose from: (original) (original-16) (neighbor+16) (neighbor+16)

5. A neighbor darker by 49-64 exists

Roll 1d4, choose from: (original) (original-16) (original-32) (neighbor+16)

6. A neighbor darker by >64 exists

Roll 1d4, choose from: (original) (original-16) (original-32) (original-48)

Edited by wrkq : A little rephrasing of unclear references in #1 and #2.

Share this post

Link to post
  • 0

From the book DOOM Game Editor by Joe Pantuso


Causes light to begin blinking between original light level
and lowest light level of an adjacent sector.


If no adjacent sector has a lower light level, then the light

level will vary between the original light level and zero.

Edited by Kappes Buur

Share this post

Link to post
  • 0
37 minutes ago, HAK3180 said:

@Kappes Buur, I believe you've described effect 1.

Sorry, that is for line special 17.


I just tried this in a DOOM2 map.

It seems that

1. if all sectors are the same light level, or adjacent sectors are brighter,

 then the light will flicker between original level and 16 higher light level.

2. if an adjacent sector is lower in brightness then the light level will

randomly change between the original light level and that of the adjacent sector.



Edited by Kappes Buur : added video

Share this post

Link to post
  • 0

Okay, so it does what @bonnie said unless adjacent sectors are darker. In that case it's similar to "light blinks." I think it may still always be at least 16 brighter than the darkest adjacent though.

Edited by HAK3180 : kinda ninjaed

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now