Game Development Community

Weather Effects

by Simon Rushton · in Torque Game Engine · 01/19/2005 (3:41 am) · 1 replies

I followed tutorials including a detalied ADDING ENVIRONMENTAL EFFECTS tutorial but nothing seems to work.

I am running TORQUE 1.3

Are mission files ( .mis ) ??????

The mission files also seem to be very temperemental.

What am i doin wrong with this tutorial...

Step 1. With your text editor, make a file named something like "weather.cs" with the following:

//-------------- Sound for Rain -------------------------------------
datablock AudioProfile(Universal_Rain_Light_1)
{
filename = "~/data/sound/fx/environment/rain_light_1.wav";
description = AudioLooping2d;
};
//the description is already defined in ~/fps/server/scripts/audioprofiles.cs
//
//-------------------- RAIN -----------------------------------------
datablock PrecipitationData(Rain)
{
type = 1;
materialList = "~/data/fx/precipitation/raindrops.dml";
soundProfile = "Universal_Rain_Light_1";
sizeX = 0.10;
sizeY = 0.10;

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;
};

Save the file to the "/fps/server/scripts" directory.

Step 2. In the directories specified by the "materialList" parameter, create a file named "raindrops.dml" (or whatever name you would like as long as it matches the "textureList" parameter). In this file, list the name(s) of the PNG image(s) to be used. For my rain effect, I used just one 256x256 PNG with alpha channel--basically just some random pixels painted grey with the background transparent--and placed it in the same directory as the dml file. So the dml file in this case simply has the following line:

raindrops

Step 3. In "/fps/server/scripts/game.cs", add the execute line as shown below to initialize the weather effects; (add the line for lightning effects while you're here):

function createGame()
{
// Load up all datablocks, objects etc. This function is called when
// a server is constructed.
exec("./audioProfiles.cs");
exec("./camera.cs");
exec("./markers.cs");
exec("./inventory.cs");
exec("./shapeBase.cs");
exec("./item.cs");
exec("./health.cs");
exec("./weapon.cs");
exec("./radiusDamage.cs");
exec("./rifle.cs");
exec("./crossbow.cs");
exec("./weather.cs"); //df: add for rain/snow effects
exec("./lightning.cs"); //df: add for random lightning effects
exec("./player.cs");

// Keep track of when the game started
$Game::StartTime = $Sim::Time;
}

Step 4. To make the rain or snow effect to take place, add the following section to your mission file:

new Precipitation(Precipitation) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "Rain";
percentage = "0.5";
color1 = "0.600000 0.600000 0.600000 0.500000";
color2 = "-1.000000 0.000000 0.000000 1.000000";
color3 = "-1.000000 0.000000 0.000000 1.000000";
offsetSpeed = "0.25";
minVelocity = "0.25";
maxVelocity = "1.5";
maxNumDrops = "2000";
maxRadius = "125";
locked = "true";
};

#1
01/19/2005 (8:09 am)
There are so many threads about this , here is one
Click here