Search Unity

[Unity Netcode] Jittery movement when SimulationTickRate and NetworkTick rate is 30

Discussion in 'NetCode for ECS' started by khalid_mightybear, Feb 17, 2020.

  1. khalid_mightybear

    khalid_mightybear

    Joined:
    Sep 10, 2017
    Posts:
    36
    The red cube from the NetCube scene in the netcode samples is very jittery when the simulationtickrate and networktickrate is set to 30. Works fine when it is set to 60.

    I get a few warnings:
    Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
     
  2. khalid_mightybear

    khalid_mightybear

    Joined:
    Sep 10, 2017
    Posts:
    36
    Oops, my error. I converted the ClientServerTickRate on both the client and the server. So, there's 2 ClientServerTickRate on the client side, one that I created and another that is probably created in NetCode. Since it's no longer a singleton, it failed to query for a singleton and used the default values. The fix was just to convert the entity on the server side
     
  3. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    Good that you found the problem. I have filed an issue for us to improve the error message to make it easier to figure out for the next person to run into it.
     
    Opeth001 and florianhanke like this.
  4. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
    I have this problem, but am a complete noob. How exactly did you set this TickRate?

    Edit: Just finished the getting started guide for NetCode, and getting jittery movement and allocation warnings. Haven't customized anything at all.
     
    WireWhiz likes this.
  5. Virland

    Virland

    Joined:
    May 18, 2014
    Posts:
    10
    Hello! Version: 2020.1.2f1.4316 Personal, NetCode Version 0.2.0-preview.5 - June 05, 2020
    I just created a new project, installed netcode, pressed the play button and now getting warnings spam

    Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

    Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
    Unity.Collections.LowLevel.Unsafe.UnsafeUtility:Free(Void*, Allocator)
    Unity.Entities.EntityCommandBufferData:DestroyConcurrentAccess() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/EntityCommandBuffer.cs:405)
    Unity.Entities.EntityCommandBuffer:Dispose() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/EntityCommandBuffer.cs:1014)
    Unity.Entities.EntityCommandBufferSystem:FlushPendingBuffers(Boolean) (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/EntityCommandBufferSystem.cs:249)
    Unity.Entities.EntityCommandBufferSystem:OnUpdate() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/EntityCommandBufferSystem.cs:188)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystem.cs:109)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:445)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:398)
    Unity.NetCode.ServerSimulationSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.netcode@0.2.0-preview.5/Runtime/ClientServerWorld/ServerSimulationSystemGroup.cs:74)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystem.cs:109)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:445)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:398)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystem.cs:109)
    Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:445)
    Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystemGroup.cs:398)
    Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ComponentSystem.cs:109)
    Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.11.0-preview.7/Unity.Entities/ScriptBehaviourUpdateOrder.cs:192)

    Is it okay?
     
    Last edited: Aug 21, 2020
  6. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    The 4 frames old warning is because the server is running with a fixed timestep. When your game is fast enough one server frame is actually more than 4 render frames, and Unity uses render frames to measure age. For that reason it is not possible to free the data within 4 frames in a server world.
    We will try to figure out a way to deal with that better, in the meantime the only workaround I know of is to enable VSync under the "Free Aspect" dropdown in the game view.
     
    Cuttlas-U, friflo, AdamBebko and 2 others like this.
  7. AdamBebko

    AdamBebko

    Joined:
    Apr 8, 2016
    Posts:
    168
    Is this needed only in server? Or is this an editor-specific problem?
     
  8. FakeByte

    FakeByte

    Joined:
    Dec 8, 2015
    Posts:
    147
    Its a Netcode problem, has nothing to do with the editor. If you build a standalone server the problem will still be there.
     
  9. Cuttlas-U

    Cuttlas-U

    Joined:
    Apr 11, 2017
    Posts:
    38
    yep , I have the problem on the recent update v 0.6.0;
    the only workaround was to lock target frame rate on 200 in the server build ;
     
  10. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    896
    It is neither a NetCode issue too, this is more like a general "issue" due to how the allocation leak tracking works. If all your game (not just one system) run at fixed time steps larger than the rendering frame time you will get this error.
     
    Cuttlas-U likes this.
  11. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @CMarastoni I see. Is there plan to change the behavior of allocation leak tracking? I believe it's belongs to job system right?