Game Development Community

GameBase and rendering

by Marcin Zygmunt · in Torque Game Engine · 08/28/2005 (4:58 am) · 8 replies

Hello!

I have studied Melv's article on fxRenderObject and - thus - I wanted to go one step further. I've got a fully working SceneObject class which gets properly rendered. I needed some functionality offered by GameBase so I simply changed the 'parent' member variable of my class and it's parent-class to GameBase (instead of SceneObject). Unfortunately, it doesn't bring satisfactionary results. I can't add any object of this new type to the game. Seems that changing class from SceneObject to GameBase isn't so obvious. What should I do ?

Thanks in advance!

#1
08/28/2005 (5:09 am)
You also need to implement a GameBaseData object for it (a datablock).
#2
08/28/2005 (6:16 am)
Thanks for the hint!

I did what you said but I still keep getting this one : 'editor/newObject.cs (0) : Register object failed for object Torus of class fxTorusObject.'. :-/

Maybe some source will help if you could take a look at it. Here is how I made a simple GameBaseData for my fxTorusObject :

Edit: No engine source in the public forums =) - Matt

Plus, here is what I added to scripts :

/example/common/editor/EditorGui.cs in [function Creator::init( %this )]
%Environment_Item[<next item-index in list>] = "fxTorusObject";

/example/common/editor/ObjectBuilderGui.gui
function ObjectBuilderGui::buildfxTorus(%this)
{
		%this.className = "fxTorus";
		%this.addField("dataBlock", "TypeDataBlock", "fxTorusData", "fxTorusData");
		%this.process();
}

I'd be thankful for your help!
#3
08/28/2005 (7:28 am)
You need to declare the datablock in script:

datablock fxTorusData(MyTorusDataBlock) { };
#4
08/28/2005 (8:59 am)
Sorry for my yelling but the console says this :

Compiling starter.fps/server/scripts/torus.cs...
starter.fps/server/scripts/torus.cs Line: 11 - Syntax error.
>>> Advanced script error report.  Line 21.
>>> Some error context, with ## on sides of error halt:
//-----------------------------------------------------------------------------

datablock fxTorusData( MyTorusData ) 
{ 



}##;##
>>> Error report complete.

:(

I must have missed/done something wrong at some stage. What could it be ?

Thanks thanks :)
#5
08/28/2005 (10:12 am)
Torque doesn't like empty datablocks. Try this:

datablock fxTorusData( MyTorusData )
{
   dummy = 1; // this quiets the compiler
};
#6
08/28/2005 (1:08 pm)
Yup! It works perfectly now.

Thanks Matt and Alex!
#7
08/28/2005 (3:04 pm)
Shouldn't this be in a private forum as it contains code?
#8
08/28/2005 (5:12 pm)
Michael,
Good point...I edited Marcin's post to remove the private source code.