RPC and the timestamp info
Options
Henryos
✭
Hello people
I'm new with photon and is the first time I'm writing in this forum.
At the moment I'm working in a fps multiplayer project where I need to implement a sort of Lag compensation (https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking)
To acomplish this, the master client needs to know exactly "When" the RPC was sent from the client.
I have elaborated several theories, but none of them are completely perfect:
1. By trial and error I have found that: RPCSendTime=PhotonNetwork.time-(RoundTripTime/1000)*2,2
2. Reading the parameter PhotonMessageInfo info.timestamp when I receive the RPC
Sometimes they work, and sometimes they are far away from be correct.
So my question is, How could I determine in the Master client "When" the RPC was sent from the client?
I know I should do in the Master client something like:
PhotonNetwork.time-(latency of the packets)
or should I use the attribute info.timestamp?
or is there another attribute I am missing?
Thanks in advance guys!
I'm new with photon and is the first time I'm writing in this forum.
At the moment I'm working in a fps multiplayer project where I need to implement a sort of Lag compensation (https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking)
To acomplish this, the master client needs to know exactly "When" the RPC was sent from the client.
I have elaborated several theories, but none of them are completely perfect:
1. By trial and error I have found that: RPCSendTime=PhotonNetwork.time-(RoundTripTime/1000)*2,2
2. Reading the parameter PhotonMessageInfo info.timestamp when I receive the RPC
Sometimes they work, and sometimes they are far away from be correct.
So my question is, How could I determine in the Master client "When" the RPC was sent from the client?
I know I should do in the Master client something like:
PhotonNetwork.time-(latency of the packets)
or should I use the attribute info.timestamp?
or is there another attribute I am missing?
Thanks in advance guys!
0
Comments
-
Hi and welcome
If you need lag compensation for player movement and positioning, I would strongly recommend you try first the PhotonTransforView Component which features several options to synchronise position and rotation. You'll have extrapolation options as well.
For custom lag, you'll need to take in account the roundtrip ping with PhotonNetwork.GetPing() and rpc info timestamp.
How do you witness the accuracy of timestamps?
https://doc.photonengine.com/en/pun/current/tutorials/rpcsandraiseevent
a good read on timestamp:
http://forum.photonengine.com/discussion/1295/photonmessageinfo-timestamp-broken
Bye,
Jean0