Game Development Community

Adding water

by Carter Patterson · in Torque Game Engine · 07/01/2008 (1:21 pm) · 9 replies

Hi, I was wondering if anyone can tell me how to add water to levels.

About the author

I like to make levels for games, and I like to make games that I want to play. For me, game's aren't about having the greatest next gen graphics, it's about having fun, and I make sure all my work shows that. (of course good graphics never hurt :P )


#1
07/01/2008 (1:51 pm)
Add this to the .mis file of the level you want water in:

new WaterBlock() 
{
         position = 0 0 0";
         rotation = "1 0 0 0";
         scale = "512 768 10";
         UseDepthMask = "true";
         surfaceTexture = "~/data/water/water";
         ShoreTexture = "~/data/water/wateredge";
         envMapOverTexture = "~/data/skies/storm_0007";
         specularMaskTex = "~/data/water/specmask";
         liquidType = "OceanWater";
         density = "1";
         viscosity = "15";
         waveMagnitude = "1";
         surfaceOpacity = "0.75";
         envMapIntensity = "0.1";
         TessSurface = "50";
         TessShore = "60";
         SurfaceParallax = "0.5";
         FlowAngle = "220";
         FlowRate = "0.2";
         DistortGridScale = "0.1";
         DistortMag = "0.05";
         DistortTime = "0.5";
         ShoreDepth = "4";
         DepthGradient = "1";
         MinAlpha = "0.03";
         MaxAlpha = "1";
         removeWetEdges = "0";
         specularColor = "1.000000 0.800000 0.200000 1.000000";
         specularPower = "10";
};

Just make sure that all the files that are referenced in the block are present.
#2
07/01/2008 (2:51 pm)
Or go to the mission editor (F11), switch to the World Editor Creator (F4), expand "Mission Objects >> Environments", and select "Water". Up comes a dialog to set the water's properties. Hit OK to create the water block.
#3
07/01/2008 (3:31 pm)
I could not make the waterBlock work throught the editor though, have to add it by hand to the mission file.
#4
07/01/2008 (3:59 pm)
I tried it through the mission editor, it works, but it looks too clear.
#5
07/02/2008 (6:17 pm)
@Carter,

Adjust the parameters in the mission editor to get the waterBlock to what you want in to look like. To change how clear the water is, adjust the surfaceOpacity parameter. More opaque water, like you would want, would need a value close to one or one.
#6
07/02/2008 (6:49 pm)
Torque is simply an awesome game creation tool.
#7
07/16/2008 (1:16 pm)
I too am having trouble adding water using the world editor. Every time I add water its completely invisible but If I walk through it I can see a splash and If I walk in it I can see the underwater effect. Why would the default water parameters (as applied through the gui) appear this way? It really doesn't make any sense at all that I would have to hand code water parameters to get something that looks like water to show up.
#8
07/16/2008 (1:23 pm)
@Kory,
It sounds like your waterblock does not know where your surface texture is. Go to the mission inspector, then click on the waterblock. Then change your surface texture to the correct location.
#9
07/17/2008 (1:15 am)
@J.P.,

It seems to work (I can see the surface water texture) if I reload the mission, does that sound right?