Game Development Community

Generating Game Ticks

by Nate "Nateholio" Watson · in Technical Issues · 01/16/2006 (1:34 am) · 2 replies

So I've been working on my project programming the basic core engine functions. Now I have come to a point where I think I shouldn't be relying on the simple function of setting the game's refresh rate to 30fps to accomplish timing tasks. I need to program a way to generate game ticks for control, timing, and network game syncing. My questions are:

How many ticks should I send out over a network each second?
What is the general method of implementing something like this?

Currently I am planning to keep track of elapsed time in milliseconds. I will be doing a screen render every 33ms, allowing 17ms for the system to do so. The remaining 16ms will be split up between various processes such as input, network traffic, movement/rotation calculations, etc.

Is this the way to go about it? If so, how would I ensure that a process doesn't run over its alloted timeslice? Would I use process prioritization to handle it?

#1
01/16/2006 (6:28 pm)
Are you using Torque, or writing your own engine? In Torque, it's best not to worry about any of the lower level timing, and let processTick() handle your tasks as appropriate.

In 1.4, you also have an iTickable class (iTickable.cc/h) which can let any object receive ticks, even those not derived from the normal object hierarchy.
#2
01/16/2006 (7:09 pm)
Im writing my own engine for a proof-of-concept demo because I can get things rolling faster this way than by learning c++ then learning TScript then learning the guts of TGE and then finally tweaking TGE to meet my needs.