Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    Hey, I am also working with hundreds if not thousands of active networked objects in the game, some which use Smooth Sync! I notice that you've cached the gameobject that syncs in the MLAPI versions.Though use the gameobject.transform for all operations in update and fixed update, which is a getcomponent call. I hear caching the transform can save 20 percent performance each frame ;), but its debatable per case, I had to squeeze out as much performance as possible haha. Thanks for your hard work and the great asset!
     
    Last edited: Oct 6, 2021
  2. bernt_out

    bernt_out

    Joined:
    Feb 19, 2019
    Posts:
    3
    Awesome, we will definitely look into this, thanks for the tip!
     
  3. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    67
    Thanks for that video. It's really cool to see the performance comparison. It does pain me to see that Smooth Sync lags a bit behind the others especially on the client. It has been a while since I've done any deep optimizing and many features have been added. I suspect it's about time for another pass. Fundamentally though all syncing assets have to do a few heavy tasks like deserializing so there's going to be a base line performance hit no matter what.
     
    13E12K likes this.
  4. 13E12K

    13E12K

    Joined:
    May 4, 2014
    Posts:
    20
    I could only achieve reasonable smoothing while having relative low rotation (0,15) and position(0,5) easing speeds. Does this have other side effects like extra inaccuracy or buffer time between server and client?

    I mean the lower easing speed, the later those transform will be updated at client side? Or is this time only depended on interpolation back time?

    upload_2021-10-12_17-19-45.png
     
  5. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    I'm using smooth sync in my project to sync movement of character. My character move by using CharacterControler. Sometime, in my client, other characters slide on the ground by unknow reason. ( this sliding character on server is stop moving).
    I guess it's due to Extrapolation of smooth sync, but not sure, and don't know how to fix this.
    Does anyone face that problem?
     
  6. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    I just updated to the latest version which solved the Teleport() issue in MLAPI. Thanks :)

    I have discovered another potential bug, but it may be just related to how I'm using it.
    In SmoothSyncMLAPI.OnEnable() there is a NullReferenceException happening when I start from a scene which I'm automatically starting a host to cut down on iteration time. The NRE is because of the NetworkManager.Singleton, so I'm guessing something to do with the order of execution, even though I thought singletons would be set up in the Awake(). Adding a coroutine that polls for the NetworkManager.Singleton solves the issue for me anyway.

    Code (CSharp):
    1.         /// <summary>Automatically sends teleport message for this object OnEnable(). Also add scene loaded event handler.</summary>
    2.         public void OnEnable()
    3.         {
    4.             SceneManager.sceneLoaded += OnSceneLoaded;
    5.             StartCoroutine(PollForNetworkManager());
    6.         }
    7.  
    8.         private IEnumerator PollForNetworkManager()
    9.         {
    10.             yield return new WaitUntil(() => NetworkManager.Singleton);
    11.          
    12.             if (!NetworkManager.Singleton.IsServer)
    13.                 registerClientHandlers();
    14.         }
     
  7. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    67
    @OnlyTheCosmos Just added the transform caching, it will be in the next release. Thanks again for pointing it out.
     
    CosmicStud likes this.
  8. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    Hi @Zebadiah

    I am using photon pun 2. I can sync my networked obj perfectly. However, when owner disconnect and rejoins room, networked obj transfered to other user and its sync start to mess although I call clearbuffer. What do u think about it? Is there a way to completely set smooth sync to initial state?
     
  9. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    289
    Hi @Zebadiah
    It is not about owner change. Whenever client disconnects and rejoin room, sync is messed!!! I waiting your help:)
     
  10. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    Damn, there have been some big breaking changes for MLAPI. First, it's now called Netcode for GameObjects 1.0.0-pre.2. I could update most of the SmoothSync stuff to the new API but there I didn't know how to handle NetoworkWriter and NetworkReader. Didn't seem to be a 1:1 change for that with new API. Its way above my pay grade from here. Is there an update in the works soon?
    Thanks :)
     
  11. bernt_out

    bernt_out

    Joined:
    Feb 19, 2019
    Posts:
    3
    Try turning off extrapolation and let us know if you continue to experience issues!
     
  12. bernt_out

    bernt_out

    Joined:
    Feb 19, 2019
    Posts:
    3
    We are working on updating SmoothSync to work with Netcode, we will let you know when it is released!
     
    Jarppi97, CosmicStud and Brogan89 like this.
  13. Resonantmango

    Resonantmango

    Joined:
    May 28, 2017
    Posts:
    7
    Is there a way to set visibility?

    For our needs we would prefer to only sync to server, not back to all clients. Similar to Mirror's SyncVar SyncMode == Owner.

    So Smooth Sync would do all its stuff, while only synchronizing from each client back to server (not distributing every client's update among all other clients)
     
  14. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    I have turned off extrapolation and some problems gone away. (some problem when syncing position when network speed is low )
    So what i have to do to make extrapolation work correctly?
     
  15. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @trunghieu974
    Does the sliding problem go away when extrapolation is off?
    If so, I'll have to look into extrapolation to see what I can find. Do you find this happening under a particular circumstance more than others?

    For syncing position with low SendRate and for better syncing during large lag spikes, you can increase InterpolationBackTime.
     
  16. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @Resonantmango
    There is no setting like that currently.
    You may be able to edit the code to do what you want though fairly easily.

    Check out the method SendStateToNonOwners() in SmoothSync.cs
    You can maybe just have some check in there for if server, don't get to the conn.Send() part of the code there.
     
  17. Stefan86

    Stefan86

    Joined:
    Aug 31, 2017
    Posts:
    62
    hi
    I'm trying to get the animation rigging package to work with Mirror.
    I've tried so much, but unfortunately the rigging is not transferred, it only works for each player individually, but if I see another player, the rigging is not transferred.

    can my problem with the asset be fixed?
     
  18. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @Stefan86
    If you are talking about specifically syncing an animation variable or similar and not the syncing of the position or similar, Smooth Sync does not sync those.

    If you know how to code, you may be able to sync your custom variables from within Smooth Sync though. We try to comment our code really well at least.
    If you choose that route, in the Serialize(this NetworkWriter writer, NetworkStateMirror msg) method you can see us writing stuff to the buffer like "writer.WriteFloat(state.position.x)" and reading like "state.position.x = reader.ReadFloat()" in Deserialize(). The main thing is to know is to write and read it all in the same order.
    Feel free to ask any questions along the way too.
     
    Last edited: Nov 9, 2021
  19. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    Hey there, I have a local object that spams an error, which is a NAN when setting the local position. I am using MLAPI as well

    Code (CSharp):
    1. transform.localPosition assign attempt for '(gameobject)' is not valid. Input localPosition is { -Infinity, 205.630173, -9625.173828 }.
    2. UnityEngine.Transform:set_localPosition (UnityEngine.Vector3)
    3. Smooth.SmoothSyncMLAPI:setPosition (UnityEngine.Vector3,bool) (at Assets/Imported/Dependencies/Smooth Sync/MLAPI/Smooth Sync Asset/SmoothSyncMLAPI.cs:1623)
    4. Smooth.SmoothSyncMLAPI:applyInterpolationOrExtrapolation () (at Assets/Imported/Dependencies/Smooth Sync/MLAPI/Smooth Sync Asset/SmoothSyncMLAPI.cs:1290)
    5. Smooth.SmoothSyncMLAPI:SmoothSyncUpdate () (at Assets/Imported/Dependencies/Smooth Sync/MLAPI/Smooth Sync Asset/SmoothSyncMLAPI.cs:826)
    6. Smooth.SmoothSyncMLAPI:FixedUpdate () (at Assets/Imported/Dependencies/Smooth Sync/MLAPI/Smooth Sync Asset/SmoothSyncMLAPI.cs:795)
    7.  
    I fixed with a patch, I am not sure how efficient adding this is though

    Code (CSharp):
    1. if (!float.IsNaN(position.x) && !float.IsNaN(position.y) && !float.IsNaN(position.z) &&
    2.                     position.x != Mathf.Infinity && position.y != Mathf.Infinity && position.z != Mathf.Infinity &&
    3.                     position.x != -Mathf.Infinity && position.y != -Mathf.Infinity && position.z != -Mathf.Infinity)
    4.                     realObjectToSync.localPosition = position;
     
  20. Stefan86

    Stefan86

    Joined:
    Aug 31, 2017
    Posts:
    62
    Unfortunately, I don't know exactly how it works with the IK
     
  21. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    Yes, sliding proglem go away when extrapolation is off.
    It seems to happend when network connection is low between clients. I don't know what algorithm smooth syncs uses for extrapolation, but in my games, character can change direction immetiately, no velocity. Just like Move Up/Down, left, right..., and i think it's hard for guest new position base on previous position correctly. So maybe it's the reason make smooth syncs's algorithm work wrong?
     
  22. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @OnlyTheCosmos
    Thank you for letting us know. I've seen a similar issue before but I thought we fixed it up.
    With your "fix", do you see any remaining issues?

    Are you doing anything out of the ordinary to make this error happen?
    Just normal movement?

    I'll poke around the MLAPI version and see what I can find. Thanks again!
     
  23. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @Stefan86
    Unfortunately I'm not too familiar with unity's inverse kinematics and unity's animation controller.
    If each joint has a Transform that moves in the world's space, then Smooth Sync would be able to sync that. But if there is no Transform or Rigidbody to sync, then Smooth Sync won't have anything to sync.
     
  24. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @trunghieu974
    What is your SmoothSync's Interpolation Back Time?
    What is your SmoothSync's Send Rate?
    Image to show the variables I'm mentioning: https://imgur.com/a/njzSdAY

    I'm starting to think that this is normal behavior and that Smooth Sync is just trying to extrapolate based on the past information it knows. You may want to increase the InterpolationBackTime though.
    If your character is running along and it stops receiving updates, it'll just assume the character is going to keep running so it will show this to your players by continuing the path of running.
    Since you say this happens at a low latency, maybe this is the cause but let me know if you don't think this is the case.
     
    Last edited: Nov 10, 2021
  25. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    67
    Yes, with low easing like that the position will be more delayed on top of the interpolation back time. It is odd that you would need such low easing speed though especially with such a high send rate. I suspect the easing is covering up some other issue that is causing syncing to not be as accurate is it should be. Are you compressing anything? What kind of setup do you have on the object you're syncing? Does it have a rigidbody? How fast are you moving? Maybe try disabling extrapolation just to see if that helps. You could also try lowering the time correction speed.
     
  26. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    Interpolation back time and send rate is at default as in your image. I have same thinking with you. So the way extrapolation work is not correct with my game, because when character running and stop receiving update, maybe at that time, real character is stop, but extrapolation think that character is still moving on this way.
    Maybe turn off extrapolation is the only way to resolve that problem?
     
  27. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    I have not had any issues since. The networked object is using local transform only, its reparenting itself at awake, besides that no movement or rotations at all. But I did find I had errors in other unrelated scripts not using Smooth sync at all that were erring. Which may have led to the error spam.
     
  28. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @trunghieu974
    Keeping extrapolation off may be the way to go for now.

    I just tried to recreate the issue by taking off the Rigidbody of the SmoothSyncPlayerPrefab in the SmoothSyncExample scene and moving around (movement controls are automatically hooked up for this).
    I also messed around with a LatencySimulation script but I couldn't see any sliding.

    If you can recreate the issue in the example scene, then that would give me a lead on a possible issue. But other than that, I'm not sure what else to try to find.
     
  29. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    Thank you, I'll try to create example scene if possible.
     
  30. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    Just updated to Version 3.39 with the Netcode for GameObject changes and it's working very nicely! Still better than NetworkTransform (even though they've improved it).
    Thank you again for this asset it has been a big headache saver!
     
    Zebadiah likes this.
  31. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    I can find a simple way to recreate the sliding problem and also face with new problem of smoothsync:
    - Extrapolation turn on, game with 2 client A & B
    - client A running, then pause game ( in mobile, this maybe due to user go to home screen). You can try in editor by just press pause button while client A is moving. Due to extrapolation, client A in B's screen is sliding on ground.

    This is not only that. After client A resume the game again, smooth sync is not working properly. there is a huge delay between client A & B. For example, client A run forward 5 meters. in B's screen, client A is playing running animation at origin position. when client A stop running, then A in B's screen start to move from origin position to new position.
    (Sorry it's hard to explain in text, but i hope you understand :D ) .
    I need to solve the delay problem when a client is pause game and reusme. ( sliding problem is not important now ).
    I hope to see your help :D
     
  32. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @trunghieu974
    Sorry for the late reply, I've been out sick for a bit.

    SmoothSync does not automatically handle network game pauses where one person is paused and the other is not.
    Keep in mind if the server is paused, then messages cannot be sent around by the server so clients will see the game as stopped.

    If you want to pause and unpause though, I think you can just call SmoothSync.OnEnable() on all SmoothSyncs of the client that just unpaused.
    If that doesn't work, you can try RPCing over something to call SmoothSync.Awake() on all instances of SmoothSyncs on each client.
     
  33. trunghieu974

    trunghieu974

    Joined:
    Jun 19, 2015
    Posts:
    25
    I know that when a client pause, other clients will see that client stopped. but when that client resume game again, smoothSyncs seem to work a bit weirdly. there is some delay in action between that client and others client.
    I wonder if manually call SmoothSync.Awake can cause any problem, I'll try and see if it work :D
     
    dr_ext likes this.
  34. D_Heinz

    D_Heinz

    Joined:
    Aug 6, 2015
    Posts:
    9
    Hi Zebadiah, I'm trying to import SmoothSync 3.39 in a project with Mirror 53.0.0 and I am getting a load of errors on the Mirror Example Scene shipped with SmoothSync referring to NetworkReader/NetworkWriter not containing method definitions.

    Code (CSharp):
    1. Assets\Smooth Sync\Mirror\Smooth Sync Asset\StateMirror.cs(774,87): error CS1061: 'NetworkReader' does not contain a definition for 'ReadUShort' and no accessible extension method 'ReadUShort' accepting a first argument of type 'NetworkReader' could be found (are you missing a using directive or an assembly reference?)
    2.  
    3. Assets\Smooth Sync\Mirror\Smooth Sync Asset\StateMirror.cs(779,87): error CS1061: 'NetworkReader' does not contain a definition for 'ReadUShort' and no accessible extension method 'ReadUShort' accepting a first argument of type 'NetworkReader' could be found (are you missing a using directive or an assembly reference?)
    4.  
    5. Assets\Smooth Sync\Mirror\Smooth Sync Asset\StateMirror.cs(788,58): error CS1061: 'NetworkReader' does not contain a definition for 'ReadFloat' and no accessible extension method 'ReadFloat' accepting a first argument of type 'NetworkReader' could be found (are you missing a using directive or an assembly reference?)
    6.  
    7. Assets\Smooth Sync\Mirror\Smooth Sync Asset\StateMirror.cs(792,58): error CS1061: 'NetworkReader' does not contain a definition for 'ReadFloat' and no accessible extension method 'ReadFloat' accepting a first argument of type 'NetworkReader' could be found (are you missing a using directive or an assembly reference?)
    8.  
    9. Assets\Smooth Sync\Mirror\Smooth Sync Asset\StateMirror.cs(796,58): error CS1061: 'NetworkReader' does not contain a definition for 'ReadFloat' and no accessible extension method 'ReadFloat' accepting a first argument of type 'NetworkReader' could be found (are you missing a using directive or an assembly reference?)
    10.  
    11. Assets\Smooth Sync\Mirror\Smooth Sync Asset\SmoothSyncMirror.cs(1947,40): error CS0117: 'NetworkServer' does not contain a definition for 'spawned'
    12.  
    13.  
    I read through the README and didn't see any extra steps I should take. Are these versions not compatible?

    Thanks in advance!

    [Edit]

    I was able to fix it, looks like the Mirror 53.0.0 release from the Unity Asset Store is missing quite a bit of the extension methods in NetworkReader/NetworkWriter. I downloaded the latest Mirror (v55.3.1) package from their Github and it seems to be working correctly now.
     
    Last edited: Dec 22, 2021
  35. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @D_Heinz
    Glad to hear it's still up to date with Mirror! :)
    They do change code around a lot with Mirror so definitely let us know if things don't seem to match up again. Cheers.
     
    D_Heinz likes this.
  36. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    Hey SmoothSync team. I was wondering if you could help me with a weird problem I'm having. When I change scenes, the "non-owner" player gets really glitchy. You can see a video of it here.
    The left-hand side is Host, right is Client.
    When changing scenes I use Teleport to put the player in the correct location. But this is when the issues start happening. Here is what the inspector values are.
    Further information, I am using Netcode for GameObjects and Unity's new Relay transport. But it is also happening with the Steam P2P transport. So it seems unlikely to be a server issue. It maybe related to NGO version of SmoothSync. I am unsure as I haven't tested with Mirror or anything else yet.
    I can however get the non-owner player to stop glitching after a while by turning off/on the gameObject. But doing that in code leads to a very unfavourable game feel. I'm really hoping someone can help me with this.
    Thanks :)
     
  37. zacharycavaness

    zacharycavaness

    Joined:
    Jan 5, 2021
    Posts:
    2
    Hey there! I just grabbed the Smooth Sync asset and am excited to jump in. Do you all have any thoughts how I can best apply smooth sync when working with moving platforms? I'm running into an issue where players on the host side will appear to float through platforms do to platform position not lining up.
     
  38. CarmenXero96

    CarmenXero96

    Joined:
    Mar 25, 2013
    Posts:
    17
    Loving this asset so far, has saved us a ton of time. I do have a question in terms of what to do for a specific mechanic.

    We have a vehicle our players can drive. Our players have smooth sync and when they run around it's basically perfect. However, when they enter the vehicle, there is massive desynchronization. We tried having the player copy the vehicle's transform, parenting the player to the vehicle, etc. No matter what, the player stutters or has massive lag behind where they should be in the vehicle.

    The vehicle itself has smooth sync. It is a wheel collider based rigidbody vehicle. It's position is mostly accurate on the network, with about a units difference between the position on each client. I tried messing with the settings to get it to sync better, to no avail.

    Just wondering where to start, since we have no idea.
     
  39. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @Brogan89
    It looks like I may have to handle scene changes better with persistent game objects. Are your game objects in question the persistent kind?
    Off the top of my head, I bet if you call SmoothSync.clearBuffer() on all local copies of persistent gameobjects with SmoothSync after loading into a new level, it would solve the issue. A more automatic way may be to place this in OnEnable(), but I forget if persistent gameobjects call that or not on scene changes.
    Try that out and let me know how it goes. If that doesn't solve it then I will have to try to recreate the issue on my end. Either way it looks like I've got another work item to add to my backlog. Thank you for letting me know.
     
    Last edited: Jan 16, 2022
    Brogan89 likes this.
  40. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @zacharycavaness
    Lower Smooth Sync's InterpolationBackTime (but not too much, mouse over variable for details). You can also raise the PositionEasingSpeed. You can maybe raise TimeCorrectionSpeed but this will make it glitchy fast so do this one last. These will place your objects more in line with each system. The issue in your case is that the two objects are owned by two systems, and therefore the position is determined by these two different systems. And the positioning is not exact.
    For the best result, you can have the platform and the player owned by the same system, but then you get into the mess of implementing player prediction which is something you'd have to do yourself.
     
    zacharycavaness likes this.
  41. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @CarmenXero96
    The issue is probably that your vehicles are owned by one system, and the players are owned by another system. This means that your vehicles are not going to line up too well (though settings changes like lowering InterpolationBackTime, raising PositionEasingSpeed, raising TimeCorrectionSpeed will make it better).
    The best solution may be to change ownership of the vehicle to the player that enters it. Smooth Sync should automatically handle this fine and you just change the owner like how you would normally with your networking system.
    Changing the parent of the player to the vehicle may be another way to go. Unfortunately Smooth Sync does not automatically work with this system as I don't think there are any callbacks to get into. Try calling SmoothSync.Awake() on all instances of Smooth Sync on the gameobject you are changing the parent of.
     
  42. Brogan89

    Brogan89

    Joined:
    Jul 10, 2014
    Posts:
    244
    Hey thanks for that, clearing the buffer worked perfectly. Just added to OnEnable() on my player movement script and it worked a charm.
    The player network objects are persistent yes, they don't get destroyed with the scene.
     
  43. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @zacharycavaness
    Oh yeah, you can also mess with re-parenting but that might depend on your character controller on how easy that is. That way each player would be like (-1,-1, 0) local position on every screen to the platform and line up.
    To do this with SmoothSync, make sure you call SmoothSync.Awake() on all networked instances of the SmoothSync that is syncing the object you are changing the parent of.
     
  44. CosmicStud

    CosmicStud

    Joined:
    Jun 13, 2017
    Posts:
    55
    Position and Rotation...
    Smoothsync, 32 bytes per send
    Netcode for gameobjects network transform, 2700 bytes per second (45 bytes per frame/change at 60 fps)
    Wow! Love this asset
     
    Fuestrine likes this.
  45. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    @Fuestrine Is there a good setup for PUN2 kinda high velocity moving players ( while using grappling hook) ?
    If there exists some example I havent found let me know pls. Maybe snap position could 0.5 .

    Thank you for any help.
    Cheers!

    upload_2022-2-22_12-3-4.png
     
  46. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @arnesso
    In order to get better "reactivity" you can try to lower InterpolationBackTime, raise EasingSpeeds, raise TimeCorrectionSpeed. Mouse over each variable for more information or things will get jittery.

    Maybe check out "Use Velocity Driven Syncing" if your objects move fast and are rigidbodies, but it's less accurate so it depends on your game.
     
    arnesso likes this.
  47. JunJie93

    JunJie93

    Joined:
    May 18, 2018
    Posts:
    5
    Hi, i am new to mirror and smooth sync.
    1). Can i get advice on how can I invert the sync depending on whether if a player is local or not? What i am trying to achieve is to make sure that the localPlayer will always be at the bottom and it's troop is always going upwards while the opponentPlayer will always be at the top and it's troop always coming from above.

    2). Is there any way for Smooth Sync when using Unity SetParent, the child will stop and follow the movement of the parent
     

    Attached Files:

  48. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    586
    @JunJie93
    For your number 1:
    The best advice I have is to take a look at the SmoothSync.SetPosition() and SmoothSync.GetPosition() methods and then do some conversion yourself in there to invert position.

    For your number 2:
    For changing the parent at runtime, call SmoothSync.Awake() after changing the parent. (Must do this on each system).
     
  49. JunJie93

    JunJie93

    Joined:
    May 18, 2018
    Posts:
    5
    Hi Feustrine, thanks for the reply

    For number 2 i still unable to sync the child to the parent. Should the awake be called on the child or parent? And should i clearBuffer before calling Awake? And also can the child have smooth sync script attached to it too? Currently what i am facing is that if Object B collides with Object A, Object B will set its parent to Object A. Object B will then stop moving and will follow the movement of Object A
     
    Last edited: Apr 5, 2022
  50. rtking1993

    rtking1993

    Joined:
    Dec 6, 2020
    Posts:
    1
    Hello @Fuestrine,

    First of all can I just say, your package is fantastic. Definitely worth the price, does exactly what it says and is very easy to use! Thank you.

    I'm relatively new to Unity and creating a simple 2D game, planes flying around shooting at each other.
    I'm trying out using Netcode and Relay, which initially worked ok using the sample ClientNetworkTransform. I realised that this had limitations though, so this brought me to your software which does a way better job than the ClientNetworkTransform, handling client side smoothing much better. I've been playing around with the settings of Smooth Sync to try and improve the latency delay in the client sync. If one player follows another (as seen in the image) there is a discrepancy in the positions which can affect gameplay. This is much better than it originally was with the ClientNetworkTransform, however I just wanted to get your advice on whether there were any Smooth Sync setting combinations that could improve my game? (If you know of other measures I could could take outside Smooth Sync that would also be appreciated)

    FYI, I'm using 2D Physics as opposed to position data. Also using your Velocity Driven Syncing option.

    Once again, thanks for your contribution, Smooth Sync is a great package!

    Cheers, Ryan
     

    Attached Files: