Search Unity

[RELEASED] Smooth Sync - Smoothly network rigidbodies and transforms while reducing bandwidth

Discussion in 'Assets and Asset Store' started by Fuestrine, Aug 4, 2017.

  1. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    @Fuestrine Do you have any idea what is a good % of packet loss to simulate using Clumsy.exe?
    With 50-100ms ping my trucks do pretty well, but if I throw in 3% packet loss, they start glitching pretty badly.

    Any suggestions to mitigate this?
     
  2. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @Meltdown
    Hmm. I would think 3% would be fine but it's been a bit since I've done in depth testing of it.

    Is this with default settings?
    Maybe try raising the InterpolationBackTime to 2 just as a test and let me know how it goes.
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822


    @Fuestrine These are my settings after tweaking for a full two days. I get better results the lower I have the interpolation back time. These settings work fine with Clumsy.exe set to 50-100ms lag with no packet loss.

    What's strange, is that Velocity driven syncing worked well for me when using Photon peer to peer, but using authoritative server here with Mirror it doesn't work well at all, it gets very jittery, and I've tried all sorts of settings.

    Setting interpolation back time to 2 just makes my trucks slide all weirdly around the track.

    Any other suggestions?
     
    Last edited: Nov 1, 2020
  4. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @Meltdown
    Your InterpolationBackTime is really low and you are most definitely extrapolating a vast majority of the time. It may be fine for your needs, just pointing it out.
    But that does bring up that it's kind of an unexpected use so that behavior isn't really tested.
    I'll have to take a look at this one and see if we can support this kind of extrapolation.

    For Velocity Driven Syncing being bad these days:
    One thing I'd make sure of is that you are only moving the vehicle on the owner. A common cause of jitter is trying to move the car on the non-owner which won't work because Smooth Sync is also moving the car on the non-owner and they end up fighting eachother.

    I wouldn't think setting InterpolationBackTime to 2 would make the trucks slide weird. I'd just expect the trucks to be two seconds in the past.
    Does this not sound like what you are seeing?
     
    Meltdown likes this.
  5. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    @Fuestrine Yes I removed the throttle off the local client and that improved Velocity driven syncing, thanks. Interpolation back time is now a healthy 0.5.

    Setting Clumsy.exe packet loss to 3% still makes things jump all over the place, once gain with no matter what I try. It makes me question how accurate it is for real-world scenarios.
     
  6. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @Meltdown
    OK. I'll check it out with Clumsy and get back to you. Thanks for letting me know.
     
    Meltdown likes this.
  7. CansecoDev

    CansecoDev

    Joined:
    Sep 26, 2018
    Posts:
    1
    Hello! I just got this asset and sent you the invoice
     
  8. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    In Clumsy make sure to select the option right at the bottom of the dropdown, the IPv6All option.
    Everything works fine with 50-100ms lag, but Drop set at 3% is where I get major issues.

    Here is a screenshot of the settings I'm using in Clumsy
    https://imgur.com/BKgu4PB
     
    Last edited: Nov 3, 2020
  9. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @srcanseco
    Sent you the fix for the new version of Mirror. Sorry about the incompatibility. :)
     
    Last edited: Nov 3, 2020
  10. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    @Fuestrine The guy who writes the UDP transport for Mirror says he doesn't recommend I use Clumsy to test the packet loss, he recommends testing with a VPS, so I'll get one setup and I'll let you know if I still have any issues!

    Hopefully that will be this final problem solved!
     
  11. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    Smooth Sync 3.28 is now live!

    Change log:
    - Fix for latest Mirror (v26.2.2) compatibility
     
    Last edited: Nov 4, 2020
    Vincent454 and PartyBoat like this.
  12. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Hi, i have a question. How can i properly disable all physics calculations and mirror smoothsync update calculations on client?
    What i did:
    1) Setted send position and rotation threshold to 0.02
    2) Setted Transform source to Server

    What i cant do:
    I wanned to remove rigidbody on client, but i have error from smoothsync that rb was authociated but destroyed. Then i found a method that finding rigidbody on paren "SetObjectToSync" and call it after destroy rigidbody, but error still exist.

    And i did one step more:
    I just setted rb.isKinematic to true and r.DetectCollision to false

    But i still have physics calculations and smoothsync fixed update on client.
    123.png
     
    Last edited: Nov 5, 2020
  13. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @SnaiperoG
    If you want to remove rigidbody at runtime, you'll probably need to run SmoothSync.Awake() right after that so Smooth Sync knows there's no rigidbody any more.

    If you want to stop Smooth Sync updates, you should be able to just disable the Smooth Sync component.

    Let me know how it goes.
     
  14. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    I already tried to call Awake, and there is still an error.
    Also, sorry, i mean i wanna stop smooth sync updates on client, when its not moving on server. For me it seems thresholds doesnt work and i still get smooth sync updates on profiler.

    My code:

    Code (CSharp):
    1. public class Item : NetworkBehaviour
    2. {
    3.     public Rigidbody rb;
    4.     public Gravity gravity;
    5.     public Smooth.SmoothSyncMirror ss;
    6.     public ItemBase item;
    7.     public GameObject itemGO;
    8.  
    9.     // Start is called before the first frame update
    10.     void Awake()
    11.     {
    12.         itemGO = gameObject;
    13.  
    14. #if UNITY_SERVER
    15.         GetComponent<Gravity>().isSpawned = true;
    16. #else
    17.         //rb.isKinematic = true;
    18.         //rb.detectCollisions = false;
    19.         //gameObject.layer = 21;
    20.         Destroy(rb);
    21.         Destroy(gravity);
    22.         ss.Awake();
    23. #endif
    24.  
    25.     }
    26. }
    Error:

    errors.png


    Then i put code from Awake to Start. And it seems it work for some reason 50\50. I have Mirror proximity checker in scene and when it spawn object that close to player i randomly have that error again. Im not 100% sure that proximity checker is a reason of this. I put Debug.log at start to check, and it calls and it calls Awake function, but still have this.
     
  15. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @SnaiperoG
    Smooth Sync isn't really made to be run in either of those ways so I can't really offer much help as far as gaining those features. There probably is some optimization to be made client side when not receiving updates, but I haven't had much optimization complaining and I've got a lot on my plate currently so I'm not looking to take another deep dive into optimization right now.

    Feel free to ask any specific questions about the code though, or let me know if you think I have any core issues and I'm misjudging the questions.

    I don't see how running Awake() wouldn't solve the rigidbody issue though because every access to the rigidbody is done after after checking if there is one, which is done in Awake(). My guess is you are doing something strange.
    I would just stick a bunch of null reference checks around the code if you want this functionality. (even though there essentially already is with my hasRigidbody variables).

    As for your not updating the client when the server isn't moving, you can try sticking some conditional around applyInterpolationOrExtrapolation() but it's going to get messy because it needs to check if it's received anything at some point.
    You could maybe turn it back on again when it AddState()s (which is the code it goes through when it receives a new State).
    That sounds like it'd work and it'd work decently enough. Probably some edge cases though like judging when to exactly stop the updating (most likely if latest received state.ownerTime + InterpolationBackTime has passed or something).

    Cheers. :)
     
  16. magglemitch

    magglemitch

    Joined:
    Dec 8, 2013
    Posts:
    112
    Hi there - just got this plugin and the results are amazing! I've been using PUN2 and its improved by like 1000% - awesome work!

    Still very new to networking and am developing a game using two players with rigidbody rigs. Right now each player is calculating their own RB physics and that is synced to the other - but I'm having trouble getting the characters to influence the others physics like you could locally. Do you know of any particular way I can look at doing that?
     
  17. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @magglemitch
    You'll want all moving objects owned by the same system if you want them to bounce off each other all perfectly. Or you can RPC over an AddForce() or something like that.
     
  18. magglemitch

    magglemitch

    Joined:
    Dec 8, 2013
    Posts:
    112
    Thanks for the reply! I've gone and made it so everything is being calculated on the one system and the other one is just sending movement values to drive their character. Works perfectly other than the bit of 'input lag' you get from the second player. Is there any faster/more efficient way to send values (in this case just floats)? I've been just using OnPhotonSerializeView.

    Otherwise I'm just considering adding in some lag to the host player to compensate and make it a bit more fair!
     
  19. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    ok, got it.
     
  20. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    The only way you'd be able to do this 'accurately' is have one server or client completely handle the physics collisions, and send the resulting transforms to the other client. I've been building a racing game and have battled with this, and found simulating the physics in one place is the only real way to go.
     
  21. cpasjuste

    cpasjuste

    Joined:
    Apr 2, 2012
    Posts:
    154
    Hi there! I did finally buy the package :)

    Else, i do have the same problem, but "fixed" it. But I wanted to use SmoothSync only for players, and Mirror "NetworkTransform" for some projectiles (grenades) as i don't need accuracy or so. But it seems Mirror "NetworkTransform" is not usable when using SmoothSync:

    Code (CSharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. Smooth.SmoothSyncMirror.AssignAuthorityCallback (Mirror.NetworkConnection conn, Mirror.NetworkIdentity theNetID, System.Boolean authorityState) (at Assets/Extensions/Smooth Sync/Mirror/Smooth Sync Asset/SmoothSyncMirror.cs:1970)
    4. Mirror.NetworkIdentity.AssignClientAuthority (Mirror.NetworkConnection conn) (at Assets/Extensions/Mirror/Runtime/NetworkIdentity.cs:1349)
    5. CS2DPlayer+<ShootGrenadeRoutine>d__29.MoveNext () (at Assets/CS2D/Scripts/CS2DPlayer.cs:290)
    6. UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <9674024ab0e74d27bbe9eaa30dab34d1>:0)
    7.  
    Code (CSharp):
    1.  
    2. var childObjectSmoothSyncs = target.GetComponent<SmoothSyncMirror>().childObjectSmoothSyncs;
    3.  
    So i tried with SmoothSync (sync my grenades) but it seems there's a (random) problem, sometime, it will crash with this logs:
    Code (CSharp):
    1.  
    2. ReadNetworkIdentity netId:4 not found in spawned
    3. UnityEngine.Logger:LogFormat(LogType, String, Object[])
    4. Mirror.NetworkReaderExtensions:ReadNetworkIdentity(NetworkReader) (at Assets/Extensions/Mirror/Runtime/NetworkReader.cs:391)
    5. Smooth.SyncProjectilesMessageFunctions:Deserialize(NetworkReader) (at Assets/Extensions/Smooth Sync/Mirror/Smooth Sync Asset/StateMirror.cs:540)
    6. Mirror.NetworkReader:Read() (at Assets/Extensions/Mirror/Runtime/NetworkReader.cs:132)
    7. Mirror.<>c__DisplayClass6_0`2:<MessageHandler>b__0(NetworkConnection, NetworkReader, Int32) (at Assets/Extensions/Mirror/Runtime/MessagePacker.cs:114)
    8. Mirror.NetworkConnection:InvokeHandler(Int32, NetworkReader, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:191)
    9. Mirror.NetworkConnection:TransportReceive(ArraySegment`1, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:249)
    10. Mirror.NetworkServer:OnDataReceived(Int32, ArraySegment`1, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkServer.cs:565)
    11. UnityEngine.Events.UnityEvent`3:Invoke(Int32, ArraySegment`1, Int32)
    12. kcp2k.KcpTransport:<Awake>b__11_4(Int32, ArraySegment`1) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:51)
    13. kcp2k.<>c__DisplayClass20_0:<Tick>b__1(ArraySegment`1) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:168)
    14. kcp2k.KcpConnection:TickAuthenticated(UInt32) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:236)
    15. kcp2k.KcpConnection:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:256)
    16. kcp2k.KcpServer:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:210)
    17. kcp2k.KcpTransport:LateUpdate() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:92)
    18.  
    Code (CSharp):
    1.  
    2. Could not find target for network StateMirror message.
    3. UnityEngine.Debug:LogWarning(Object)
    4. Smooth.SyncProjectilesMessageFunctions:Deserialize(NetworkReader) (at Assets/Extensions/Smooth Sync/Mirror/Smooth Sync Asset/StateMirror.cs:543)
    5. Mirror.NetworkReader:Read() (at Assets/Extensions/Mirror/Runtime/NetworkReader.cs:132)
    6. Mirror.<>c__DisplayClass6_0`2:<MessageHandler>b__0(NetworkConnection, NetworkReader, Int32) (at Assets/Extensions/Mirror/Runtime/MessagePacker.cs:114)
    7. Mirror.NetworkConnection:InvokeHandler(Int32, NetworkReader, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:191)
    8. Mirror.NetworkConnection:TransportReceive(ArraySegment`1, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:249)
    9. Mirror.NetworkServer:OnDataReceived(Int32, ArraySegment`1, Int32) (at Assets/Extensions/Mirror/Runtime/NetworkServer.cs:565)
    10. UnityEngine.Events.UnityEvent`3:Invoke(Int32, ArraySegment`1, Int32)
    11. kcp2k.KcpTransport:<Awake>b__11_4(Int32, ArraySegment`1) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:51)
    12. kcp2k.<>c__DisplayClass20_0:<Tick>b__1(ArraySegment`1) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:168)
    13. kcp2k.KcpConnection:TickAuthenticated(UInt32) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:236)
    14. kcp2k.KcpConnection:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:256)
    15. kcp2k.KcpServer:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:210)
    16. kcp2k.KcpTransport:LateUpdate() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:92)
    17.  
    Code (CSharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. Smooth.SmoothSyncMirror.HandleSync (Mirror.NetworkConnection conn, Smooth.NetworkStateMirror networkState) (at Assets/Extensions/Smooth Sync/Mirror/Smooth Sync Asset/SmoothSyncMirror.cs:2440)
    4. Mirror.MessagePacker+<>c__DisplayClass6_0`2[T,C].<MessageHandler>b__0 (Mirror.NetworkConnection conn, Mirror.NetworkReader reader, System.Int32 channelId) (at Assets/Extensions/Mirror/Runtime/MessagePacker.cs:128)
    5. Mirror.NetworkConnection.InvokeHandler (System.Int32 msgType, Mirror.NetworkReader reader, System.Int32 channelId) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:191)
    6. Mirror.NetworkConnection.TransportReceive (System.ArraySegment`1[T] buffer, System.Int32 channelId) (at Assets/Extensions/Mirror/Runtime/NetworkConnection.cs:249)
    7. Mirror.NetworkServer.OnDataReceived (System.Int32 connectionId, System.ArraySegment`1[T] data, System.Int32 channelId) (at Assets/Extensions/Mirror/Runtime/NetworkServer.cs:565)
    8. UnityEngine.Events.InvokableCall`3[T1,T2,T3].Invoke (T1 args0, T2 args1, T3 args2) (at <9674024ab0e74d27bbe9eaa30dab34d1>:0)
    9. UnityEngine.Events.UnityEvent`3[T0,T1,T2].Invoke (T0 arg0, T1 arg1, T2 arg2) (at <9674024ab0e74d27bbe9eaa30dab34d1>:0)
    10. kcp2k.KcpTransport.<Awake>b__11_4 (System.Int32 connectionId, System.ArraySegment`1[T] message) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:51)
    11. kcp2k.KcpServer+<>c__DisplayClass20_0.<Tick>b__1 (System.ArraySegment`1[T] message) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:168)
    12. kcp2k.KcpConnection.TickAuthenticated (System.UInt32 time) (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:236)
    13. kcp2k.KcpConnection.Tick () (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:256)
    14. UnityEngine.Debug:LogException(Exception)
    15. kcp2k.KcpConnection:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpConnection.cs:281)
    16. kcp2k.KcpServer:Tick() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/kcp2k/highlevel/KcpServer.cs:210)
    17. kcp2k.KcpTransport:LateUpdate() (at Assets/Extensions/Mirror/Runtime/Transport/KCP/MirrorTransport/KcpTransport.cs:92)
    18.  
    I wonder if this could comes from "NetworkServer.Destroy(gameObject);" being called on server, or maybe a problem with SmoothSync and kcp transport ?

    Edit: i think i "fixed" it, not sure if it's the way to go:

    SmoothSyncMirror, line 2440:
    Code (CSharp):
    1.  
    2. if (networkState.smoothSync == null || networkState.smoothSync.netID.connectionToClient != conn) return;
    3.  
    Code (CSharp):
    1.  
    2. if (networkState == null || networkState.smoothSync == null || networkState.smoothSync.netID.connectionToClient != conn) return;
    3.  
     
    Last edited: Nov 12, 2020
    harleydk likes this.
  22. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    Version 3.29 is now live on the Asset Store.

    Change Log:
    Fix for extrapolating too much after teleporting if no other states are received.
    Fix for jitter on latency variations and pausings.
    Mirror:
    Fix for automatic Authority Changes when using NetworkServer.ReplacePlayerForConnection()
     
    Last edited: Nov 20, 2020
    Vincent454 likes this.
  23. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @cpasjuste
    If you don't notice any wierdness, that seems like a good fix to me!

    I'd expect you to be able to use the NetworkTransform and Smooth Sync at the same time though. It's weird that it doesn't work that way. If just adding the null check there fixes it, it seems even stranger and I'm even more confused.
    Thanks for letting me know about it. I'll add it to my list of things to look into. It sounds like it's solved for you but let me know if you have any outstanding issues. :)
     
  24. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    Version 3.30 is now live on the Asset Store.

    Change Log:
    Updated to work with Mirror v28.1.3
     
    Last edited: Nov 20, 2020
    Vincent454 likes this.
  25. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    Hi @Fuestrine,
    I'm looking at different network sync plugins and seems like another competitor with less review seems to work with "any"/custom network backend.
    What about yours? Is it also extensible?
     
  26. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @jGate99
    No. Many people have converted to different networking systems but it would require work from you to do it.
     
  27. israfilagr

    israfilagr

    Joined:
    Feb 14, 2020
    Posts:
    3
    @Fuestrine
    when using mirror network , spawnable prefab and player don't works well at the time of collision. how do i set my prefab and players?Is there a way to make them delicate?
    i used your smooth sync mirror script in my project
     
  28. israfilagr

    israfilagr

    Joined:
    Feb 14, 2020
    Posts:
    3
    @Fuestrine
    For example how to make collision of players and ball sensitive
     
  29. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @israfilagr
    In order to have perfect collisions where both objects are moving, you'll need to have the objects owned by the same system. Typically this is the server.

    Let me know if this isn't what you are asking about. :)
     
  30. israfilagr

    israfilagr

    Joined:
    Feb 14, 2020
    Posts:
    3
    @Fuestrine
    as you see screenshots when moving players backwards with the ball, i observed this situation.
    Edit:fox have 2d box collider and first player is true
     

    Attached Files:

    Last edited: Dec 1, 2020
  31. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @israfilagr
    I'm sorry but I don't think I understand what you are asking. Can you say it differently?
    If you are talking about making things more in line with the two screenshots, you can lowerInterpolationBackTime, raising the EasingSpeeds, and raise TimeCorrectionSpeed. Mouse over these variables in Unity for detailed information and what the consequences may be.
     
    Last edited: Dec 1, 2020
  32. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    CosmicStud likes this.
  33. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
  34. K4rha

    K4rha

    Joined:
    Aug 7, 2014
    Posts:
    30
    There seems to be an issue with the new Mirror KPC Transport and Smooth Sync. When joining the server, the connecting client gets automatically disconnected.
     
  35. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @K4rha
    I wish Mirror would stop completely changing everything. :(

    Thanks for letting me know about it! :)
    The last time I had an issue with a Mirror transport change, it was related to the channels not being the same as the other transports. So if you want to look into it before I get time to look into it, look into the channel being set in SmoothSyncMirror.cs and maybe set it to just 0 or 1 or whatever is supported by the transport.
    Otherwise, I should get some time to look into it in the upcoming week or so.
     
  36. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @K4rha
    I'm actually not getting this issue when I use the example scene provided by Smooth Sync for Mirror when I do Listen Server and Dedicated Server. The only difference in the example scene is that I switched out the Telepathy transport for the KCP transport supplied by Mirror in their Asset Store version.

    Is this issue happening in the example scene provided by Smooth Sync for Mirror for you?

    Do you have any tips on how to recreate the issue so I can see what may be going wrong?
     
    Last edited: Dec 7, 2020
  37. K4rha

    K4rha

    Joined:
    Aug 7, 2014
    Posts:
    30
    After coverting the whole project back to a non beta version of unity, everything seems to work fine. The client always kept disconnecting when connecting to the server, even in the demo scene. I don't really know why this happened, but it works now.
     
  38. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @K4rha
    Glad to hear it! If you like my asset and my support, every five star rating helps us get noticed a bit more. :) Cheers!
     
  39. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    MLAPI Support is officially on the Asset Store!
     
    blacksun666 and Vincent454 like this.
  40. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @OnlyTheCosmos
    Figured I'd ping you since you responded my MLAPI comment. MLAPI support for Smooth Sync is now on the Asset Store.
     
  41. aimkid

    aimkid

    Joined:
    Jan 20, 2014
    Posts:
    2
    Hey! I'm fairly new to networking physics in Unity, is there a way to have local rigidbodies smoothly interact with rigidbodies that aren't owned by using this script? More specifically, the player is a rigidbody, and my goal is to get clients to be able to push ownerless rigidbodies around the same way the server owner can. My current problem is that the server can push these objects around fine, but the clients can barely budge them even after replacing Network Transform with this script. I've seen footage of the behavior I'm looking for with minimal configuration here, so I wonder if I'm just missing a setting? Thanks in advance!
     
  42. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @aimkid
    There really isn't a perfect way to have objects owned by separate systems have perfect bouncing physics. The real way through this hurdle is to have the objects owned by the same system, this is typically the server. Another way would be to RPC over some AddForces or something to the owner on collision. Another way might be trying the UseVelocityDrivenSyncing under Miscellaneous tab in the Smooth Sync settings.
    I'm not sure which of the above options the video is using but my guess is it's one of them.

    Another crazy idea may be to have a super lower InterpolationBackTime on the car so that it is extrapolating into the future a lot, but you may see some jitter.
     
  43. aimkid

    aimkid

    Joined:
    Jan 20, 2014
    Posts:
    2
    Ahh thats understandable, thank you lots!
     
  44. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Hello again, i use mirror for network and i tested smoothsync with my enemies before, and had one issue but i thought that's normal when i tested it. For test my network code i using parrelsync, it's a solution to open more then one unityeditor windows to simulate different clients. So here is the issue: i have a server on unity editor in first window, and client on second window, and when i enable gizmos on server, everything start lagging because of many gizmos in scene, and my enemies on clients starts random bug movement and i thought its normal, but i test this method with standart mirror networktransform and it works as expected without lags. One more thing, even in build smoothsync still produce these lags. And for now i just cant using smoothsync anyway. I recorded a video to demostrate whats happening.

     
  45. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @SnaiperoG
    Are you using the default Smooth Sync settings? If not, try those out (EXCEPT: change Snap Time Threshold to 0.3 instead of 3.0) and let me know how it goes. If defaults plus the SnapTimeThreshold at 0.3 don't make this go away, paste me your settings and I can maybe see what might be too extreme of a setting.

    Do you have the latest Smooth Sync? If not, try the latest Smooth Sync.

    I'm not seeing this in the example scene provided by Smooth Sync for Mirror though. Does this happen in the Smooth Sync Mirror example scene for you? If not, take a look at what may be different between your setup and the setup there and let me know if the solution doesn't seem apparent. SmoothSyncMirrorPlayerPrefab are the networked objects in that scene.

    One thing that may produce jitter like you are seeing is that you could be moving the object on both your owner and non-owner. You should only be moving the object on the owner since Smooth Sync will handle all updates on non-owned objects.

    Let me know how it goes or if you have any questions. :)
     
    Last edited: Dec 18, 2020
  46. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Well, i changed only send and received pos and rot thresholds, and variables to Sync, but here is the thing that i use navmesh agent to move my enemies and i dont know how exacly it moving my enemies, by transform or rigidbody, maybe there is a my fault of some point, that i use wrong variable to sync.
    v.3.27 with fix that you pm'ed to me.
    And because im using navmeshagent, it has been removed from clients, so movement going only on the server.
    I will update smoothsync and try to make changes as you described and check smoothsync example scene, will it bug or not. Thanks.
    There is my settings for now.
    ssSettings.png
     
  47. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Ok, ive tryied to make some changes, but still havent result as a standart mirror networktransform. I setted Snap Time Threshold to 0.3 and nothing. Ive setted all variables to sync to xyz and it goes better. And the last one, i found that problem goes with extrapolation, i disable it (setted to none), and problem gone, but still have sometime little rare jumping and teleporting, what much less in networktransform. Networktransform only have rare teleporting. Also i think problem goes when rigidbody contact with ground what has small collider, like plane, or mesh collider, because jumping increases when my enemies walk on ground which has mesh collider.
     
  48. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Here is simple test scenes to reproduce the bug. Put folder in assests folder.
    1) Run the scene
    2) Start host or server on one window (i use parrelsync)
    3) Start client on another
    4) Go to the server window
    5) Enable "Scene" tab (client will start take small bugs with smoothsync)
    6) Enable "Gizmos" gameobject (make sure "Gizmos" toogle ON on "Scene" tab)
    7) Watch client window lags with smoothsync

    Repeat steps for networktransform scene. There are no bugs.

    UPD: I changed ground mesh to big cube. Still have bugs
    UDP2: I found a strange thing. In my Edit->Project Settings->Physics, was no physycs iteractions in collision matrix between player and ground and it works good. I enable it, and smoothsync objects starts run away to the corners of box ground mesh. I guess its happening only with flat surface. You can check it by yourself or i can recond a video
     

    Attached Files:

    Last edited: Dec 19, 2020
  49. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    @SnaiperoG
    I don't see any lags or jitter on client when I use the Smooth Sync from the Asset Store with default settings, set SnapTimeThreshold to .3, and follow your instructions with your zip file.

    Have you tried doing that?
     
  50. SnaiperoG

    SnaiperoG

    Joined:
    Apr 6, 2015
    Posts:
    66
    Yes, there is a new scene, asset store last versions of mirror and smooth sync. Everything in an video. Also i get that objects which going to the plane corners, its a navmesh agent issue, but, on the plane which has thin collider bug visible much more better, and also there is clearly vision that is a extrapolation bug. Idk why its happening even if increase collider size its still present