Game Development Community

Question about $timeScale on dedicated server.

by weihua · in Torque 3D Professional · 07/19/2010 (8:32 am) · 4 replies

If I start a dedicated server and set $timeScale to a value little than 1, e.g. $timeScale=0.5, the disconnection icon will be displayed on client screen and the client will be stucked. If I change $timeScale back to 1 or above, the client will continue to run.
I used to think $timeScale should be change to the same value both on server and client side.
But now I consider it that only value greater thank 1 can be applied on both side.
I tested this with 1.0.1 and 1.1 beta1. The results are the same.
Is that a bug? or It just should be in this way?
Thanks!

#1
07/20/2010 (10:48 am)
Will there be an offical answer?
#2
07/20/2010 (7:30 pm)
No global variables ($timescale included) are automagically synchronized between server and clients. If you want to change $timeScale I believe you need to send a commandToClient() with the new value, or modify the gameConnection::writePacket() function so it writes the timescale.

But remember that $timeScale also changes the rate at which network data is sent (it can make it faster or slower), thus I don't consider it a network-safe way of changing simulation speed.

It is better if you use a custom variable that is used directly in the player's simulation (Player::updateMove() and Player::updatePos()), so it won't affect networking.
#3
07/21/2010 (2:07 am)
Thank you Manoel :-)
Yes, it is because network data sending is affected by $timeScale.
Now I send a command to client first to change the client side $timeScale and then schedule an event to change server side $timeScale a tick time later. It works now.
Thank you for your help!
#4
08/20/2010 (7:12 pm)
Moved to General Discussion.