Game Development Community

Subclassing from ShapeBase

by Cameron Tofer · in Torque Game Engine · 11/04/2004 (2:16 pm) · 3 replies

Hi, I'd like to create a new object class that has a model and moves around, so i've decided to subclass ShapeBase like the vehicles and player do. I need help understanding this new classes' responsibilities when it comes to movement. Here are some of the questions I have so far:

1) from the demo code Vehicle::processTick, what is the section "Warp to catch up to server" trying to achieve. does this code run on both client and server. is this trying to sync up what the client thinks to what the server thinks?

2) interpolateTick, this is called once a frame and only on the client right? this is where the client thinks the object is, somewhere between where it was and where it might be going?

3)advanceTime, this is only needed to update stuff that may already get updated every frame? such as animations and particles?

4) packUpdate, this checks to see what parts of the object have been changed and feed it to the bit stream? does this go from server to client? or both? when does this happen?

5)unpackUpdate, this is when the client has recieved data and may need to correct what the object was doing?


I'm having trouble understanding the relationship of server and client when talking about warpTicks and warpOffsets.

thanks for reading, any help is appreciated.
-cam

#1
11/04/2004 (3:49 pm)
1) Yes. It acts to interpolate and smooth out the user's experience.
2) No. This is called before every render on the client, to do any interpolation that must occur between ticks.
3) This is called every tick, a tick is 1/32sec, to update any object state. Physics, emitters, etc.
4) This is used to write an update from the server to the client.
5) This is used to read updates from the server.

Have you read the engine reference? The NetObject documentation explains how packUpdate, unpackUpdate, and their related methods work. The GameBase documentation explains how the various time and tick methods work.
#2
11/04/2004 (3:57 pm)
Thanks for the reply.

I have a couple more questions after reading the NetObject and GameBase Documentation again:

1) does the processTick run on the client machine?
2) does interpolateTick run on the server?
3) does packUpdate run on the client?
4) does unpackUpdate run on the server?

btw is there any docs/resource/guide that describes the warpTicks/warpOffset used in the vehicle and other objects?
#3
11/04/2004 (5:27 pm)
1) Yes.
2) No.
3) No.
4) No.

No. They act to interpolate. If you're just making a new object I suggest getting it working _without_ interpolation first, then adding it as needed.