Search Unity

Bug [1.0.0-exp.13] Distance-based importance doesn't work?

Discussion in 'NetCode for ECS' started by asdfgas-dgasdg, Nov 21, 2022.

  1. asdfgas-dgasdg

    asdfgas-dgasdg

    Joined:
    Oct 25, 2012
    Posts:
    7
    Seems distance-based importance doesn't work or documentation has wrong examples of usage.

    Reproduce:
    Open example Asteroids project, increase level width/height to 10,000 increase asteroids num to 20,000.
    On asteroids project with netcode v.0.51 the movement and rotation are smooth, on the same level config on netcode v.1.0.0 (latest from multiplayer example repo) asteroids move and rotate with jitter.
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    I've been able to repro that it doesn't work in 1.0.0, thanks for the report! On it, will reply here when fixed.
     
  3. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    The issue has been found and resolved, but it unfortunately just missed the current window.
    It'll be in an upcoming release.

    The fix shouldn't be a breaking change, and it's added to the changelog, so I'd suggest just leaving it unoptimized for now (and/or using Relevancy to cull in a radius). LMK if fix is needed urgently.
     
  4. asdfgas-dgasdg

    asdfgas-dgasdg

    Joined:
    Oct 25, 2012
    Posts:
    7
    Thank you , I will wait for the release with the fix.
    btw what is the Relevance feature, is there documentation? , seems it also doesn't work on Asteroid project, it spawn batch of errors when I change "Relevancy Radius" greater then 0?

    UPD: Relevance works on Asteroids project, just need small fix: add [ReadOnly] to this job:

    Code (CSharp):
    1.  [BurstCompile]
    2.         partial struct ConnectionRelevancyJob : IJobEntity
    3.         {
    4.             [ReadOnly]   public ComponentLookup<Translation> transFromEntity;
    5.             public NativeList<ConnectionRelevancy> connections;
    6.  
    7.             public void Execute(in NetworkIdComponent netId, in CommandTargetComponent target)
    8.             {
    9.                 if (target.targetEntity == Entity.Null || !transFromEntity.HasComponent(target.targetEntity))
    10.                     return;
    11.                 var pos = transFromEntity[target.targetEntity].Value;
    12.                 connections.Add(new ConnectionRelevancy{ConnectionId = netId.Value, Position = pos});
    13.             }
    14.         }
     
    Last edited: Nov 22, 2022
    NikiWalker likes this.
  5. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    316
    Thanks again for the report, and the fix! It'll also land ASAP. I've just looked, and relevancy is not mentioned in the docs at all (other than the changelist). We'll get on that too.