Hi,
I downloaded the NetCode for Entities Samples project and ran the Sample ā Astroids via our relay server and also via DirectConnect.
In MultiPlayer Tool Window:
Latency via Relay Server showed 400 ms+/- (without any clients connecting apart from myself)
Latency via DirectConnect showed 10 ms+/-
Tried downloading and running BossRoom NetCode for GameObjects sample, and on our relay server it ran without latency issues. (even with two clients connecting from different physical locations)
I tried to upgrade all outdated packages in NetCode for Entities Samples to latest versions (as of today 24 aug 2023) but the latency of 400 ms+/- via Relay Server remains the same.
I would expect NetCode for Entities to be at least as performant as NetCode for GameObjects, so what could be the problem? Is there some additional configuration needed in the samples project?
/best regards
Assuming you use the Relay support code from here, I think the problem might be that the sample is picking an arbitrary region, instead of picking the best one based on latency. To check if this is the case, you could try modifying this line to read as follows:
allocationTask = RelayService.Instance.CreateAllocationAsync(RelayMaxConnections, null);
Thank you for your response.
I tried setting the region to null and now it connects with 60ms+/-
I manually tried to set targetRegion to various regions near me, but best latency was still 60ms+/-
This is definitely an improvement but still some 20 - 40 ms above expected when comparing to BossRoom sample.
Is this because the BossRoom sample predicts client side and NetCode Entities sample does not?
Problem is e.g. in the Astroids sample that with 60ms you still clearly notice on your own screen that the projectile goes through the meteor before it is destroyed.
Maybe a difference between how Netcode for Entities and Netcode for GameObjects measure RTT? Unfortunately Iām not familiar with how Netcode for Entities measures that. Maybe someone from the Netcode team will be able to shed some light on this.
In Netcode for Entities the RTT is measured at the net of the processing time performed by the either the server and it is updated every time an RPC, snapshot and commands are received, and it is usually estimate the current round trip time quite decently.
In that RTT, in our sample case and in the editor more specifically, we need also to include the fact there is at the very least 1 frame extra delay in that value, if not because the client and server updates in the same frame, but the server will receive the data from the client at the beginning of the next tick. So, on average we need to account at least another 16ms or more on average (because the server receive at fixed time step, not as soon as possible).