Emergency lighting fix

LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
edited April 2011 in NS2 General Discussion
It's been bugging me for a while that the emergency lights came on so sudden and awkward. I dug into the LUA a bit and fixed:

<center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/JKofELllc5M"></param><embed src="http://www.youtube.com/v/JKofELllc5M" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>

I'm assuming since there was already a fade for the lights going on/off this fix is the actual intended behavior. The off time has not been altered.

Source: <a href="http://devin-afshin.com/lazer/PowerPoint_Client.lua" target="_blank">PowerPoint_Client.lua</a>

Comments

  • radforChristradforChrist USA Join Date: 2002-11-04 Member: 6871Members, Constellation, NS2 Playtester, Subnautica Playtester
    Looks cool! Great job!
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    Nice. Submitted to mantis as 0000506: PATCH: Emergency Light Fade in [Lazer]
  • weeschweeweeschwee Join Date: 2010-11-19 Member: 75031Members
    would be cool to have different emergency lights flicker and come on one at a time with a kind of staggered effect.
  • kababkabab Join Date: 2003-12-15 Member: 24384Members, Constellation
    <!--quoteo(post=1843473:date=May 1 2011, 05:56 PM:name=weeschwee)--><div class='quotetop'>QUOTE (weeschwee @ May 1 2011, 05:56 PM) <a href="index.php?act=findpost&pid=1843473"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->would be cool to have different emergency lights flicker and come on one at a time with a kind of staggered effect.<!--QuoteEnd--></div><!--QuoteEEnd-->Yeah that would look awesome! Should be pretty straight forward as well!

    You up for the challenge Lazer :D
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    <!--quoteo(post=1843478:date=May 1 2011, 05:14 AM:name=kabab)--><div class='quotetop'>QUOTE (kabab @ May 1 2011, 05:14 AM) <a href="index.php?act=findpost&pid=1843478"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Yeah that would look awesome! Should be pretty straight forward as well!

    You up for the challenge Lazer :D<!--QuoteEnd--></div><!--QuoteEEnd-->

    Right ... in the Spark engine, that's not a challenge. Its a cakewalk. In other words,

    "That's not a challenge. THIS is a challenge".

    5 changed lines or less, with only one line allowed to do any calculations.
  • peregrinusperegrinus Join Date: 2010-07-16 Member: 72445Members
    Impressive!

    Which map is that? Is it an official release?
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    <!--quoteo(post=1843511:date=May 1 2011, 12:20 PM:name=peregrinus)--><div class='quotetop'>QUOTE (peregrinus @ May 1 2011, 12:20 PM) <a href="index.php?act=findpost&pid=1843511"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Which map is that? Is it an official release?<!--QuoteEnd--></div><!--QuoteEEnd-->
    ns2_icarus, a map I've been working on for a while now, not official though

    And lol w/ these challenges. Making the lights behave independent from each other could be tricky. Maybe if I used something like (light's uid mod 10)/10 and used the fraction to determine a slight flicker on delay for each light could be a start... will take some playing around but I can attempt the challenge :)
  • KurrineKurrine Join Date: 2010-07-03 Member: 72235Members
    Any chance of just having the emergency light sources to pick a random (within a certain range of course) start up length or start-up method (different flickers or regular non-flicker gradient change) from a list to use?

    I hope that made sense.
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    Ok so I just had to :p
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/9JmnSSKD3nk"></param><embed src="http://www.youtube.com/v/9JmnSSKD3nk" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>

    It only flickers when turning on. It could be done all the time but I think it feels about right like this.

    <a href="http://devin-afshin.com/lazer/PowerPoint_Client_flicker.lua" target="_blank">PowerPoint_Client_flicker.lua</a> (rename PowerPoint_Client.lua)
  • IronHorseIronHorse Developer, QA Manager, Technical Support & contributor Join Date: 2010-05-08 Member: 71669Members, Super Administrators, Forum Admins, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Blue, Subnautica Playtester, Subnautica PT Lead, Pistachionauts
    <!--quoteo(post=1843586:date=May 1 2011, 10:33 PM:name=Lazer)--><div class='quotetop'>QUOTE (Lazer @ May 1 2011, 10:33 PM) <a href="index.php?act=findpost&pid=1843586"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Ok so I just had to :p
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/9JmnSSKD3nk"></param><embed src="http://www.youtube.com/v/9JmnSSKD3nk" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>

    It only flickers when turning on. It could be done all the time but I think it feels about right like this.

    <a href="http://devin-afshin.com/lazer/PowerPoint_Client_flicker.lua" target="_blank">PowerPoint_Client_flicker.lua</a> (rename PowerPoint_Client.lua)<!--QuoteEnd--></div><!--QuoteEEnd-->


    do it all the time. you know the amount of posts (some by me) advocate this.. make it so i can at least buy a California server and run it this way. cuz i will. called LAzer.
  • weeschweeweeschwee Join Date: 2010-11-19 Member: 75031Members
    that's pretty sweet. i like the flickering a lot. i think you nailed it.

    for the staggered effect, not sure if you implemented that. it wasn't as obvious as i imagined in my head, but it could be the way the game works. but the flickering looks great!
  • kababkabab Join Date: 2003-12-15 Member: 24384Members, Constellation
    <!--quoteo(post=1843586:date=May 2 2011, 04:33 PM:name=Lazer)--><div class='quotetop'>QUOTE (Lazer @ May 2 2011, 04:33 PM) <a href="index.php?act=findpost&pid=1843586"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Ok so I just had to :p
    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/9JmnSSKD3nk"></param><embed src="http://www.youtube.com/v/9JmnSSKD3nk" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>

    It only flickers when turning on. It could be done all the time but I think it feels about right like this.

    <a href="http://devin-afshin.com/lazer/PowerPoint_Client_flicker.lua" target="_blank">PowerPoint_Client_flicker.lua</a> (rename PowerPoint_Client.lua)<!--QuoteEnd--></div><!--QuoteEEnd-->Very nice little effects like that really add to the game...

    Hopefully it makes the official cut :D
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    <!--quoteo(post=1843591:date=May 2 2011, 01:38 AM:name=weeschwee)--><div class='quotetop'>QUOTE (weeschwee @ May 2 2011, 01:38 AM) <a href="index.php?act=findpost&pid=1843591"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->that's pretty sweet. i like the flickering a lot. i think you nailed it.

    for the staggered effect, not sure if you implemented that. it wasn't as obvious as i imagined in my head, but it could be the way the game works. but the flickering looks great!<!--QuoteEnd--></div><!--QuoteEEnd-->
    Thanks, I think it might be the video making it hard to tell the staggering effect. What I had done was on the loop that updates each individual light I used the index of the light mod 8 to create a cycling number between 0 and 7. Then took that number over 8 to determine how long before certain lights flick on (basically every .1s a different set of lights starts turning on until they are all lighting up). Also as they light up it uses the modulated index to determine when it should flicker as well. Also for the staggered effect to appear more obvious the light index can be modulated by a lower number (like 4) which often makes the difference in turn-on delay greater between neighboring lights but leads to a slightly less random appearance.

    btw I made a couple adjustments and re-uploaded it just to tweak a few things

    <a href="http://devin-afshin.com/lazer/PowerPoint_Client_flicker.lua" target="_blank">PowerPoint_Client_flicker.lua</a> (rename PowerPoint_Client.lua)

    You should be able to run this locally and still play online too if anyone wants to try it.
  • ThaldarinThaldarin Alonzi&#33; Join Date: 2003-07-15 Member: 18173Members, Constellation
    I've always found it feels like it takes too long for the emergency lighting to come on, it's not so emergency if it feels like someone is taking the time to go and turn it on because it's that slow. A second of down time, the rest of that time flickering then on full, makes a bit more sense and atmosphere for me.
  • radforChristradforChrist USA Join Date: 2002-11-04 Member: 6871Members, Constellation, NS2 Playtester, Subnautica Playtester
    It looks good, but I wonder if you could prolong the flicker just a bit. have the flicker off be just a touch longer.

    As it is, my first impression was a graphical glitch, not a flickering light.

    Pretty amazing what you can do in LUA though, great work Lazer!
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    edited May 2011
    <!--quoteo(post=1843655:date=May 2 2011, 09:22 AM:name=Thaldarin)--><div class='quotetop'>QUOTE (Thaldarin @ May 2 2011, 09:22 AM) <a href="index.php?act=findpost&pid=1843655"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->A second of down time, the rest of that time flickering then on full, makes a bit more sense and atmosphere for me.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Me too, when I get off of work later I will have to spend a little time fixing this.

    <!--quoteo(post=1843657:date=May 2 2011, 09:38 AM:name=radforChrist)--><div class='quotetop'>QUOTE (radforChrist @ May 2 2011, 09:38 AM) <a href="index.php?act=findpost&pid=1843657"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->It looks good, but I wonder if you could prolong the flicker just a bit. have the flicker off be just a touch longer.

    As it is, my first impression was a graphical glitch, not a flickering light.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I see what you mean, it should also probably flicker more when first turning on. The adjustments I had made this morning let it seem a little less glitchy (isn't flickering a glitch of sorts? :p) but I think an increased flicker duration and just a second or so shorter dark time will be a huge improvement. Later today I'm going to look into making it more something like this although a bit less intense:

    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/is-Gn8J2xHY"></param><embed src="http://www.youtube.com/v/is-Gn8J2xHY" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
  • radforChristradforChrist USA Join Date: 2002-11-04 Member: 6871Members, Constellation, NS2 Playtester, Subnautica Playtester
    <!--quoteo(post=1843670:date=May 2 2011, 01:10 PM:name=Lazer)--><div class='quotetop'>QUOTE (Lazer @ May 2 2011, 01:10 PM) <a href="index.php?act=findpost&pid=1843670"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec--><center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/is-Gn8J2xHY"></param><embed src="http://www.youtube.com/v/is-Gn8J2xHY" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center><!--QuoteEnd--></div><!--QuoteEEnd-->

    You now realize it is <b>imperative</b> that your next video example has that soundtrack!
  • Kouji_SanKouji_San Sr. Hινε Uρкεερεг - EUPT Deputy The Netherlands Join Date: 2003-05-13 Member: 16271Members, NS2 Playtester, Squad Five Blue
    edited May 2011
    For a second there I thought Lazer would turn it into something similar to his nick!


    But this is quite nice! The flickering looks cute too. Now let's hope the actual light models light emitting thingies (I believe they are called lights :P) are possible to turn off or into a color
  • Chris0132Chris0132 Join Date: 2009-07-25 Member: 68262Members
    I imagine at some point UWE will add a colour tint mask to those props, so you can recolor the parts of the model indicated by the mask.

    You could probably use the same texture as the self illumination map.
  • Josh86Josh86 Join Date: 2010-12-06 Member: 75513Members
    Crappy tube or ballast! Maybe I'm just used to commercial grade lighting. I haven't seen flickering FLs like that since I lived with my parents in our 90s era home, heh.

    I really do like the combined effects, though. I like the slow fade in because it gives that slightly archaic feel. The marine tech is in a way advanced, but extremely rugged/mechanical. The flicker helps add that feeling that the lighting is something that is unreliable somehow, or that it is indeed an emergency system that just barely, thankfully, comes on.

    I was hoping the devs would change the properties of the emergency lighting somehow. This is a great step towards creating a better atmosphere; good job!
  • weeschweeweeschwee Join Date: 2010-11-19 Member: 75031Members
    <!--quoteo(post=1843654:date=May 2 2011, 09:12 AM:name=Lazer)--><div class='quotetop'>QUOTE (Lazer @ May 2 2011, 09:12 AM) <a href="index.php?act=findpost&pid=1843654"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Thanks, I think it might be the video making it hard to tell the staggering effect. What I had done was on the loop that updates each individual light I used the index of the light mod 8 to create a cycling number between 0 and 7. Then took that number over 8 to determine how long before certain lights flick on (basically every .1s a different set of lights starts turning on until they are all lighting up). Also as they light up it uses the modulated index to determine when it should flicker as well. Also for the staggered effect to appear more obvious the light index can be modulated by a lower number (like 4) which often makes the difference in turn-on delay greater between neighboring lights but leads to a slightly less random appearance.

    btw I made a couple adjustments and re-uploaded it just to tweak a few things

    <a href="http://devin-afshin.com/lazer/PowerPoint_Client_flicker.lua" target="_blank">PowerPoint_Client_flicker.lua</a> (rename PowerPoint_Client.lua)

    You should be able to run this locally and still play online too if anyone wants to try it.<!--QuoteEnd--></div><!--QuoteEEnd-->

    as far as staggering, are you talking about staggering when the lights flicker or when they come on? i was talking about staggering as far as when they come on. like one light, then the next, and then the one after that. either way, i'm not going to criticize your work. it's all personal preference now. i like the suggestions others are making, but clearly you know what you're doing and it's great. i'm not much of a programmer so i don't know the effort you went through (especially since i've never worked with lua before).
  • LazerLazer Join Date: 2003-03-11 Member: 14406Members, Contributor, Constellation, NS2 Playtester
    <!--quoteo(post=1843744:date=May 2 2011, 08:40 PM:name=weeschwee)--><div class='quotetop'>QUOTE (weeschwee @ May 2 2011, 08:40 PM) <a href="index.php?act=findpost&pid=1843744"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->as far as staggering, are you talking about staggering when the lights flicker or when they come on? i was talking about staggering as far as when they come on. like one light, then the next, and then the one after that. either way, i'm not going to criticize your work. it's all personal preference now. i like the suggestions others are making, but clearly you know what you're doing and it's great. i'm not much of a programmer so i don't know the effort you went through (especially since i've never worked with lua before).<!--QuoteEnd--></div><!--QuoteEEnd-->
    I think it's hard to tell the staggering because of how I implemented it. Right now there is 8 different time delays for the lights but because they are all <1 second it is really hard to notice the differences between them. I do plan to make a few more adjustments and would like to account for this better as well.
  • weeschweeweeschwee Join Date: 2010-11-19 Member: 75031Members
    <!--quoteo(post=1843758:date=May 2 2011, 11:24 PM:name=Lazer)--><div class='quotetop'>QUOTE (Lazer @ May 2 2011, 11:24 PM) <a href="index.php?act=findpost&pid=1843758"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I think it's hard to tell the staggering because of how I implemented it. Right now there is 8 different time delays for the lights but because they are all <1 second it is really hard to notice the differences between them. I do plan to make a few more adjustments and would like to account for this better as well.<!--QuoteEnd--></div><!--QuoteEEnd-->

    gotchya. so i imagine all of this is going to be featured in the final version of your map then. how big is your map?
  • Wandering YouthWandering Youth Join Date: 2011-04-29 Member: 96204Members, Reinforced - Supporter
    edited May 2011
    Hmm, any chance you could add sound effects to the lightning system when it's dieing or coming back alive after a player fixes or destroys a node?

    Kind of like this:

    <center><object width="450" height="356"><param name="movie" value="http://www.youtube.com/v/hiyOcAKB_-A"></param><embed src="http://www.youtube.com/v/hiyOcAKB_-A" type="application/x-shockwave-flash" width="450" height="356"></embed></object></center>
Sign In or Register to comment.