Quick Guide Porting Tips (to TGEA 1.7.0)
by James Laker (BurNinG) · in Torque Game Engine Advanced · 04/09/2008 (8:05 am) · 17 replies
Here are some of the things I ran into while porting my code over to TGEA 1.7.0.
1) Rename all #include "sim/sceneObject.h" to #include "sceneGraph/sceneObject.h".
2) Rename all #include "game/" to #include "t3d/"
*See Point 11 before renaming ALL
3) Some GFX-> calls needs to change to GFX->getDrawUtil()->. These Include all the following calls:
- DrawRect*
- DrawBitmap*
- DrawLine*
- DrawText*
- clearBitmapModulation
- setBitmapModulation
eg. GFX->clearBitmapModulation() changes to GFX->getDrawUtil()->clearBitmapModulation()
4) In your Custom written GUI object you need to know that mBounds is not a public member anymore. So any use of mBounds.extent.x needs to change to getWidth() and mBounds.extent.y needs to change to getHeight().
5) StringHandle class became NetStringHandle
6) Any #include "audio/audioDataBlock.h" code block in your code needs to be replaced with #include "sfx/sfxSystem.h"
7) AUDIOHANDLE has changed to SFXSource*
8) All references to TypeAudioProfilePtr needs to change to TypeSFXProfilePtr
9) Also comment out any alxStop calls from your code. This needs to change to sfxStop.
10) All references to class RenderInst; in your classes needs to change to struct RenderInst;
11) Change all #include "game/game.h" to #include "app/game.h"
12) Any mCross function changes to make use of a pointer.
eg. mCross( forward, up, right ); changes to mCross( forward, up, &right );
13) Con::executef() only takes char variables now.
eg. Con::executef( getDataBlock(), 2, name, scriptThis()); changes to Con::executef( getDataBlock(), name, scriptThis());
Hopefully it saves other people some headaches. This is still a work in progress as I continue to port Solar Battles. Please feel free to add more, to help us noobs.
James
EDIT: Updated
1) Rename all #include "sim/sceneObject.h" to #include "sceneGraph/sceneObject.h".
2) Rename all #include "game/" to #include "t3d/"
*See Point 11 before renaming ALL
3) Some GFX-> calls needs to change to GFX->getDrawUtil()->. These Include all the following calls:
- DrawRect*
- DrawBitmap*
- DrawLine*
- DrawText*
- clearBitmapModulation
- setBitmapModulation
eg. GFX->clearBitmapModulation() changes to GFX->getDrawUtil()->clearBitmapModulation()
4) In your Custom written GUI object you need to know that mBounds is not a public member anymore. So any use of mBounds.extent.x needs to change to getWidth() and mBounds.extent.y needs to change to getHeight().
5) StringHandle class became NetStringHandle
6) Any #include "audio/audioDataBlock.h" code block in your code needs to be replaced with #include "sfx/sfxSystem.h"
7) AUDIOHANDLE has changed to SFXSource*
8) All references to TypeAudioProfilePtr needs to change to TypeSFXProfilePtr
9) Also comment out any alxStop calls from your code. This needs to change to sfxStop.
10) All references to class RenderInst; in your classes needs to change to struct RenderInst;
11) Change all #include "game/game.h" to #include "app/game.h"
12) Any mCross function changes to make use of a pointer.
eg. mCross( forward, up, right ); changes to mCross( forward, up, &right );
13) Con::executef() only takes char variables now.
eg. Con::executef( getDataBlock(), 2, name, scriptThis()); changes to Con::executef( getDataBlock(), name, scriptThis());
Hopefully it saves other people some headaches. This is still a work in progress as I continue to port Solar Battles. Please feel free to add more, to help us noobs.
James
EDIT: Updated
#2
04/09/2008 (11:25 am)
Documentation/porting.html contains useful information as well.
#3
Wow, that is huge. Thanks Jeff!
04/09/2008 (4:00 pm)
Quote:Note - your change to Con::executef() is incorrect. It now determines the argument count from the number of actual arguments given. In your example, this means you leave off the 2, you don't convert it to a "2". This will screw up the call since the first arg is now a 2.
Wow, that is huge. Thanks Jeff!
#4
04/10/2008 (12:50 am)
Thanx Jeff... Updated.
#5
I have not been able to find a replacement for alxIsPlaying yet.
04/10/2008 (1:17 am)
AlxStop has been changed to sfxStop same goes with alxPlay has changed to sfxPlay.I have not been able to find a replacement for alxIsPlaying yet.
#6
04/10/2008 (5:13 am)
I'm also looking for an alxIsPaused replacement.
#7
04/10/2008 (12:32 pm)
Thanks James, this was really useful! A timesaver.
#8
04/10/2008 (12:42 pm)
Some more files moved from sim to sceneGraph folder:sim/decalManager.h --> sceneGraph/decalManager.h sim/decalManager.cpp --> sceneGraph/decalManager.cpp sim/pathManager.h --> sceneGraph/pathManager.h sim/pathManager.cpp --> sceneGraph/pathManager.cpp sim/simPath.h --> sceneGraph/simPath.h sim/simPath.cpp --> sceneGraph/simPath.cpp
#9
... it also has other functions like play(), stop(), pause(), isPlaying(), isPaused(), etc. You can see more details in the C++ reference docs for SFXSource and also in the Torsion code browser window.
Things like this are safe now too...
Since its a real SimObject isObject() will return false if the play once source was finished and has been deleted.
Another interesting thing... look for sfxPause() and sfxResume() in script. These use the global SFXSourceSet to loop thru all the active sources in the game and pause/resume them. If you wanted for instance to pause all the game sounds, but leave your gui sounds.
Hope this helps.
04/10/2008 (3:17 pm)
Some SFX basics... an SFXSource is a proper SimObject. So you can do this...%source = SFXPlay( MyProfile ); %source.setVolume( 0.5 ); %source.setPitch( 0.5 ); %source.setTransform( "10 10 20" );
... it also has other functions like play(), stop(), pause(), isPlaying(), isPaused(), etc. You can see more details in the C++ reference docs for SFXSource and also in the Torsion code browser window.
Things like this are safe now too...
%this.someSource = SFXPlayOnce( MyProfile ); // Then sometime later... if ( isObject( %this.someSource ) ) %this.someSource.pause();
Since its a real SimObject isObject() will return false if the play once source was finished and has been deleted.
Another interesting thing... look for sfxPause() and sfxResume() in script. These use the global SFXSourceSet to loop thru all the active sources in the game and pause/resume them. If you wanted for instance to pause all the game sounds, but leave your gui sounds.
new SimSet( PausedSimSounds ); sfxPause( $SimAudioType, PausedSimSounds ); sfxPause( $MessageAudioType, PausedSimSounds ); // Then when you want to resume them... sfxResume( PausedSimSounds );
Hope this helps.
#10
04/11/2008 (8:04 am)
Cool stuff Tom! I assume SFX has now fixed the broken Audio Emitters?
#11
04/11/2008 (11:21 am)
@Mark - I know the SFXEmitter works, but you could detail how the old one was broken?
#12
04/11/2008 (3:20 pm)
I don't even remember if it was as late as 1.03 but the mission placeable Audio Emitters just wouldn't produce sound. Maybe we were doing something wrong, but I never could get them to work.
#13
04/15/2008 (4:20 pm)
AudioProfile has changed to SFXProfile
#14
mBounds can be used more than as mbounds.extent.x or y, so, if you are using mBounds in other way, you can port it simply changing the word mbounds by getBounds()
05/03/2008 (11:47 am)
As we talk in this thread: http://www.garagegames.com/mg/forums/result.thread.php?qt=74811mBounds can be used more than as mbounds.extent.x or y, so, if you are using mBounds in other way, you can port it simply changing the word mbounds by getBounds()
#15
The whole GameConnection seems splitted.
GameConnectionMoves is now moveList, now i use the mConnect pointer to get the control object.
I begin working on pathShape (Ramen's code) port for 1.07.
05/04/2008 (8:26 am)
The INPUT control (GetNextMove) is now part of moveList.The whole GameConnection seems splitted.
GameConnectionMoves is now moveList, now i use the mConnect pointer to get the control object.
I begin working on pathShape (Ramen's code) port for 1.07.
#16
07/07/2009 (10:15 pm)
I'm glad I found this thread, this really saved me some frustration. Thank you.
#17
Lots of good info in both.
07/08/2009 (5:56 am)
There is another porting thread going as well. www.garagegames.com/community/forums/viewthread/90589Lots of good info in both.
Associate Jeff Faust
Faust Logic, Inc.