#High latency with relay server in NetCode for Entities Samples project

1 messages · Page 1 of 1 (latest)

fluid zodiac
#

Hi,

In the process of doing a number of POCs for a game on whether to go down the ECS or the GO route. We have completed most of them and it seems stable and performant enough to continue. One of the last things on the list is the POC on NetCode For Entities.

I downloaded the NetCode for Entities Samples project and ran the Sample -> Astroids via our relay server and also via DirectConnect.

In MultiPlayer PlayMode Tools 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 through our relay server it ran without any 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 around 400 ms+/- via Relay Server remains the same.

Is there some additional configuration/setup needed in the samples project or is it simply outdated?

I would expect NetCode for Entities to be at least as performant (or better) as NetCode for GameObjects, so a bit puzzled on what could be the problem?

https://forum.unity.com/threads/high-latency-with-relay-server-in-netcode-for-entities-samples-project.1483722/

fluid zodiac
#

The reason for the 400ms+/- is caused by these two lines of code in HostServer.cs:
var targetRegion = regionList[0].Id;
...
allocationTask = RelayService.Instance.CreateAllocationAsync(RelayMaxConnections, targetRegion);

idx 0 is a relay server in singapore. A unity support told me to try not specifying the targetRegion: allocationTask = RelayService.Instance.CreateAllocationAsync(RelayMaxConnections, null);

This changed the latency to around 60ms+/- much better, but still too high, especially with so simple examples.

Anyhow, I guess the deep dive into NetCode for Entities is just hard work.

Would be great if sample code was updated to reflect latest package versions and also really showcase the power that supposedly lies within using NetCode for Entities.