Game Development Community

Tank Pack

by Derek "Dozer" Sellers · in Technical Issues · 04/25/2006 (1:01 am) · 14 replies

Okay, for the past several days I've been trying to get the tank pack to work when I plug it into the FPS Starter kit for Torque. My major problem has been that the game cannot instantiate the object TankShape when the game calls it. Here's an example of the object that is created in game.cs:

%player = new TankShape() {
//dataBlock = ShermanTank;
dataBlock = AbramsTank;
client = %this;
};

Okay, so if I'm not mistaken, this creates the object TankShape() and then sticks it in the local variable, %player... now the object uses the datablock called AbramsTank, which is located in tank.cs. Inside of the AbramsTank dataBlock, it says where the shapeFile for the Abrams tank is, and I checked this and it's the right reference. As far as I know when the engine says "instantiate" it means it's trying to create a representation of the object in the game right? So if the reference to the thing I want to be the representation is correct, then what's the problem?

#1
04/25/2006 (2:37 am)
Are you sure you have executed the script that contains the tanks datablock (before trying to create it)? And I'm assuming you've recompiled the engine with the TankPack source code, as TankShape is a new class that comes with the Tank Pack. This won't work with a stock TGE build.
#2
04/25/2006 (6:29 pm)
Yes at the beginning of tank.cs it executes several different modules. The second one from the top is the code that executes the module tankDB.cs which contains the datablock AbramsTank. I also moved all of the engine stuff over into the torque engine files and didn't think anything else of that. If there's something I should check could you tell me which file it's in?
#3
04/25/2006 (6:50 pm)
Okay, so I checked and TankShape.cc is in there if that's what you were referring to... if anyone can see what the console means when it says this:

starter.fps/server/scripts/game.cs (300): Unable to instantiate non-conobject class TankShape.
Set::add: Object "0" doesn't exist
starter.fps/server/scripts/game.cs (305): Unable to find object: '0' attempting to call function 'setTransform'
starter.fps/server/scripts/game.cs (306): Unable to find object: '0' attempting to call function 'setShapeName'
starter.fps/server/scripts/game.cs (314): Unable to find object: '0' attempting to call function 'getEyeTransform'

I think Set:add: Object "0" doesn't exist is something important. If I sound stupid it's because I'm inexperienced at this... but any help would be good if anyone can tell me what it means
#4
04/25/2006 (10:50 pm)
Are you 110% sure that you compiled the tank pack correctly? This error could suggest that you added the files, but not added them to your project.
#5
04/26/2006 (12:02 am)
Well, in the Torque foulder under SDK there is the engine foulder. I put all of the things that belong in there where they belong, and then in example under starter.fps I put everything in its corresponding space and fixed a few things here and there. It still won't work. Do you mean that they're all supposed to be in some sort of Project file? I use UltraEdit32 and it uses .prj files to keep all of the modules together, but otherwise I'm not exactly sure what you mean. Hmmm... I might have overlooked one thing... In the ReadMe for Tank Pack, it says:

If you are integrating the code into a custom version of Torque you will have to merge:

/torque/engine/console/consoleTypes.h (lines 71-76)
/torque/engine/ts/tsCollision.cc (lines 66, 71, 183, and 189)

It says custom version, but I'm wondering if I'd have to do it for myself because the tank pack is made for Torque 1.3 and I have Torque 1.4. I'm not sure. Anyhoo, I'm still trying to figure all of this out...

P. S.
How come everybody has a knickname in between their first and last names on here?
#6
04/26/2006 (1:06 am)
It doesn't sound like you've actually _compiled_ the engine with the tank pack source. The C++ source that is. You need to do this to have the tanks work. I think there was a small bug with it in 1.4, but there's a fix for that on the forums.
#7
04/26/2006 (4:40 am)
As suspected

Yeah - it is not enough for you to copy the files into the engine folder. After you copy them, you need to add them to your project - the Visual Studio project. Then recompile the engine.
#8
04/26/2006 (11:57 am)
Could you explain this a little more? Is there a place I can get this Visual Studio thing? Is it a specific program I have to get somewhere else or is it included with my indie license download?
#9
04/26/2006 (12:25 pm)
You can get Visual C++ Express from Here.

you can learn how to set it up Here.

And you can learn how to put the tank pack into TGE1.4 Here.


Cheers

edit: fix links
#10
04/26/2006 (11:01 pm)
Thank you, that was very helpful... however, I fixed the code the way the forum entry said, I downloaded and installed the patch, and then I recompiled the engine, and I still got the same erorr message:

starter.fps/server/scripts/tank.cs (169): Unable to instantiate non-conobject class TankShape.
starter.fps/server/scripts/tank.cs (171): Unable to find object: '0' attempting to call function 'setEnergyLevel'
starter.fps/server/scripts/tank.cs (205): Unable to find object: '0' attempting to call function 'setTransform'
Set::add: Object "0" doesn't exist

Sooooo.... something else is obviously the matter... but I still probably wouldn't have gotten very far if I hadn't done those things.
#11
04/27/2006 (10:45 am)
After you add the files from the tank pack to the directories in you project directory, you MUST add them to your project. Using VC++Express, right click Torque Demo, click add -> existing file, then look for the files you.

Just because you put the tank pack files in their proper directory, doesn't mean the compiler can see them. Then you can rebuild the project.
#12
04/27/2006 (6:06 pm)
I clicked and dragged them into the tree before I recompiled it
#13
04/27/2006 (7:38 pm)
You can read the compiler output to see if it's compiling. And are you sure you are running the .exe you're getting from the compiled setup? I can drive over to your house to check =P (you live in the same city).
#14
05/01/2006 (4:30 pm)
Thanks, I was just being a moron and didn't realize that the Visual C++ was recompiling torqueDemo under a different name. Anyhoo, I'm all good now as far as the tank was concerned.