Come Fly With Me
by Sean Rice · 03/28/2010 (12:00 pm) · 46 comments
Because this is a paid for resource and not a free one, only the original resources will be provided. You may purchase this resource here www.decane.net/products/torque/fge/ if you do not already have this. This will show you the requirements needed to convert the existing files to the T3D engine.
First, We will work in the engine itself. Copy the 4 files from the 13103.aiflyingvehicleclasses_1.0 (these may be obtained from here www.torquepowered.com/community/resources/view/13103) and the files from the GuiReticleHUD folder. I placed all of the GuiReticleHUD in engine/soruce/gui/controls and the aiflyingclasses in engine/source/T3D/vehicles. You may also wish to copy these resources in when you compile your engine, this way you have the correct resources for the ported game example. www.torquepowered.com/community/resources/view/19519
Edit guiReticleHud.cpp
Change your includes from this
Change all occurrences of (should be 3)
Change this
This
This
This
Next open aiFlyingVehicle.cpp and
change
change (2 occurrences)
change
aiFlyingVehicle.h
change
aiRepairshipFlyingVehicle.cpp
change
change
change
change
This completes the engine changes, you can recompile your engine at this time. We will continue onto the server and client sides next. This will take a bit of time, but you can complete the engine changes now.
First, We will work in the engine itself. Copy the 4 files from the 13103.aiflyingvehicleclasses_1.0 (these may be obtained from here www.torquepowered.com/community/resources/view/13103) and the files from the GuiReticleHUD folder. I placed all of the GuiReticleHUD in engine/soruce/gui/controls and the aiflyingclasses in engine/source/T3D/vehicles. You may also wish to copy these resources in when you compile your engine, this way you have the correct resources for the ported game example. www.torquepowered.com/community/resources/view/19519
Edit guiReticleHud.cpp
Change your includes from this
//#include "dgl/dgl.h" //#include "dgl/gFont.h" #include "gui/core/guiControl.h" #include "gui/core/guiTSControl.h" #include "console/consoleTypes.h" #include "sceneGraph/sceneGraph.h" #include "game/shapeBase.h" #include "game/gameConnection.h" #include "string.h" // Needed for strcmpto this
//#include "dgl/dgl.h" //#include "dgl/gFont.h" #include "gui/core/guiControl.h" #include "gui/3d/guiTSControl.h" #include "gui/core/guiCanvas.h" #include "gfx/gfxDrawUtil.h" #include "console/consoleTypes.h" #include "sceneGraph/sceneGraph.h" #include "T3D/shapeBase.h" #include "T3D/gameBase/gameConnection.h" #include "string.h" // Needed for strcmp #include "platform/platform.h"
Change all occurrences of (should be 3)
ShapeBase* control = conn->getControlObject();to this
GameBase* control = conn->getControlObject();
Change this
ShapeBase *mount = shape->getObjectMount();to this
SceneObject *mount = shape->getObjectMount();
This
pts[idx].x = bounds.min.x; pts[idx].y = bounds.min.y; pts[idx].z = bounds.min.z; idx++; pts[idx].x = bounds.min.x; pts[idx].y = bounds.min.y; pts[idx].z = bounds.max.z; idx++; pts[idx].x = bounds.min.x; pts[idx].y = bounds.max.y; pts[idx].z = bounds.min.z; idx++; pts[idx].x = bounds.min.x; pts[idx].y = bounds.max.y; pts[idx].z = bounds.max.z; idx++; pts[idx].x = bounds.max.x; pts[idx].y = bounds.min.y; pts[idx].z = bounds.min.z; idx++; pts[idx].x = bounds.max.x; pts[idx].y = bounds.min.y; pts[idx].z = bounds.max.z; idx++; pts[idx].x = bounds.max.x; pts[idx].y = bounds.max.y; pts[idx].z = bounds.min.z; idx++; pts[idx].x = bounds.max.x; pts[idx].y = bounds.max.y; pts[idx].z = bounds.max.z;to this
//HNG pts[idx].x = bounds.minExtents.x; pts[idx].y = bounds.minExtents.y; pts[idx].z = bounds.minExtents.z; idx++; pts[idx].x = bounds.minExtents.x; pts[idx].y = bounds.minExtents.y; pts[idx].z = bounds.maxExtents.z; idx++; pts[idx].x = bounds.minExtents.x; pts[idx].y = bounds.maxExtents.y; pts[idx].z = bounds.minExtents.z; idx++; pts[idx].x = bounds.minExtents.x; pts[idx].y = bounds.maxExtents.y; pts[idx].z = bounds.maxExtents.z; idx++; pts[idx].x = bounds.maxExtents.x; pts[idx].y = bounds.minExtents.y; pts[idx].z = bounds.minExtents.z; idx++; pts[idx].x = bounds.maxExtents.x; pts[idx].y = bounds.minExtents.y; pts[idx].z = bounds.maxExtents.z; idx++; pts[idx].x = bounds.maxExtents.x; pts[idx].y = bounds.maxExtents.y; pts[idx].z = bounds.minExtents.z; idx++; pts[idx].x = bounds.maxExtents.x; pts[idx].y = bounds.maxExtents.y; pts[idx].z = bounds.maxExtents.z; // HNG
This
GFX->drawRect(RectI(min.x, min.y, max.x-min.x, max.y-min.y), mRenderColor);
}
else if( strcmp(mRectangleStyle , "c" ) == 0) // corners
{
// draw only the corners of the rectangle
GFX->drawLine(min.x, min.y, min.x + cornerLength, min.y, mRenderColor); // top left
GFX->drawLine(min.x, min.y, min.x, min.y + cornerLength, mRenderColor); // top left
GFX->drawLine(max.x, min.y, max.x - cornerLength, min.y, mRenderColor); // top right
GFX->drawLine(max.x, min.y, max.x, min.y + cornerLength, mRenderColor); // top right
GFX->drawLine(min.x, max.y, min.x + cornerLength, max.y, mRenderColor); // bottom left
GFX->drawLine(min.x, max.y, min.x, max.y - cornerLength, mRenderColor); // bottom left
GFX->drawLine(max.x, max.y, max.x, max.y - cornerLength, mRenderColor); // bottom right
GFX->drawLine(max.x, max.y, max.x - cornerLength, max.y, mRenderColor); // bottom rightto this// HNG
GFX->getDrawUtil()->drawRect(RectI(min.x, min.y, max.x-min.x, max.y-min.y), mRenderColor);
}
else if( strcmp(mRectangleStyle , "c" ) == 0) // corners
{
// draw only the corners of the rectangle
GFX->getDrawUtil()->drawLine(min.x, min.y, min.x + cornerLength, min.y, mRenderColor); // top left
GFX->getDrawUtil()->drawLine(min.x, min.y, min.x, min.y + cornerLength, mRenderColor); // top left
GFX->getDrawUtil()->drawLine(max.x, min.y, max.x - cornerLength, min.y, mRenderColor); // top right
GFX->getDrawUtil()->drawLine(max.x, min.y, max.x, min.y + cornerLength, mRenderColor); // top right
GFX->getDrawUtil()->drawLine(min.x, max.y, min.x + cornerLength, max.y, mRenderColor); // bottom left
GFX->getDrawUtil()->drawLine(min.x, max.y, min.x, max.y - cornerLength, mRenderColor); // bottom left
GFX->getDrawUtil()->drawLine(max.x, max.y, max.x, max.y - cornerLength, mRenderColor); // bottom right
GFX->getDrawUtil()->drawLine(max.x, max.y, max.x - cornerLength, max.y, mRenderColor); // bottom right
// HNGThis
GFX->setBitmapModulation(mFillColorDefault); GFX->drawText(mProfile->mFont, offset, name); GFX->clearBitmapModulation();to this
// HNG GFX->getDrawUtil()->setBitmapModulation(mFillColorDefault); GFX->getDrawUtil()->drawText(mProfile->mFont, offset, name); GFX->getDrawUtil()->clearBitmapModulation(); // HNG
Next open aiFlyingVehicle.cpp and
change
#include "aiFlyingVehicle.h" #include "../console/consoleInternal.h" #include "../core/realComp.h" #include "../math/mMatrix.h" #include "moveManager.h"to this
#include "aiFlyingVehicle.h" #include "console/consoleInternal.h" //#include "core/realComp.h" #include "math/mMatrix.h" #include "T3D/gameBase/moveManager.h"
change (2 occurrences)
mCross( forward, up, right );to this
mCross( forward, up, &right );
change
Con::executef(getDataBlock(), 2, name, scriptThis());to this
Con::executef(getDataBlock(), name, scriptThis());
aiFlyingVehicle.h
change
#include "game/vehicles/flyingVehicle.h"to this
#include "T3D/vehicles/flyingVehicle.h"
aiRepairshipFlyingVehicle.cpp
change
#include "AIRepairshipFlyingVehicle.h" #include "../console/consoleInternal.h" #include "../core/realComp.h" #include "../math/mMatrix.h" #include "moveManager.h"to this
#include "AIRepairshipFlyingVehicle.h" #include "console/consoleInternal.h" //#include "../core/realComp.h" #include "math/mMatrix.h" #include "T3D/gameBase/moveManager.h"
change
mCross( forward, up, right );to this
mCross( forward, up, &right );
change
Con::executef(getDataBlock(), 2, name, scriptThis());to this
Con::executef(getDataBlock(), name, scriptThis());
change
#include "game/vehicles/flyingVehicle.h"to this
#include "T3D/vehicles/flyingVehicle.h"
This completes the engine changes, you can recompile your engine at this time. We will continue onto the server and client sides next. This will take a bit of time, but you can complete the engine changes now.
About the author
http://www.hngamers.com
#2
I was looking for this, you saved me quite some time.
Appreciate your work. Thanks Sean!
03/28/2010 (1:12 pm)
A FGE fan reporting in. :-)I was looking for this, you saved me quite some time.
Appreciate your work. Thanks Sean!
#3
03/29/2010 (2:16 am)
Same here thanks !!!
#4
03/29/2010 (10:54 am)
Sean you are the patron saint of porting. This is really welcome awesomeness. The speed at which you continue to convert these ports is simply amazing! Many thanks!
#5
After burners work, Ai spawns with the map now, combat is turned off at the moment(due to crash issue). Although the scouts are stationary at this moment, only the repair ships are flying around. Combat isn't working and we have a crash on Death; although, it looks to be related to Aithink versus an actual death cam issue.
03/29/2010 (11:14 am)
Flight game port update, those that have played this before should be familiar with the landscape that is in there. It's a bit ugly at this moment, I will be cleaning the look up for the island before the end. After burners work, Ai spawns with the map now, combat is turned off at the moment(due to crash issue). Although the scouts are stationary at this moment, only the repair ships are flying around. Combat isn't working and we have a crash on Death; although, it looks to be related to Aithink versus an actual death cam issue.
#6
03/29/2010 (12:02 pm)
nice work Sean. Would be interesting to see the fps on it after it's all working.
#7
03/29/2010 (12:17 pm)
Fraps on my machine was saying over 300 FPS and it dropped to 30 during the capture. Then again we are talking a 8 Xeon 2.0 GHz with 12 GB ram and a Geforce 295 card :p
#8
When flying, do you have the ability to be in 3rd person view, or is it only 1st person?
03/30/2010 (9:48 am)
@SeanWhen flying, do you have the ability to be in 3rd person view, or is it only 1st person?
#9
03/30/2010 (12:10 pm)
I am pretty sure you do, I will check in a little while. I made a goof and hosed the database for my website and some gameservers and then apparently the system somehow destroyed the backup... Sigh...
#10
03/30/2010 (1:23 pm)
does your port include the earlier AIFlyingVehicle changes to make the AI move and fire?
#11
http://www.torquepowered.com/community/forums/viewthread/93563/3#comments
03/30/2010 (1:41 pm)
edit : missing linkhttp://www.torquepowered.com/community/forums/viewthread/93563/3#comments
#13
03/31/2010 (10:37 am)
@Cyberkada, the additional code has been added and compiled with a few changes. It appears to have resolved the majority of the stationary bots.
#14
many of these errors: scripts/server/shapeBase.cs (65): Unknown command getState.
Object (17020) FlyingVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
03/31/2010 (2:49 pm)
is there a reason why in GUIReticleHUD now Gamebase* rather than ShapeBase*? I get a hard crash when the repairship dies, but not finished with my attempt either. ( I want to use as little FGE code as possible and use T3D code if possible...many of these errors: scripts/server/shapeBase.cs (65): Unknown command getState.
Object (17020) FlyingVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
#15
03/31/2010 (2:58 pm)
No particular reason other then it compiles that way for the moment. It allowed me to get past that particular portion and focus on some other aspects. This is a rather difficult port and I do mention the crashing as a pending issue, I have those specific changes marked as undesirable and won't be in the final conversion. I have not seen a error like that as of yet, though.
#16
In function function AiRepairShip::onImpact(
rrror("onImpact: FIXME: Hier this statt 0?");
03/31/2010 (3:02 pm)
Your hard error is most likely occuring at this point? In function function AiRepairShip::onImpact(
rrror("onImpact: FIXME: Hier this statt 0?");
#17
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(122) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(281) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(402) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(465) : error C2440: 'initializing' : cannot convert from 'SceneObject *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast\
03/31/2010 (4:10 pm)
When leaving it as is, I get a series of these errors... 1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(122) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(281) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(402) : error C2440: 'initializing' : cannot convert from 'GameBase *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast
1>d:\torque\flightgame\engine\source\gui\controls\guireticlehud.cpp(465) : error C2440: 'initializing' : cannot convert from 'SceneObject *' to 'ShapeBase *'
1> Cast from base to derived requires dynamic_cast or static_cast\
#18
03/31/2010 (4:24 pm)
The source of the crash is not GuiReticleHud, you can drop it from your project and it will still crash. It actually draws the Gui correctly with the revisions.
#19
04/01/2010 (1:24 pm)
Wow just... wow... I need to finish my engine so i can try this out... damn...
#20
04/01/2010 (1:40 pm)
Trying to come up with the best way of getting this out to everyone, I can't just release it to all since this is a purchased app. How about a manual file move with instructions and a .patch file to be applied to those files? 
Torque Owner Sean Rice
HNGamers