Syncing Timer

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Syncing Timer

forgemaster
2020-10-10 21:15:03

Hello I've been having an issue for a while now that pops up once in a while and was wondering if anyone has faced this issue or if there is a better way of approaching this with photon?

So the way our time synchronization works is once there is 2 players in the room the masterclient sends a rpc with the UnixTimestamp for when the game should start, with the RpcTarget set as AllBuffered/AllBufferedViaServer (both don't fix the problem). Then the client adds the unixtimestamp to the local DateTime variable therefore everyone should technically have the same timer regardless of whether someone joins in 5 seconds later.
However for some reason we are testing with 3 players and there is always at least 1 player who is 5 seconds behind and the other two are a few seconds apart.

Here is our code:

Comments

JPGOrdon
2020-10-13 09:14:11

Can't you simply using Photon's provided timestamps for RPCs? You could even save a time stamp from an RPC, particularly the one that starts the game. Check here.

Afterlife1707
2021-06-18 16:17:09

any update on this? the documentation is not so clear and I'm unable to solve this problem.

Back to top