Game Development Community

Trying to use precipitation and lightning (makes me crash)

by St. Ad. · in Torque Game Engine · 10/21/2003 (1:27 am) · 16 replies

Greetings,

im trying to use the precipitation and lightning from the demo
and Adding Environmental Effects to Torque

i did add the datablocks 'exec' onServerCreated (filespaths are correct)

// Load up all datablocks, objects etc.  This function is called when
	// a server is constructed.
	exec("base/datablocks.cs");

datablock AudioProfile(HeavyRainSound)
{
	filename	 = "base/audio/rain.ogg";
	description = AudioLooping2d;
};

datablock AudioProfile(ThunderCrash1Sound)
{
	filename  = "base/audio/thunder1.ogg";
	description = Audio2d;
};

datablock AudioProfile(ThunderCrash2Sound)
{
	filename  = "base/audio/thunder2.ogg";
	description = Audio2d;
};

datablock AudioProfile(ThunderCrash3Sound)
{
	filename  = "base/audio/thunder3.ogg";
	description = Audio2d;
};

datablock AudioProfile(ThunderCrash4Sound)
{
	filename  = "base/audio/thunder4.ogg";
	description = Audio2d;
};

datablock LightningData(LightningStorm)
{
	strikeTextures[0]  = "base/environment/lightning.dml";

	//strikeSound = LightningHitSound;
	thunderSounds[0] = ThunderCrash1Sound;
	thunderSounds[1] = ThunderCrash2Sound;
	thunderSounds[2] = ThunderCrash3Sound;
	thunderSounds[3] = ThunderCrash4Sound;
};

datablock PrecipitationData(HeavyRain)
{ 
	type = 1; 
	materialList = "base/environment/rain.dml";
	soundProfile = "HeavyRainSound";					  
	sizeX = 0.1; 
	sizeY = 0.1; 

	movingBoxPer = 0.35; 
	divHeightVal = 1.5; 
	sizeBigBox = 1; 
	topBoxSpeed = 20; 
	frontBoxSpeed = 30; 
	topBoxDrawPer = 0.5; 
	bottomDrawHeight = 40; 
	skipIfPer = -0.3; 
	bottomSpeedPer = 1.0; 
	frontSpeedPer = 1.5; 
	frontRadiusPer = 0.5; 
};

i did add them to the .mis file (at last, matters?)

new Precipitation()
	{
		position = "0 0 0";
		rotation = "1 0 0 0";
		scale = "1 1 1";
		datablock = "HeavyRain";
		percentage = "1";
		color1 = "0.700000 0.700000 0.700000 1"; 
		color2 = "-1.000000 0.000000 0.000000 1.000000"; 
		color3 = "-1.000000 0.000000 0.000000 1.000000";
		offsetSpeed = "0"; 
		minVelocity = "2"; 
		maxVelocity = "3"; 
		maxNumDrops = "3000"; 
		maxRadius = "10"; 
		locked = "true"; 
	};

	new Lightning()
	{
		position = "200 100 300";
		rotation = "1 0 0 0";
		scale = "250 400 500";
		datablock = "LightningStorm";
		strikesPerMinute = "20";
		strikeWidth = "2.5";
		chanceToHitTarget = "100";
		strikeRadius = "50";
		boltStartRadius = "20";
		color = "1.000000 1.000000 1.000000 1.000000";
		fadeColor = "0.100000 0.100000 1.000000 1.000000";
		useFog = "1";
		locked = "true";
	};

however now, i get a crash when %client.transmitDataBlocks($missionSequence);

debuger complains on this line :
//in bitmapExtrudeRGBA_c()

// 1st line of the for
*dst++ = (U32(*src) + U32(src[4]) + U32(src[stride]) + U32(src[stride+4]) + 2) >> 2;

does the client need to 'exec' the datablocks too ???
in this case the client and server and the same (singleplayer)

thanks for any help

About the author

Recent Threads


#1
10/21/2003 (2:21 am)
I get the same problem look here, Chris posted fixed .h & .cc files :-), still hasn't been added to HEAD thou I believe :-/.

Here www.garagegames.com/mg/forums/result.thread.php?qt=13125
#2
10/21/2003 (5:04 am)
:'(

replaced the files, recompiled, still same error :|
im using Release_1_2_0

if i remove the precipitation (but leave the lightning)
still same error, and same goes for vice versa ..

\me confused
#3
10/21/2003 (7:52 am)
Did you do a clean recompile?
#4
10/21/2003 (8:18 am)
Yes

am i the only one having this problem ? (with code patch)
#5
10/21/2003 (10:10 am)
I donno. I bought the SDK a while back ago, and havent really touched it after seeing the horror stories with using it :(
#6
10/21/2003 (11:12 am)
Share some of the horror stories if you can please. i would love to hear them.
#7
10/21/2003 (11:15 am)
Have you tried just the rain by itself (or just lightning), and use the sample textures provided? Your error appears to be related to the format of the images used.

As posted in the other thread, I have this working now (I didn't before the updated files). I used the sample lightning PNG files given on the tutorial website. I download a few wav files (found using google) - I don't think they're your problem though.

-Ner
#8
10/22/2003 (12:08 am)
@ Nerseus :
i used the demo lightning/precipitation images and sound,
ill try to change the ogg to wav ..its an idea
#9
10/22/2003 (4:14 am)
Alright, rain does work :)
and lightning too ! thanks nerseus u were right the png were to blame
however i cannot find any i can use
and most surprising this is how my datablock looks like now :

datablock LightningData(LightningStorm)
{
// strikeTextures[0] = "base/environment/lightning.dml";

// strikeSound = LightningHitSound;
   thunderSounds[0] = ThunderCrash1Sound;
   thunderSounds[1] = ThunderCrash2Sound;
   thunderSounds[2] = ThunderCrash3Sound;
   thunderSounds[3] = ThunderCrash4Sound;
};

i though that was a way to test (if i heard it, sound is ok etc .)
but at my big surprise the visual side is working ??! (wtf)

nyway i wont complain ...but admit its odd
#10
10/22/2003 (10:37 am)
Note that your png's must be sized to a power of 2 (maybe more restrictive depending on your card). If your textures are 80x120, for instance, you'll have problems (I generally get an effect to show up, but the textures are pure white). You can expand/shrink the image in your favorite editor to the right size. A better idea is to expand/shrink the canvas and leave the image the same size (with some extra part of the image left blank).

I can't say anything useful about sounds at this point :)

-Nerseus
#11
05/26/2004 (1:31 pm)
Managed to get this working too, using a get-latest around the 21st of May. The rain textures work, which is great.

I'm not sure about the lightning. Leave in the "strikeTextures" or take them out, they don't seem to be used. The lightning is large rectangles which spear down in lightning-shapes from the sky.. a little funny looking if they hit your chr. Are they meant to take on the lightning-strike textures? At any rate, they look like they do in the demo.

Oh, one question: Somewhat confusingly I would always get the error:

could not locate texture ~/data/maps/lightning.dml

Mind you, just as stated above, you can take OUT the line

strikeTextures[0] = "~/data/maps/lightning.dml";

and lightning will still work. Why would it look for textures it doesn't use? My lightning.dml was:

lightning1frame1
lightning1frame2
lightning1frame3

which were 128x128 PNGs located in the same dir. as the lightning.dml file.

I.. cannot shake the feeling it was meant to, or wants to, use those lightning textures for something.. else why bother looking?
#12
05/31/2004 (12:36 pm)
I fixed this by calling a startRain() function like they did in the demo and it works fine. Putting it in the mission file crashes every time.
As I see it there are 2 choices here, if it's in the mission file it's always going to rain is this correct? and if it's not and you call a function to make it rain you have more flexibility for random weather effects.

I would like to know what some of the parameters do. Check that, I would like to know what ALL the parameters affect. I noticed in the engine comments about "JohnA Will remove" so do we count on those "tweak" parameters in the engine or are they going away?
#13
06/02/2004 (1:24 pm)
Howard,

Documenting the precipitation datablock fields is pretty difficult. There's admittedly some cruft and hard to read code in there.

For now, there is no complete guide to the precipitation parameters. This is because rather than documenting the stuff in there that is difficult to use and understand, we may be updating it. We have some interns in the office this year, and hopefully we will get a chance to take a pass at improving this code.

That said, if anybody out there does have a thorough guide to precipitation parameters, please share. :) It would be nice to have something up in the mean time.

Sorry not to have a more helpful answer for your immediate concerns, Howard. We are aware that this is something that needs attention, though.
#14
12/25/2006 (11:15 am)
Can someone post a link to the lightning.dml file please. i found it on a website but it cant find the page where the link is located. as i type this though i notice the date of the last response and realise this is a dead topic.

hopefully someone will spot this and take pity considering its christmas day.

Merry Christmas to all and to all a good night.
#15
12/25/2006 (11:33 am)
If you have the sdk, they are in the data folder. If not, Ken Finneys book has them. Aside from these two, I don't know. They may be in the data folder for the demo. Look in demo/data/environment
Hope that helps a little.
#16
12/25/2006 (11:47 am)
Lightning DML Creation:

Let's say you have 3 lightning frames (lightning1Frame1.jpg, lightning1Frame2.jpg, lightning1Frame3.jpg).
Open notepad and type the following:
lightning1frame1
lightning1frame2
lightning1frame3
Save the file as lightning.dml.

Put the new dml in the same folder as your assets (lightningFrame files).

Done. . .

Merry Christmas All.