Need Level.TimeSeconds, but replicated..

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
Hi all,

I'm trying to draw a timer on the HUD. It needs to be very accurate as it displays microseconds.

Basically the deal is that I set a replicated variable to Level.TimeSeconds in my GameReplicationInfo and then send it to clients. The clients are basically printing out (Level.TimeSeconds - ReplicatedTimerVar).

Now that would be fine, except that Level.TimeSeconds is the time since the game started for that machine. And so for example, when a client joins 10 seconds later their timer will always be out by those 10 seconds.

Is there such thing as an accurate time variable that is constant between all machines? Or must I work around this another way..?

cheers!
 

Mychaeel

New Member
I tried to achieve something like that for Jailbreak (see JBTagClient, search for "SynchronizeTime"), but as [Sixpack]-Shambler- says, it's nigh impossible to do something like that over the internet with any accuracy to speak of.

pospi said:
It needs to be very accurate as it displays microseconds.
Given a plausible assumption about a client's framerate, that timer will only have an accuracy of somewhere between 5,000 and 30,000 microseconds anyway, regardless of the precision you display it in...
 

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
fair enough then guys.

what if I just have a non-replicated variable on the client machines that is set on PostNetReceive() as the difference between the current local time and time the server sent, and factor that into the equation? That should be accurate enough for my purposes I would think..

edit: something else, I notice the normal 'time elapsed' game timer that gets drawn on the HUD uses GRI.ElapsedTime... however it doesnt seem to be updated very often, any ideas why?
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
It is syncronized only once in a while because client-side simulation is accurate enough in most cases. Network bandwidth should be used for more important things than a game timer.