Game Development Community

Lightning Rant

by Scott Schaefer · in Torque Game Engine · 01/18/2002 (2:22 pm) · 98 replies

Ok, I can tell by the lack of replies to my previous post on texturing lightning (which is not crucial to my existence :) that few if any of us has actually gotten the lightning to texture. I know this is not that important to gameplay quality right now, I just want to "customize" my lightning so that all of our TGE games that have lightning in them don't have the same exact lightning (like we do now :). Problem is, either i've wandered too far from the short bus or most of the options change little or nothing. Here is the script and the symbol "<-----" denotes options that have me scratching my waterhead:


new Lightning() {
position = "0 0 200";
rotation = "1 0 0 0";
scale = "624 688 500"; <----scales what?
dataBlock = "DefaultStorm";
strikesPerMinute = "5"; ---->this works fine
strikeWidth = "2.5";<----does nothing?
chanceToHitTarget = "100";<----huh?
strikeRadius = "50";<----does nothing?
boltStartRadius = "20";<----does nothing?
color = "1.000000 1.000000 1.000000 1.000000";
fadeColor = "0.100000 0.100000 1.000000 1.000000";
useFog = "1";<----how does it use fog?
locked = "true";<----locks what?

ONE MORE QUESTION:
How hard do u guys think it would be to make the lightning "light up" the section of the map where it strikes with bright flashes? This would add exiting realism to any stormy level.

Sorry for the extensive post but i am currenly working on a map that will utilize thunderstorms to bring out the drama :)

Thanks, guys...

Scott
Page«First 1 2 3 4 5 Next»
#81
02/16/2002 (10:57 pm)
Xavier
It works pretty well except for the missing textures and what you mentioned about the crashing if no dml is specified.
#82
02/17/2002 (5:52 am)
what missing textures lucas?
you mean the ones i didnt include in the zip file? (that's cause its tribes 2 copyright sorry)
#83
02/17/2002 (10:58 am)
No, the missing (or messed up) textures in the lightning streaks...like this screenshot, the second screenshot doesn't have any missing textures because the else statement was taken out.
#84
02/17/2002 (12:30 pm)
LOL!! i didnt noticed that bug.. my lightnings fade out too fast.. i couldnt see that :)
any way to make them stay a lil longer?
Btw, what else statement are we talking about?
#85
02/17/2002 (2:57 pm)
Yeah, in the Lightning::processEvent() at about line 712, there are the lines:
pStrike->bolt[i].lifetime = 1.0;
pStrike->bolt[i].fadetime = 0.2;
Just change those to higher numbers, something like 40.0 is good.

The else statement needs to be taken out to fix this, it was in my previous post for fixes, which basically says to take out the:
else
{
  continue;
}
in the LightningBolt::renderSegment() function.
#86
02/17/2002 (3:18 pm)
ok thanks... that gave me an idea... ill try to implement a way to set the fade time from outside the code... from the mission file for example
#87
02/17/2002 (3:54 pm)
Ok... it has been done :)
I now set my LifeTime and FadeTime from within my mission file, ill post a link to my src code soon.
#88
02/27/2002 (7:23 am)
Below are the code changes required in lightning.cc to prevent the lightning from going through an InteriorObjectType and other object types. Since I have modified the code so much, I can not give you the exact line numbers for the below changes. I will break it down by steps so you can make the modifications:
1) Locate the function LightningBolt::createSplit

	2) Inside the function locate the line that reads:

		if( width < 0.75 ) width = 0.75;

	3) After the above line add the following code:

		RayInfo rayInfo; 
		if (gClientContainer.castRay(startPoint, endPoint, 
                                            (STATIC_COLLISION_MASK | WaterObjectType), 
                                            &rayInfo)) 
		   { 
		   endPoint = rayInfo.point; 
		   }
By adding the above code, all of the major and minor nodes will be checked to make sure they do not go through either: TerrainObjectType, InteriorObjectType, ForceFieldObjectType, StaticObjectType or WaterObjectType.

Rich
#89
02/27/2002 (9:03 am)
what about portals?

they stop the lightning ..
what are the cause and effect of not going thru other object types?
will it still be able to "hit and destroy"?
...
#90
02/27/2002 (10:34 am)
@Badguy,

Quote:
what about portals?

they stop the lightning ..

From my diagnosis of the code (sceneObject.cc function Container::castRay), the bounding box is the key and not the portals. I asked Desmond to verify this by testing it with a car port he created.

Quote:
what are the cause and effect of not going thru other object types?

I am not sure that I understand the question, but I will give it a try. The original lightning code was only checking collision against the 3 main bolts. If any part of these bolts hit either: TerrainObjectType, InteriorObjectType, ForceFieldObjectType, StaticObjectType or WaterObjectType, the bolt was stopped. Since the major and minor nodes (the bolts that come of the main bolts) where not being checked for collision, I added the same logic.

Quote:
will it still be able to "hit and destroy"?

I did not get a chance to work on the lightning damage code yet. I have taken a quick look at it and I think there are going to be coding changes in both the source and scripts to get it to function correctly.

Rich
#91
02/27/2002 (11:19 am)
hmm on my end the lightning will pass thru the building
if there is no portal there
#92
02/27/2002 (11:21 am)
I'll email Desmond and ask him how he created the car port.

Rich
#93
02/27/2002 (6:46 pm)
With Richard's code, the lightning will stop at a dif object without portals; but, if there's an opening like a door or open sides like aroudn a carport, some of the minor nodes can find their way around (sneaky). Now, I will say that I didn't perform an exhaustive test yet. But so far, it appears to be a great improvement.
#94
12/11/2002 (6:22 am)
Hi,

Can someone be kind enough to provide me the following wave files listed in previous posts (quite some time ago)

thunder1.wav
thunder2.wav
thunder3.wav
thunder4.wav

I have tried to search in Tribe2 but could not find either.

Regards,
JS
#95
12/11/2002 (6:49 am)
JS,

Assuming that you own a copy of Tribes2, unzip the file audio.vl2. You will find the below 4 files in the directory audio/fx/environment:

ctmelody1.WAV
ctmelody2.WAV
ctmelody3.WAV
ctmelody4.WAV

These are the 4 thunder#.wav files referenced above.

NOTE: These files where created by Creative Technology, Ltd., so you are going to have to check with them prior to redistributing them.

Rich
#96
12/12/2002 (6:05 am)
Thank you. I found them.
#97
05/26/2004 (7:39 pm)
Wow, great stuff!!

After I fixed precipitation/rain, I found this to fix the lightning.. I had the feeling at first it was meant to be that way, but you can see in the code it intended to use textures!

Anyway, just wanted to say THANKS a million to the folks who worked so hard to bring us this fix! May it appear in the HEAD swift!
#98
05/26/2004 (10:30 pm)
Yay! But you are 2 years late...
Page«First 1 2 3 4 5 Next»