Game Development Community

Help with rain

by Brian Lyon · in Torque Game Engine · 07/28/2004 (11:31 pm) · 9 replies

I need some help setting up rain im useing starter.fps i used a tutorial that i found in the resource on gg (forgot the name) to try and add rain , it didnt include an image for rain so i just copyed the images from the torque demo when i launch the game it just has a bunch of white boxes despite the help of the people in the irc chat room i stil cant get it to work
here is my weather.cs:


datablock AudioProfile(HeavyRainSound)
{
   filename    = "~/data/sound/environment/ambient/rain.ogg";
   description = AudioLooping2d;
};

datablock PrecipitationData(HeavyRain)
{ 
   type = 1; 
   materialList = "~/data/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; 
};
and my mission rain datablock:
new Precipitation(HeavyRain) {
      position = "0 0 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      dataBlock = "heavyRain";
      minSpeed = "0";
      maxSpeed = "0";
      minMass = "0.75";
      maxMass = "0.85";
      maxTurbulence = "0.1";
      turbulenceSpeed = "0.2";
      rotateWithCamVel = "1";
      useTurbulence = "0";
      numDrops = "500";
      boxWidth = "100";
      boxHeight = "100";
      doCollision = "1";
         color3 = "-1.000000 0.000000 0.000000 1.000000";
         offsetSpeed = "0.25";
         percentage = "0.5";
         minVelocity = "0.25";
         color1 = "0.600000 0.600000 0.600000 0.500000";
         locked = "true";
         maxVelocity = "1.5";
         maxNumDrops = "2000";
         color2 = "-1.000000 0.000000 0.000000 1.000000";
         MaxRadius = "125";
   };
and for my image i am useing rain.jpg and rain.alpha.jpg from the torque demo
please help me

#1
07/29/2004 (4:01 am)
If you have head version you must change
precipitationdata, the old data blocks is not working and the new code dont use dml.
thats why you get whiteboxes.
#2
07/29/2004 (4:31 am)
//try this in the mission
new Precipitation(Precipitation) {
position = "211.044 -96.3923 229.796";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "HeavyRain";
minSpeed = "1.5";
maxSpeed = "2";
minMass = "0.75";
maxMass = "0.85";
maxTurbulence = "0.1";
turbulenceSpeed = "0.2";
rotateWithCamVel = "1";
useTurbulence = "0";
numDrops = "5000";
boxWidth = "200";
boxHeight = "100";
doCollision = "1";
MaxRadius = "12";
percentage = "0.5";
offsetSpeed = "0.25";
color3 = "-1.000000 0.000000 0.000000 1.000000";
locked = "true";
color2 = "-1.000000 0.000000 0.000000 1.000000";
maxNumDrops = "2000";
color1 = "0.600000 0.600000 0.600000 0.500000";
maxVelocity = "1.5";
minVelocity = "0.25";
};





this happened to me too
#3
07/29/2004 (4:35 am)
Im using this function for heavy rain

function startRain()
{
if (!isObject($Rain))
$Rain = new Precipitation() {
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 = "0.25";
maxVelocity = "1.5";
maxNumDrops = "3000";
maxRadius = "10";
locked = "false";
};
}
#4
07/29/2004 (10:00 am)
I pasted this in but now theres no rain not even white boxes
#5
07/29/2004 (10:38 am)
Yeah, ive been having problems too. any chance someone who knows what they are doing be able to write a quick walkthrough? what exactly needs to be in place where?
#6
07/29/2004 (10:43 am)
I just merged with heads new rain code today, and pieced together these scripts. Everything works great.
datablock AudioProfile(HeavyRainSound)
{
   filename    = "~/data/sound/environmental/rain.ogg";
   description = AudioLooping2d;
};

datablock PrecipitationData(HeavyRain)
{
   soundProfile = "HeavyRainSound";

   dropTexture = "~/data/environment/rain";
   splashTexture = "~/data/environment/water_splash";
   dropSize = 0.75;
   splashSize = 0.2;
   useTrueBillboards = false;
   splashMS = 250;
};

function startHeavyRain()
{
   if (!isObject($Rain))
      $Rain = new Precipitation() {
         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 = "4";
         maxVelocity = "5";
         maxNumDrops = "6000";
         maxRadius = "20";
         locked = "false";
      };
}

function stopRain()
{
   $Rain.delete();
}

Make sure you also grab the textures and sounds from /demo
#7
07/29/2004 (10:58 am)
Wow it works now if i could only get the frame rate above 6
#8
07/29/2004 (1:59 pm)
Fantastic, thanks a bunch!
#9
07/29/2004 (3:54 pm)
Nvm i fixed the frame rate just had to tweak the # of drops next im gonna add a boat a jetpack and some foliage