Lightweight tickable netobject
by Toks · in Torque Game Engine · 12/16/2007 (4:12 am) · 1 replies
I need the very most lightweight class that processes ticks, and gets scoped and updated to ALL clients, all the time, but nothing else. I cant really figure out what class should be my class' Parent, what should i inherrit and what functions do I need? I tried some things, but i cant really figure out which class does what i need.
i for example tried something like:
i for example tried something like:
class Foo : public NetObject, public virtual ITickable
{
typedef NetObject Parent;
enum States {
InitialUpdateMask = BIT(0),
MyMask = BIT(1),
NextFreeMask = BIT(2)
};
public:
Foo();
~Foo();
bool onAdd();
void onRemove();
static void initPersistFields();
static void consoleInit();
virtual void interpolateTick( F32 delta );
virtual void processTick();
virtual void advanceTime( F32 timeDelta );
U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *, BitStream *stream);
DECLARE_CONOBJECT(Foo);
};
Torque Owner Kent Butler
The sceneObject would be the other class to look at. This appears to be where Torque implements the container system - so I *think* everything above that level is virtually invisible to detection by other objects.
The sun object is a really good example of a minimalistic netObject that obviously already works if you want to prototype off of something. It doesn't implement the iTickable interface - but that's easy to add (as your example shows) and the sun is about as lightweight as it gets.