Game Development Community

TGEA crashes when creating a water block.

by Rick Austinson · in Torque Game Engine Advanced · 05/19/2009 (12:51 am) · 7 replies

Yes, I know this one is in the list of known bugs. I attempted the fix, it didn't work, I want to know if I did it right. The instructions said to add the code to materials.cs, I added it to the end using notepad and hit 'save', is there more to it than that?

Thank you in advance for any aide you can give me.

#1
05/19/2009 (1:14 am)
I do not believe the location of the CustomMaterial definition is at matter, as long as it follow the right path "game/scriptsAndAssets/data/water/materials.cs"

Check that you have copy/ past exactly as it shows, (be sure you did not include the "#" signs, as that is a product of the webpage- a bug as i see it and hope soon to be fixed).


#2
05/19/2009 (10:11 am)
I double-checked, but since I am terrible with code, let me paste it here:

new CustomMaterial( Water_NoReflect )
{
texture[0] = "noise02";
texture[2] = "$backbuff";
texture[3] = "$fog";
texture[4] = "$cubemap";
cubemap = Sky_Day_Blur02;
shader = WaterCubeNoReflect;
specular = "0.75 0.75 0.75 1.0";
specularPower = 48.0;
fallback = WaterFallback1_1;
version = 2.0;
};

This is correct, yes? No # signs, right? Is there anything else that has to be done?
#3
05/19/2009 (2:11 pm)
That is the way it should look. How are you adding it to the mission? What type of crash? What is the last few lines of your \game\console.log?
#4
05/19/2009 (3:52 pm)
Well I'm unsure how much of the log you need to see, but this bit here looks important:

--- Resetting D3D Device ---
Mapping string: ToggleCamera to index: 3
Set::remove: Object "2288" does not exist in set
Set::remove: Object "2292" does not exist in set
Tried to get the object for item 85, which is not InspectorData!
Tried to get the object for item 85, which is not InspectorData!
Namespace::unlinkClass - cannot unlink namespace parent linkage for Water for CustomMaterial.

That's the tail-end of things. Look like the culprit?
#5
05/19/2009 (4:23 pm)
Hmm, seek folder: scriptsAndAssetsdatamissions

Find your missionfilename.mis
(make a backup copy)

And right before the very last }; place:

new WaterBlock(bloops) {
         canSaveDynamicFields = "1";
         Enabled = "1";
         position = "852.978 1353.29 99.262";
         rotation = "1 0 0 0";
         scale = "500 500 100";
         waveDir[0] = "0 1";
         waveDir[1] = "0.707 0.707";
         waveDir[2] = "0.5 0.86";
         waveSpeed[0] = "-0.065";
         waveSpeed[1] = "0.09";
         waveSpeed[2] = "0.04";
         waveTexScale[0] = "7.14 7.14";
         waveTexScale[1] = "6.25 12.5";
         waveTexScale[2] = "50 50";
         density = "20";
         viscosity = "4";
         reflectTexSize = "512";
         baseColor = "5 12 22 153";
         underwaterColor = "11 31 46 190";
         gridSize = "100";
         surfMaterial[0] = "Water";
         surfMaterial[1] = "Underwater";
         surfMaterial[2] = "Water1_1FogPass";
         surfMaterial[3] = "WaterBlendMat";
         surfMaterial[4] = "Water_NoReflect";
         fullReflect = "1";
         clarity = "0.15";
         fresnelBias = "0.12";
         fresnelPower = "6";
         visibilityDepth = "10";
         renderFogMesh = "1";
      };

Now if your mission crash on load you have a problem with game/scriptsAndAssets/data/water/materials.cs or someplace else. First try to restore an original /water/materials.cs and reapply the 'fix', and if that do not work we will need to reexamine gameconsole.log.


#6
05/19/2009 (6:22 pm)
Well,that seems to have done the trick, thank you so much for your help! I'm glad we were ale to resolve this.

S&G
Rick
#7
05/19/2009 (6:32 pm)
Hurray!