Network icons in Game
Options
Hi!
I wanted to add a system in my game like in most online games, when you have a poor connection (like latency or packet loss) some icons are displayed on screen to tell the player (speedometer for latency or dotted squares for packet loss).
I already managed to do the latency icon by getting the ping of the player, but I wanted to know if there was a way to do the same for packet loss? Is there a way to know how many packets were lost before a RPC arrived or when sending data by stream with OnPhotonSerializedView?
Thanks
I wanted to add a system in my game like in most online games, when you have a poor connection (like latency or packet loss) some icons are displayed on screen to tell the player (speedometer for latency or dotted squares for packet loss).
I already managed to do the latency icon by getting the ping of the player, but I wanted to know if there was a way to do the same for packet loss? Is there a way to know how many packets were lost before a RPC arrived or when sending data by stream with OnPhotonSerializedView?
Thanks
0
Comments
-
Packet loss can only be estimated. Or rather: Photon can tell you how often messages are being resent.
PhotonNetwork.NetworkingClient.LoadBalancingPeer.ResentReliableCommands
You could also calculate how long ago this client received anything:LoadBalancingPeer.ConnectionTime - LoadBalancingPeer.TimestampOfLastSocketReceive
When nobody is around, there can be times when only the ping arrives from the server. This will be a 1 sec interval. But as long as you play, there should be no bigger gaps.
0 -
Great thank you, I'll give it a try!0
-
Hi again! So I tried doing "LoadBalancingPeer.ConnectionTime - LoadBalancingPeer.TimestampOfLastSocketReceive" but I always get a negative value. I understand what TimestampOfLastSocketReceive is about but I don't really understand the ConnectionTime value, could you explain it to me please ?
Thanks0 -
Sorry. The ConnectionTime is not correct in this context.
SupportClass.GetTickCount() - LoadBalancingPeer.TimestampOfLastSocketReceive
should work.0 -
Great thank you, that works fine!0