Hello,
I’ve setup a P2P communication on the same computer between two instances of the same game, with different authentications, so local product user ids are different.
I make the connection, and then right now I send local timestamped (with the GetSystemTimePreciseAsFileTime WIN32 api function) ping and pongs messages just to measure roundtrip (on each instance between ping and received pong) and the “receive lag” so to speak from the timestamp as I am on the same machine.
Now here’s the mystery. From instance A to B I get receive lag of 0.01 seconds. From B to A it goes up to 2 seconds (not milis, seconds!)
Round trip measured is correct, 2 seconds total.
These are some reported times, not the precise frames.
Instance A:
[INFO] Received ping with time dif = 0.01
[INFO] Got pong - NET Roundtrip time = 2.00
Instance B:
[INFO] Received ping with time dif = 1.98
[INFO] Got pong - new lag for 000002B39DF0C970 = 2.02
All I’m doing is this:
1) after connection established I send big pack of data from B to A (maybe a couple of mbytes segmented in 1-2000 reliable packages)
2) then I send nothing but pings and pongs each second from both of them to the other.
I don’t get the times and I don’t get how the relay can favor a client so much. Is this normal? Also the 2 seconds round trip pretty much makes the game unplayable unfortunately.
Any advice?
Hello, Can you answer the following questions:
- Which EOS SDK version are you using?
- How frequently are you calling EOS_Platform_Tick?
- Are you testing this on a corporate network? If you are, can you test this on another network to rule out anything at the corporate network layer slowing things down?
- Can you add timestamped log messages when EOS_P2P_SendPacket and EOS_P2P_ReceivePacket are called?
- Can you see if you can reproduce using our NAT P2P sample?
I tried the NAT P2P sample bundled in the 1.17 C SDK download. On my end, I’m seeing round trips well below 0.5ms, and I’m manually clicking “Enter” (I didn’t modify the sample) to send packets.
Hello,
Thanks for answering. The good news is because you asked me the logs I’ve noticed the clients were spamming the Server on each frame with their sync messages. The higher the framerate the more we clogged the network was. With that fixed properly we noticed normal pings between the server and the client. We missed this part because we logged only “reliable” calls and the spam of unreliable ones seems to end up in high pings.
Not very relevant any more but these are the answers:
The SDK version is v1.17.0
We call EOS_Platform_Tick on the game’s framerate, which I think it might be a bit too much, there’s very few cases when the thick time goes above 1-2 seconds. We’ll move it on a secondary thread.
Tests where on a variety of networks. Even tried a Starbucks wifi 
Anyway, thanks for answering and helping fix this just by asking for info.
Hello,
You definitely want to call EOS_Platform_Tick every frame, and we recommend calling it on the main thread. You can always use TickBudgetInMilliseconds in EOS_Platform_Options if you want to limit the amount of time spent in the SDK. The budget is checked after each operation the SDK does, and if it’s exceeded, the SDK will stop performing operations and resume on the next tick.
The SDK is NOT thread-safe. If you do decide to move SDK calls to a secondary thread, make sure to move ALL SDK calls. Using the SDK across multiple threads is the number 1 reason for crash reports with EOS.
Thanks,
Seb
ok, main thread FPS rate it is then 
thank you for the advice.