With the night time lighting done, I needed to change my fire effect to be bigger, brighter and louder. I started off by going into the system and multiplying all the values by 10. Suffice to say, this might have been overkill…
I took the velocity down, but left the particle size, as I really liked the big wide base of the fire.
I then scaled the particle size over life, getting the nice big flames at the bottom and some smaller ones fading away at the top.
I then took out the light module, as I had plans for a scripted light, and turned down the rate and emissive slightly, as it was way too bright.
I then popped my other emitters back in. I didn’t want to change the shape of the smoke or the embers, so I just upped the values slightly.
I then started scripting a light that would flicker on and off, to create that sort of random lighting that a fire gives off. My first step was to create a custom event, much like I did with the rain.
After that, I created a while loop that toggled the visability of the light after a random delay while a boolean that I set called light flicker exists was true. This turned out to be problematic, as it was an infinite loop and the game was unable to progress. I tried setting the value to false in another event, but it couldn’t get to this event due to being stuck in the loop.
I ended up trying a completley different tactic after messing with this for a while and getting nowhere. I took out the loop and used the event tick instead. At first this didn’t want to work, but after changing retriggerable delay to just a normal delay it worked fine. This turned the light on and off at random intervals.
This did the job, but definitely didn’t look natural or beautiful. I wanted the light to fade in and out more naturally. I was wondering if maybe I should have just animated it by hand here, but managed to find a solution. My first idea was to interpolate between two random values. This was a lot less jittery than the first version, and setting the delay to very quick and the range for the intensity value fairly low (well, compared to the original value of 0 – 100000), I got a nice quickly flickering light.
There was still an issue in the sort of “on, off” look that it had. Whist it didn’t just go on and off statically as before, the transition still felt very sharp and jagged. To fix this, I replaced one of the random values with the previous intensity, so that the intensity will interpolate between the old one and the new one. This gave a softer, glowing effect, just what I wanted.
Its possible that this would have looked better as a hand animated piece, however, what I have created here could be applied to lights throughout the game if I had a large game to work with, and was a quicker solution.