HAK3180 Posted March 4, 2019 The more I mess with it, the more I have no idea what it actually does. How are the two light levels determined? 0 Quote Share this post Link to post
1 wrkq Posted March 4, 2019 (edited) 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(): https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.10/p_spec.c#L1328 case 17: P_SpawnFireFlicker(sector); break; In the interesting part of P_SpawnFireFlicker we can see: https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.10/p_lights.c#L80 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. https://github.com/id-Software/DOOM/blob/77735c3ff0772609e9c8d29e3ce2ab42ff54d20b/linuxdoom-1.10/p_spec.c#L454 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: https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.10/p_lights.c#L46 The interesting part goes like this. amount = (P_Random()&3)*16; if (flick->sector->lightlevel - amount < flick->minlight) flick->sector->lightlevel = flick->minlight; else 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... TL;DR 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 March 5, 2019 by wrkq A little rephrasing of unclear references in #1 and #2. 3 Quote Share this post Link to post
0 Kappes Buur Posted March 4, 2019 (edited) 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 March 4, 2019 by Kappes Buur 1 Quote Share this post Link to post
0 HAK3180 Posted March 4, 2019 @Kappes Buur, I believe you've described effect 1. 0 Quote Share this post Link to post
0 bonnie Posted March 4, 2019 https://doomwiki.org/wiki/Lighting_effects Quote 17: Fire Flicker The sector's lighting will be 16 brighter than its assigned value, and it will flicker to its assigned brightness randomly. 0 Quote Share this post Link to post
0 Kappes Buur Posted March 4, 2019 (edited) 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 March 4, 2019 by Kappes Buur added video 2 Quote Share this post Link to post
0 HAK3180 Posted March 4, 2019 (edited) 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 March 4, 2019 by HAK3180 kinda ninjaed 0 Quote Share this post Link to post
Question
HAK3180
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.