From Torque to TSE
by Xavier "eXoDuS" Amado · 06/29/2004 (12:54 pm) · 23 comments
Porting from TGE to TSE can be a complicated task in some ways, specially if you consider the work of developing shaders, but for now, we'll concentrate on getting a torque game to run on tse without adding anything.
First step would be obviusly to compile TSE and copy the binary over to your game's directory. After you have done that if you try to run it, it will most likely crash on loading the mission. Many things can cause this, so I recommend using a debug build.
Before proceeding you will have to edit defaults.cs - and prefs.cs if it exists - and make sure you have these settings:
I've found out that the interiors in the Torque Demo don't work on TSE, and it has something to do with mip levels, so I just removed the interiors from the mission file.
Update:
Althought not needed, you can copy glowBuffer.cs from TSE to your game too, it's used for the glowing effects on lights, the 6th texture on the cube, etc.
I have ported starter.fps and that's all I had to take care of. Of course TSE is work in progress and it has many rarities. One that I've noticed is that items rotation seems to be off, but that should be an easy fix. Another issue is that when going in the gui editor the game seems to freeze but pressing any key/mouse button will refresh and get you in the editor, same for going out. You will notice that shaders seem off inside the gui editor if using a size different than your resolution though. Some things are missing from the TSE source too, like the healthbar, vehicles, and more stuff. If you have custom GUI objects you will have to update them to use the new GFXTextureHandle instead of the old TextureHandle, simple name change but big difference since you won't be using any dgl methods anymore to render, they are now fully API independant. Also, TSE seems to crash each time I quit for me, maybe it has something to do with a missing part in porting.
And a final note, they did the worse thing... they renamed .cc files to .cpp!!! ARGH!!!! Brian's fault I'm sure, he's on my black list!! :P (j/k Brian). I did like the .cc files better, but I'm a unix whore.
Just to back up GG's disclaimer, Torque Shader Engine is a work in progress and it's not meant for commercial use but to try and hammer on the next gen technology that GarageGames will be offering. If your game doesn't work out of the box, if TSE crashes for you, or if you just exepected TSE to be a magic game making receipt, forget it, you have been adviced. It's EARLY ADOPTERS version.
Hope you find this little tutorial useful, maybe It will save you a couple of minutes of head scratching porting your games, or at least starter.fps :)
First step would be obviusly to compile TSE and copy the binary over to your game's directory. After you have done that if you try to run it, it will most likely crash on loading the mission. Many things can cause this, so I recommend using a debug build.
Before proceeding you will have to edit defaults.cs - and prefs.cs if it exists - and make sure you have these settings:
$pref::Video::displayDevice = "D3D"; $pref::Video::allowOpenGL = 0; $pref::Video::allowD3D = 1; $pref::Video::preferOpenGL = 0; $pref::Video::fullScreen = "1";Disabling fullscreen is not needed, but I highly recommend it since crashing on fullscreen is usually worse than crashing on windowed mode.
I've found out that the interiors in the Torque Demo don't work on TSE, and it has something to do with mip levels, so I just removed the interiors from the mission file.
Update:
Note: To get interiors to work you will have to re-export them with the map2dif included with TSE, there have been changes to the tool. Thanks Ben for pointing this out.Another thing that can make the game crash is the terrain not finding it's materials, if you look at the console you would see a lot of errors about terrain material loading. What you have to do is to actually define these materials, and the easy way out of this is to copy material.cs and shaders.cs from the TSE Demo to your game scripts and exec materials.cs (shaders.cs is exec inside materials). If you want to get dirty you can go in and remove all the materials you don't want, but it's safe to leave them there. You will also need to copy the shaders directory from the TSE Demo and the textures directory which is inside of data. The later contains some textures used in the shader effects, if you don't want those shaders you can delete theses textures and the respective shaders/materials from the script files. If you dont copy these textures and leave the shaders there, in debug mode you will get an error about Cubemap being passed an empty texture, that's because it's trying to create a cubemap without having a texture, I guess it shouln't assert in such cause but give a console error... up to the devs though.
Althought not needed, you can copy glowBuffer.cs from TSE to your game too, it's used for the glowing effects on lights, the 6th texture on the cube, etc.
I have ported starter.fps and that's all I had to take care of. Of course TSE is work in progress and it has many rarities. One that I've noticed is that items rotation seems to be off, but that should be an easy fix. Another issue is that when going in the gui editor the game seems to freeze but pressing any key/mouse button will refresh and get you in the editor, same for going out. You will notice that shaders seem off inside the gui editor if using a size different than your resolution though. Some things are missing from the TSE source too, like the healthbar, vehicles, and more stuff. If you have custom GUI objects you will have to update them to use the new GFXTextureHandle instead of the old TextureHandle, simple name change but big difference since you won't be using any dgl methods anymore to render, they are now fully API independant. Also, TSE seems to crash each time I quit for me, maybe it has something to do with a missing part in porting.
And a final note, they did the worse thing... they renamed .cc files to .cpp!!! ARGH!!!! Brian's fault I'm sure, he's on my black list!! :P (j/k Brian). I did like the .cc files better, but I'm a unix whore.
Just to back up GG's disclaimer, Torque Shader Engine is a work in progress and it's not meant for commercial use but to try and hammer on the next gen technology that GarageGames will be offering. If your game doesn't work out of the box, if TSE crashes for you, or if you just exepected TSE to be a magic game making receipt, forget it, you have been adviced. It's EARLY ADOPTERS version.
Hope you find this little tutorial useful, maybe It will save you a couple of minutes of head scratching porting your games, or at least starter.fps :)
#2
06/03/2004 (2:47 am)
Doesn't sound too hard at all to port. Interesting. Thanks for explaining this! :)
#3
06/09/2004 (11:34 pm)
Good stuff
#4
Gonna be awhile before I wrench this in.
We purchased TSE and are just kinda "waiting" for it to be done.
TSE will change our game SOOOOO much!
I just hope that our game can do the effects over the network.
I'll keep an eye on ya, please keep posting about TSE porting.
As soon as I know that all my mods will work in TSE, I'll start porting.
07/14/2004 (9:06 pm)
Thanks Xavier,Gonna be awhile before I wrench this in.
We purchased TSE and are just kinda "waiting" for it to be done.
TSE will change our game SOOOOO much!
I just hope that our game can do the effects over the network.
I'll keep an eye on ya, please keep posting about TSE porting.
As soon as I know that all my mods will work in TSE, I'll start porting.
#5
/evangelize off
Start hiding the pennies from your wife. :)
07/17/2004 (6:22 am)
For those of us who are not Torque, C++ or D3D gurus, I'd still recommend getting the TSE. You gaurentee access to the finished version at a drastically reduced price and not to mention you are directly supporting its completion financially./evangelize off
Start hiding the pennies from your wife. :)
#6
TSE is definitely on my list, probably this month, perhaps next week. The TGE "glow" effect is not inspiring and I'm wanting to do more of the Tron-style glows. "This sounds like a job for the Torque Shader Engine!"
Anyway - I chuckled when I read Bryce's post....
Rich
08/13/2004 (5:47 pm)
Interesting, Bryce, that you should bring that bit up - I have to scrape every penny loose from the wife!TSE is definitely on my list, probably this month, perhaps next week. The TGE "glow" effect is not inspiring and I'm wanting to do more of the Tron-style glows. "This sounds like a job for the Torque Shader Engine!"
Anyway - I chuckled when I read Bryce's post....
Rich
#7
It also finds several invalid collision shapes and "non-conobjects" in the mission and/or shape data.
Anyway, it's a start. Hopefully everyone will add their comments here as problems or solutions are encountered.
Rich
09/01/2004 (3:16 pm)
Ok, probably obvious, but should I change references in the mission file from fxWhateverObject to gfxWhateverObject? For instance, the danged thing loads up and acts like it'll run, but on loading the mission it barfs because it can't load the fxSunLight. Or, that's the last barf before death....It also finds several invalid collision shapes and "non-conobjects" in the mission and/or shape data.
Anyway, it's a start. Hopefully everyone will add their comments here as problems or solutions are encountered.
Rich
#8
Excellent Resource! Porting TGE's Starter.fps to TSE is a good start for Early Adopters. Thanks for insight
10/12/2004 (7:27 am)
Xavier,Excellent Resource! Porting TGE's Starter.fps to TSE is a good start for Early Adopters. Thanks for insight
#9
10/21/2004 (8:51 pm)
I purchased my copy with the same state of mind as many of you guys. I just want to get it early and wait for the full release. I Know that my game still has alot of work to be done and by the time we get to polishing it off the TSE should be much more stable and will save us time in the end.
#11
11/06/2004 (2:04 pm)
Binary = EXE File
#12
11/22/2004 (5:42 pm)
A related issue. I fixed a bug in TSE which was causing the terrain painter to crash when updating the texture links in the terrain file when you rename starter.fps. [link]http://www.garagegames.com/mg/forums/result.thread.php?qt=23367[/link]
#13
I changed my video card out and now TSE likes me (sort of). However, I'm encountering problems possibly related to an AMD/AGP chipset issue and that makes it tough to get accurate and relevant errors sorted from extraneous ones....
Rich
12/03/2004 (10:32 am)
Hey - I'm guessing the "Invalid st coord encoding in Interior::readLMapTG" from interiorIO.cpp @ 906 is an indication of a need to re-export the interiors....I changed my video card out and now TSE likes me (sort of). However, I'm encountering problems possibly related to an AMD/AGP chipset issue and that makes it tough to get accurate and relevant errors sorted from extraneous ones....
Rich
#14
04/09/2005 (10:36 pm)
figured I'd put up my .02$ (US) since I just did this too - a couple more things I had to do for my game was to copy over demo/data/materialmap.cs (at least if you want the demo objects to have their shaders), and to change all the references to the demo folder in server/scripts/materials.cs - there's a big section of material datablocks written out that use textures with absolute paths, as well as a loop that binds default materials to the textures without any shaders, make sure to change both to starter.fps or whatever you're using. Also, the TGE style terrain files have absolute paths to the textures they use as well, so if you copy over the demo mission the terrain will be black. Remove all the terrain textures and add them again to fix that. (Although you loose the texture map which says what textures to put where on the terrain)
#15
(1): error X1507: failed to open source file: 'shaders/BaseInteriorV.hlsl'
(1): error X1507: failed to open source file: 'shaders/BaseInteriorP.hlsl'
(1): error X1507: failed to open source file: 'shaders/lmapCubeV.hlsl'
(1): error X1507: failed to open source file: 'shaders/lmapCubeP.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeV.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeP.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffBumpV.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffBumpP.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffuseFogV.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffuseFogP.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeDiffuseV.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeDiffuseP.hlsl'
(1): error X1507: failed to open source file: 'shaders/fogTestV.hlsl'
(1): error X1507: failed to open source file: 'shaders/fogTestP.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectBumpV.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectBumpP.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectV.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectP.hlsl'
(1): error X1507: failed to open source file: 'shaders/refractVertV.hlsl'
(1): error X1507: failed to open source file: 'shaders/refractVertP.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertV.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertP.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractPixV.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractPixP.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereV.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereP.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilV.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilP.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blankV.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotV.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotP.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/wavesV.hlsl'
(1): error X1507: failed to open source file: 'shaders/wavesP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS20V.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS20P.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11AV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11AP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11BV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11BP.hlsl'
05/10/2005 (9:52 am)
When I run my game everything loads up just fine, but for some reason the shaders are not loading and ground has no texture....any one know why this happens? this is the error I get in the console log:(1): error X1507: failed to open source file: 'shaders/BaseInteriorV.hlsl'
(1): error X1507: failed to open source file: 'shaders/BaseInteriorP.hlsl'
(1): error X1507: failed to open source file: 'shaders/lmapCubeV.hlsl'
(1): error X1507: failed to open source file: 'shaders/lmapCubeP.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeV.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeP.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffBumpV.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffBumpP.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffuseFogV.hlsl'
(1): error X1507: failed to open source file: 'shaders/diffuseFogP.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeDiffuseV.hlsl'
(1): error X1507: failed to open source file: 'shaders/bumpCubeDiffuseP.hlsl'
(1): error X1507: failed to open source file: 'shaders/fogTestV.hlsl'
(1): error X1507: failed to open source file: 'shaders/fogTestP.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectBumpV.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectBumpP.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectV.hlsl'
(1): error X1507: failed to open source file: 'shaders/planarReflectP.hlsl'
(1): error X1507: failed to open source file: 'shaders/refractVertV.hlsl'
(1): error X1507: failed to open source file: 'shaders/refractVertP.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertV.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertP.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractVertP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractPixV.hlsl'
(1): error X1507: failed to open source file: 'shaders/blobRefractPixP.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereV.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereP.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/reflectSphereP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilV.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilP.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/tendrilP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/blankV.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotV.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotP.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotV1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/outerKnotP1_1.hlsl'
(1): error X1507: failed to open source file: 'shaders/wavesV.hlsl'
(1): error X1507: failed to open source file: 'shaders/wavesP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS20V.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS20P.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11AV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11AP.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11BV.hlsl'
(1): error X1507: failed to open source file: 'shaders/terrainBlenderPS11BP.hlsl'
#16
05/10/2005 (12:54 pm)
Have you copied the shaders folder over?
#17
05/10/2005 (1:57 pm)
yes, I have, I also copied the materials.cs, in case it might be of some help, I have a Radeon x300 series graphics card...
#18
But when I try to copy the space orc over the TSE crash, does anyone has succefully do this? Maybe I do the wrong way, thanks.
[EDIT] I figure out the problem! Rename the player datablock to playerbody that solve the problem.
06/21/2005 (1:56 am)
Just port the TGE FPS Starter kit to TSE, work like charm! But when I try to copy the space orc over the TSE crash, does anyone has succefully do this? Maybe I do the wrong way, thanks.
[EDIT] I figure out the problem! Rename the player datablock to playerbody that solve the problem.
#19
07/27/2005 (1:17 am)
Good topic !
#20
*** EDIT : I found It !
F10-F11 Keys : Add Creator Directory to the project.
Black terrain : Reload the terrain materials in the editor and save the mission.
But... There is another problem : TSE Runs only in 640x480 ! :(,
In Option Window I can't change resolution. (None appear, even 640x480). Why ?
08/19/2005 (2:54 am)
It seems to work. But, The whole terrain is Black, and F10-F11 keys doesn't work. Does anyone has succefully used these keys?*** EDIT : I found It !
F10-F11 Keys : Add Creator Directory to the project.
Black terrain : Reload the terrain materials in the editor and save the mission.
But... There is another problem : TSE Runs only in 640x480 ! :(,
In Option Window I can't change resolution. (None appear, even 640x480). Why ?
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name