Game Development Community

[Rendering] Client side non FPS game

by Vlad Ts · in Torque Game Engine · 05/04/2005 (12:20 pm) · 5 replies

Hi people !

Have a question for you:

class TStatic : SceneObject
{
private:
int nIndx;

public:
void renderObject(SceneState *state, SceneRenderImage *image);

TStatic();
~TStatic();
};


TStatic::TStatic() : SceneObject()
{
mTypeMask |= StaticRenderedObjectType;
mNetFlags.set(IsGhost);

onAdd();

mObjBox.min.set(-10, -10, -10);
mObjBox.max.set(10, 10, 10);
resetWorldBox();

setPosition(Point3F(0, 10, 0));

setRenderTransform(mObjToWorld);

addToScene();
}

TStatic::~TStatic()
{
....
}

void TStatic::renderObject(SceneState *state, SceneRenderImage *image)
{
....
}




class my3DTSCtrl: public GuiTSCtrl
{
typedef GuiTSCtrl Parent;

public:
bool processCameraQuery(CameraQuery * q);


void renderWorld(const RectI &updateRect);


//generic methods
my3DTSCtrl();
~my3DTSCtrl();

DECLARE_CONOBJECT(sokoban3DTSCtrl);
};

3DTSCtrl::my3DTSCtrl()
{
my3D = this;
mStatic = new TStatic();

}

3DTSCtrl::~my3DTSCtrl()
{
my3D = NULL;
}


bool my3DTSCtrl::processCameraQuery(CameraQuery * q)
{
MatrixF mxCamera;
mxCamera.identity();

q->nearPlane = 0.1;
q->farPlane = 1000.0;
q->cameraMatrix = mxCamera;

return true;
}


void my3DTSCtrl::renderWorld(const RectI &updateRect)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

dglSetCanonicalState();
gClientSceneGraph->renderScene();

dglSetClipRect(updateRect);
}

Everything is cool, exept one thing what should I do for making that thing render my successor of SceneObject start render itself ?

This is not net based game, so I do not need Net at all, and this variant of code seems to be logical, but after it starts building scene tree my object never gets inside it, so no results on screen or anyware. Could anyone tell me what is wrong with this ?

#1
05/06/2005 (3:37 am)
Hey! People! Anybody alive ?
#2
05/06/2005 (4:04 am)
Your best bet is to look at the fxRenderObject resource :)
#3
05/06/2005 (4:15 am)
FxRenderObject, as said above.

You aren't getting anything at all because even if you can't have a 100% client-only object that way. When you add objects in the editor, they are created on the server, and then ghosted to the client.

The only way I know to create client-only object is to make a ghosted object create them. That's how the FxShapeReplicator works: the replicator exists on the server, and is ghosted to the client. Both the server and client copies will replicate objects on their sides, without ghosting them.

So, even if your object do all of it's stuff on the client only, it must be created on the server and ghosted to the client, if you want to be able to create it by normal means.
#4
05/06/2005 (5:39 am)
If you need true client side objects, then check out my client side ts static resource
#5
05/06/2005 (8:39 am)
Thomas "Man of Ice" Lund - man !!! You rules !!! this is good example !!! that's exactly what I need !!! Thanks a lot.