• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Compare time stamps from server and client

Pharrahnox

FNG / Fresh Meat
Feb 3, 2016
268
71
0
Cranny mate
I've added stamina to players, and am trying to get it working nicely over a network. The server is authoritative with respect to stamina, so when stamina is changed on the server, it is replicated to the client. The client predicts what its value for stamina should be at any point in time, and when it gets overriden by the server's replicated value, the client attempts to reproduce all changes to stamina that occurred after the time of replication. The changes are stored in a pooled doubly-linked list, and each node has a timestamp.

The changes to stamina stored in the linked list have their timestamps determined by the client, and the replicated stamina struct has a timestamp determined by the server. These timestamps are compared so that any stored changes to stamina that occurred before the replication event can be discarded. The issue is that the server and client don't agree on the timestamps. Using WorldInfo.TimeSeconds is way off, since it seems that the server starts ticking that when it loads the map, and even using ActorTimeSeconds is about 0.5 seconds off, which is too much to be useful. I've even tried making my own ElapsedTime variable that is simply the sum of all DeltaTimes from Tick(), but it's also 0.5 seconds off.

How can I correctly sync the timestamps from the client and the server?