Game Development Community

Big Update

by Brian Ramage · in Torque Game Engine Advanced · 07/20/2005 (5:55 pm) · 31 replies

I just checked in a pretty major update that covers many areas. First off, I'd like to warn you:

THIS UPDATE WILL BREAK YOUR CURRENT MATERIALS, SHADERDATA, and CUBEMAPDATA.

Not by a whole lot though ;)

Here's the short list of changes:

Merged latest updates from other TSE projects / products.
Fixed several bugs and memory leaks.
Materials, ShaderData, and CubemapData are no longer dataBlocks (they are client-side only).
materials.cs files auto-loaded.
addMaterialMapping() is no longer needed.
Textures and Materials can be reloaded on-the-fly without restarting TSE.
Materials now in MaterialSet.


More detail:
- materials, shaderData, and cubemaps are all loaded client side now. They are exec'd from client/init.cs. At the moment, it loads up all the material textures when init is called. This will change in the future such that all materials are loaded, but textures are only loaded as needed per level, and unloaded when the mission shuts down.

- materials.cs files are now loaded automatically from any data or script directory. This allows many materials.cs files and they can live in the same directories as the data. Ie. you can place a materials.cs file in the SpaceOrc directory that contains the material definitions for the orc's textures. This has been done in the demos, so review them for further detail.

- Load order on materials.cs files cannot be assumed - it does not execute from top level directories downward. This means common data to be used across multiple materials.cs files (such as ShaderData and cubemaps) needs to be exec'd before the materials. Loading occurs in client/init.cs

- Full paths are no longer needed (but still supported) for textures referenced in Material definitions. This is true only if the textures are located in the same directory as the materials.cs file referencing them. This allows moving art data around in different directories without having to change the materials.cs files.

- addMaterialMapping() calls are no longer needed. You can map Materials to textures from within the Material definition itself now. This is done with the "mapTo" parameter. Note - specifying the mapTo parameter is not necessary if the baseTex[0] texture name is identical to the texture you want to map the Material to. All CustomMaterials are required to have a mapTo parameter. The addMaterialMapping() call still works, so it won't break anything in your current data, but it is no longer necessary.

- Textures and Materials can now be reloaded on the fly without restarting TSE. This is done via the reloadTextures() and reloadMaterials() script functions. The reloadTextures() function is defined in code (gfxTextureManager), and reloadMaterials is a pure script function located in client/init.cs. Note that reloadMaterials() calls reloadTextures(), so if you want one function that does it all, that's the one. When executing these functions, you will get a console message indicating which files it has recognized as changed and reloaded.

- Materials are now all a part of SimSet MaterialSet

- Materials reload like dataBlocks. You can exec a materials.cs script and it will add any new materials, and reload existing ones.
Page«First 1 2 Next»
#21
07/27/2005 (12:36 pm)
Is there any way to list the exact steps that need to be taken to use this new update? I would like to have the newest changes but have yet to get exact directions on what would need to be changed from a previous version to get this working.
#22
07/27/2005 (3:13 pm)
@Kip I would suggest using WinMerge and merge the new update into your base.
To make things easier i mark modified code so that you dont overwrite your own code by accident.

also i would only outcomment stuff that was there before you modified it so you can see if there might be changes to the original stuff as well.

// BEGIN: Modified for AiM

// new code is written here

// END: Modified for AiM

// BEGIN: Backup /*

// a backup of original HEAD code is kept here

// END: Backup */

this way you can easily track down changes and modify your code according to it
#23
07/29/2005 (7:10 am)
Made the update and I cant get the editors to work and i get several warnings that I am not sure what they are for. The regular demo application gets the same type of errrors. Here is the first error i get:

Missing file: common/ui/windowsDefaultProfiles.cs!

Dont know if this is the cause of some later issues with the video resolution not being able to be changed or the bit res either.

Missing file: common/ui/NetGraphGui.gui!

Think this is suppose to be for your guys netgraph utility but I think this error has always been there.

Missing file: terrain_water_demo/server/scripts/shaders.cs!
terrain_water_demo/server/scripts/materials.cs (0): Unable to instantiate non-datablock class CubemapData.
terrain_water_demo/server/scripts/materials.cs (0): Unable to instantiate non-datablock class CubemapData.
terrain_water_demo/server/scripts/materials.cs (0): Unable to instantiate non-datablock class CustomMaterial.
...etc.

I get a whole lot of those bottom three lines and it seems even your guys demo gets them. I dont know if this is a leftover of the materialmap.cs file or not. Is there a way to fix this so it doesnt try to load it. If the demo worked i could look at that and figure it out, but it doesnt.

Loading compiled script terrain_water_demo/server/scripts/crossbow.cs.
Warning: (c:\tse\engine\console\consoleobject.cpp @ 62) Couldn't find class rep for dynamic class: SplashData
terrain_water_demo/server/scripts/crossbow.cs (0): Unable to instantiate non-conobject class SplashData.
ParticleEmitterData(CrossbowBoltEmitter) velocityVariance > ejectionVelocity
Error: shape terrain_water_demo/data/shapes/crossbow/ammo.dts-collision detail 0 (Collision-3) bounds box invalid!

Ive seen this stuff before but i think it has to do with compatiblity between the TGE crossbow and the TSE version. Dont know why there is the consoleobject error though???

*** Phase 2: Download Ghost Objects
Mapping string: MissionStartPhase2Ack to index: 1
material unmapped: ROOF_17
material unmapped: INT_WALL_01
material unmapped: INT_WALL_06
material unmapped: FLOOR_20
material unmapped: STAIR_02
material unmapped: ROOF_17
material unmapped: INT_WALL_01
material unmapped: INT_WALL_06
material unmapped: FLOOR_20
material unmapped: WALL_06
material unmapped: INT_WALL_01
material unmapped: INT_WALL_06
material unmapped: ROOF_17
material unmapped: FLOOR_20
material unmapped: STAIR_02
material unmapped: WINDOW_17
material unmapped: INT_WALL_01
material unmapped: INT_WALL_06
material unmapped: ROOF_17
material unmapped: FLOOR_20
material unmapped: WALL_06

I get this error as well. I think this is because the materialMap.cs is getting executed differently know but i dont know where or what format to put the new materials in.

Thats it for the errors that are in the console.log file. I still dont have access to the editors. when i hit the button to get in my screen just stops moving until i hit a button. Then i go right back to regular game play. I dont know what needs to be done to get that to work correctly. If anyone could help me out on this stuff that would be great.

Thanks!
#24
08/01/2005 (6:15 pm)
@Kipp - Do you have any problems with a clean download of the CVS head? It looks like the problems you are seeing are the result of a bad merge.
#25
08/02/2005 (6:16 am)
No I dont really see the material errors. Several errors about some particles for foot puffs and crossbow bounding boxes.

I figured it was some kind of merge error. I just need to know what i need to change to get my materials working again and the errors to go away. Like what is the procedure to add a new material now since matieralmap.cs isnt used (or is it?).
#26
08/02/2005 (6:54 am)
The new system looks into your shape and dif folders for a file called "materials.cs"
there you have all material datablocks. you dont need to bind the materials anymore

i suggest you might wanna have a look into the example folder.

as for the editors: i realised that the old editors as in /common/editor/ arent used anymore but rather a new mod called creator.
you need to add the creator mod by calling "exec(creator/main.cs" from your main.cs ... dont forget to add the resource paths.

this is all i did to implement the new editors to a minApp

setModPaths("<yourgamehere>;creator");
exec("creator/main.cs");
#27
08/03/2005 (12:23 pm)
The new example/main.cs essentially does that already:

// DO NOT Run the Torque Creator mod if a dedicated server.
// Note: this fails if -dedicated not first parameter.
if( !( $Game::argc > 1 && $Game::argv[1] $= "-dedicated" ) || $platform !$= "xenon" || $platform !$= "xbox" )
{
   $modcount++;
   $userMods = "creator;" @ $userMods;
}
#28
08/04/2005 (6:51 am)
Ok i dont know what i did but the creator works now. I think that i might not of got the creator folder update(forgot to check the create missing directories box).

Now that i have that i have fixed the materials. I deleted the Materialmap.cs file and copied all my datablocks for my textures from it to a new materials.cs in my interiors folder where the building was that needed them. After i did this all my errors for the texture stuff went away. BTW you have to chance the datablock Material() to new Material(). I did notice that you dont have to have th map_to function. Is this because baseTex[0] is the texture. If that is the case why even have the field?

Also, I notice James posted a thing above for when you start a new project. I ran into the problem as well. I tried to make it dynamic by putting "*/data/missions/simplemission.mis" but that wont work. Can this be made dynamic some how since you wont likely be getting your missions from another exe directory?
#29
08/04/2005 (4:45 pm)
Quote:
addMaterialMapping() calls are no longer needed. You can map Materials to textures from within the Material definition itself now. This is done with the "mapTo" parameter. Note - specifying the mapTo parameter is not necessary if the baseTex[0] texture name is identical to the texture you want to map the Material to. All CustomMaterials are required to have a mapTo parameter. The addMaterialMapping() call still works, so it won't break anything in your current data, but it is no longer necessary.

The mapTo field is there if you want to map the baseTex to a different texture name referenced in a mesh or interior. Like it says above, it's also required for CustomMaterials.
#30
08/09/2005 (9:25 pm)
Just got this merged into my source base. Very nice! Mission load times are back down now that they're not datablocks. I did find a little bug that I'll try and look into this week if I can get to it:

reloadMaterials() doesn't reset deleted parameters to their defaults. For example, if I have a texture with animFlags set, and I delete the param and reloadMaterials(), it will retain the animFlags. To remove it at runtime, you have to set animFlags to 0.
#31
08/11/2005 (4:22 pm)
@James - yeah I saw that too, I'll have to see how to clear that in script.
Page«First 1 2 Next»