Monday, April 11, 2011

Lightning

First post, lets see how this goes. . .

Ever since I played Left 4 Dead on my favorite campaign No Mercy, I always wondered how Valve got the lightning effect to work. It was not until May 2009 when I got to see the vmf. In Valves case, the lightning effect is done by logic_cases, sounds, logic_timers and flashing sprites in the 3D skybox. However, this is in the first part of No Mercy when your outside and inside almost equal amounts of time. Without going into detail on how they did theirs, I decided to take a whack on this effect for a map were your indoors.




Better remember, lightning never strikes twice!

This was for a small map I was playing with, mostly playing with an idea me and another developer were doing. For that screen, I had to go into demo mode, and slow down the playback. Yeah, it flashes that fast, like real lightning. A neat effect to have in your map, totally when you use env_projectedtextures. Best off all, its actually very easy to do. 

I don't want these posts to be tutorials, but at the same time, I want to tell you how I did it. I'm sure if I told you what entity does what and how by text, I'll lose people. Lets see how I can show this.


I think if you can follow this diagram, this should tell you on how all the entities communicate with each other. The gray thin line is your window wall. The logic_timer is enabled at start. On its high random time, it triggers the relay that makes the effect. After its done, it calls the logic_case which decides what sound file to use, and when. A really simple and easy effect!

Now, unless you fixed the env_projectedtexture in your mod by code, you want to use your env_projectedtexture in the best spot possible since you are only allowed to use one. If you only have one to use, I would recommend to spot this on something important, a pathway direction, or the case of "Whats going to leave a better shadow?". But only use this if you got memory to spare, it only lasts a second, and most people will not noticed the dynamic shadow much if they are running by it,

Again, something simple and easy to do. I do think the pictures help as they save text, and keep people in understanding. Ha, I can't wait to talk about the Conversion Cubed stuff, and what I had to fight with.

No comments:

Post a Comment