Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    454
    @Doughtinator
    You can have the non-server player tell the server to move it.

    Usually this is done by having a PlayerController owned by the local systems and having the players and game objects owned by the server. You then send over your CMDs to the server on the PlayerController which tell the player objects to move.
     
  2. Doughtinator

    Doughtinator

    Joined:
    Aug 8, 2019
    Posts:
    10
    Thanks for the reply. I’ll look into this method.
     
  3. jdcart23

    jdcart23

    Joined:
    Jan 17, 2018
    Posts:
    12
    @Fuestrine Hi, I don't know if you have seen this behavior before, or someone else has mentioned it.

    I'm having a problem with your SmoothSyncEditor script where smoothsync fields are constantly being marked as dirty. This makes it so unity thinks that my prefab has been modified and Perforce checks out the file.

    I looked at your code and saw that SmoothSyncEditor is always marking the fields dirty even when they are not changed:

    Code (CSharp):
    1. public override void OnInspectorGUI()
    2. {
    3.  //...
    4.     EditorUtility.SetDirty(myTarget);
    5. }
    I changed it for now so that it only sets them as dirty when something changes in the GUI, however, this is only a temporary fix so I can keep working on my stuff. It is temporary because closing or opening a dropdown still marks it as dirty, when it really shouldn't:

    Code (CSharp):
    1. public override void OnInspectorGUI()
    2. {
    3.             if (GUI.changed)
    4.             {
    5.                 EditorUtility.SetDirty(myTarget);
    6.             }
    7. }
    Do you think you can go in and make a more permanent fix for this issue?
     
  4. sonderistic

    sonderistic

    Joined:
    Jan 4, 2017
    Posts:
    6
    "Game start" is when the client hosts the game. And the positions seem to be random on the x-z axis, but consistent in terms of y.

    I started spawning in these objects and they now seem to work fine.
     
  5. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    @jdcart23 I'll look in to the editor script issues. Seems easy enough to fix. Thanks for pointing it out.

    @sonderistic Glad you were able to get it working some way at least.
     
  6. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
  7. sabinionut56

    sabinionut56

    Joined:
    May 25, 2019
    Posts:
    8
    if i buy this script it will make my game work better even if it is not a multiplayer or it only works for multiplayer games ?
     
  8. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    454
  9. Rmzn0

    Rmzn0

    Joined:
    Jul 24, 2018
    Posts:
    9
    I want to make a 4-player co-op game by purchasing Asset.

    Is it possible with your asset?
     
  10. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    454
    @Rmzn0
    That's too broad of a question unfortunately.

    Smooth Sync will make your game assets smooth across the network though. If you have more specific questions I'd be happy to answer them.
     
  11. Foestar

    Foestar

    Joined:
    Aug 12, 2013
    Posts:
    329
    No, you will not be able to make a 4 player co-op game by purchasing this asset. You can download Pun2 for free to try out as it will be the most friendly starting point to make a 4 player co-op game.

    What this asset DOES do is smooth out your game's player movement over the network meaning all the jittery movement that comes with lag. If you plan on making any kind of multiplayer game and don't know much about smoothing or compensating for lag or just want to save time then buy this. It is SUPER helpful in speeding up your workflow and is easy to implement.
     
  12. saukki

    saukki

    Joined:
    Nov 5, 2014
    Posts:
    1
    @Fuestrine Hi, I bought Smooth Sync a few days ago and wanted you to know that it doesn't work with the new Mirror v5.x release due to their API changes.
     
  13. caleb-holos

    caleb-holos

    Joined:
    Nov 5, 2019
    Posts:
    1
    @Fuestrine Smooth Sync isn't working with the latest Mirror package from their GitHub page. The SmoothSyncMirror contains the following error:

    Assets\Smooth Sync\Mirror\Smooth Sync Asset\SmoothSyncMirror.cs(644,29): error CS0117: 'NetworkIdentity' does not contain a definition for 'clientAuthorityCallback'
     
  14. Yarwad2

    Yarwad2

    Joined:
    Jan 13, 2019
    Posts:
    1
    Hi there. I just purchased the asset and got this error message upon importing the Mirror package:

    Assets\Smooth Sync\Mirror\Smooth Sync Asset\SmoothSyncMirror.cs(2041,100): error CS0246: The type or namespace name 'NetworkConnectionToClient' could not be found (are you missing a using directive or an assembly reference?)

    Is there a fix for this or should I request a refund? Thanks.
     
  15. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    @saukki I was a little behind getting the update out but it should work now.

    @caleb-holos Smooth Sync is kept up to date with the latest release of Mirror on the Asset Store. We do not support the latest version of Mirror on github.

    @Yarwad2 It sounds like you've got the latest Smooth Sync but not that latest version of Mirror. You probably just need to update Mirror from the Asset Store.
     
    saukki likes this.
  16. RatBytes

    RatBytes

    Joined:
    Nov 10, 2018
    Posts:
    23
    Hi there,
    It seems the the new Ummorpg/Mirror has has modified the NetworkIdentity class and its throwing an error in SmoothSyncMirror

    Request your fix.

    Thanks in advance.

    MirrorSmoothSynchUpdate.jpg
     
  17. sabbath1989

    sabbath1989

    Joined:
    Jan 20, 2016
    Posts:
    8
    Do you know what would be good? if this asset had entered the cyber week discount !! :) just a tip lkkk
     
  18. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    @witcherx There is a fix incoming. In the meantime you can just comment that line out if you're not using the Smooth Authority Changes feature and it won't hurt anything.

    @sabbath1989 I believe our price is too low already to be included in that sale. Sorry!
     
    zKici likes this.
  19. MOTYSHIZ

    MOTYSHIZ

    Joined:
    Apr 12, 2016
    Posts:
    3
    Hello, Noble Whale! I have been loving your asset so far.
    I do have a question that I am having difficulty finding answers for.

    I am working on a VR game with vehicles, but there can also be multiple players in a single vehicle.
    From my understanding and what I've gotten working so far, it is necessary to have 3 -4 tracking points for VR (Head, hands, perhaps playArea origin or root for height).
    As you may have already guessed, the issue I have with vehicles is making sure players appear to keep up with and stay inside the vehicles.

    This seems like it would require some clever use of "use Local Transform Only", and management of VR network tracked object hierarchies.
    I was hoping I could get more explanation on how this feature works.

    Is it basically just copying the visible transform values in the inspector?
    If there is any documentation on this matter, please let me know.

    Thank you very much!
     
  20. MOTYSHIZ

    MOTYSHIZ

    Joined:
    Apr 12, 2016
    Posts:
    3
    Nevermind, I figured it out!
    Turns out, my hierarchy wasn't getting properly synced between my remotes and clients. It was just my local VR set that was being modified.
    I now sync the parenting hierarchies via player custom properties and toggle on "use Local Transform Only".
    Works like a charm, and the players see each other in the vehicle together!

    Love you guys, thanks for making such a great asset with considerations like this.
     
    thegreatzebadiah likes this.
  21. MudbuG

    MudbuG

    Joined:
    May 17, 2015
    Posts:
    3
    Documentation for smooth sync says "Don't hesitate to contact us..." but there is no email. Also I am not able to register the product on noblewhale.com because it does not recognize my invoice number. Is there an email for support?
     
  22. gmxtian

    gmxtian

    Joined:
    Jul 10, 2012
    Posts:
    8
    I'm using Unity 2019.2.17 and PUN2 for a VR app. The use local transform option does not work at all (no movement) for the head and hands that are parented to player space object. Does this require Smooth Sync PUN2 at the root as well that does the global transform? I would think it would just happily set the local values, which would be great. When I try to set the root object to use smooth sync global I get PUN sync errors. When I set the head and hands to global it half works. When on the Quest I can see my PC (Quest using Oculus Link) movement but when on the PC I can not see Quest movement. So that's 3 different issues right out of the gate.
     
  23. gmxtian

    gmxtian

    Joined:
    Jul 10, 2012
    Posts:
    8
    Apologies! I just realized that the likely reason local transform doesn't work is that the part above is actually moving. Global works in this case and of course local does not. If I can modify the code to use a specified transform then I can probably move forward with this.
     
  24. polygonfuture

    polygonfuture

    Joined:
    Feb 4, 2016
    Posts:
    5
    Hi,

    I am using your script to send camera rotation and transformation values from a server to a client. The client camera is essentially being controlled by the server machine. It is using UNET.

    SmoothSync is giving me problems as I rotate the camera around its "look at" pivot. On client, the camera is locked to this pivot point and rotating / translating around it perfectly.

    With SmoothSync, there is occasional "hiccup" movements that translate this pivot in a direction, causing a noticeable "jolt" of the camera. It happens most when the camera is moving slowly.

    Currently the camera raycasts to a surface, gets the normal, creates a vector, and then rotates / translates around that point.

    Do you have any idea what might be causing these jolts while using SmoothSync? I've one by one gone through various settings with no clear resolution.
     
    Last edited: Jan 24, 2020
  25. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    UnityAssetSupport@noblewhale.com

    You can find it on our Asset Store publisher page. Yeah, I wish unity made it easier to find..no clue why they don't put it on the asset page itself.

    The Noble Whale website is really only used for Noble Connect, so you don't need to enter your Smooth Sync invoice number there or anything.
     
  26. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    I believe with PUN2 Smooth Sync should sync whatever object you put it on, so if you put one on the parent and one of the child both should sync properly. Also make sure both parent and child have a photon view that is observing the Smooth Sync component.
     
  27. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    793
    Two things I would try are disabling extrapolation, and setting the time correction speed super low to see if that smooths it out. I'm working on implementing some improvements to time syncing that may help. Extrapolation also may or may not have some issues. I recently fixed some extrapolation stuff in the Unreal version of Smooth Sync that could be causing issues in the Unity version as well, just haven't confirmed yet. Also I can help you out more directly on our discord channel if you're in to that sort of thing. https://discord.gg/6VpgNQg
     
  28. Razputin

    Razputin

    Joined:
    Mar 31, 2013
    Posts:
    199
    How do I stop interpolation of scale? I set scale easing speed to 1 which should be "Instant" but it still interpolates, is there a different way to do this? Thanks :)
     
  29. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    454
    @Razputin
    I'll check it out.

    For now as a quick and dirty fix, try setting the SnapScaleThreshold to something really low but above zero. Let me know if that doesn't work for you.
     
  30. Derpington3d

    Derpington3d

    Joined:
    Mar 17, 2015
    Posts:
    3
    This is a long shot, but any chance of getting SpatialOS support for Smoothsync at any point?
     
  31. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    454
    @Derpington3d
    Sorry, there is no current plan to add SpatialOS support for Smooth Sync. Best case scenario, I don't see it happening any time soon.
     
  32. Derpington3d

    Derpington3d

    Joined:
    Mar 17, 2015
    Posts:
    3
    Thank you for the speedy reply, I figured that was the case.
     
  33. JjyKs

    JjyKs

    Joined:
    Nov 9, 2012
    Posts:
    1
    Would it be possible to add a boolean that forces location authority to server even if client has authority on object as well?

    I've been suggesting this Asset to a lot of people on Mirror discord if they had problems with default NetworkTransform. However now multiple people have had a problem where their movement logic is on the player prefab, which has client authority. That causes SmoothSync to sync location from Client to server, even if authority is just used to send player input to the server and server is the one handling all the location stuff.
     
  34. katasteel

    katasteel

    Joined:
    Nov 21, 2014
    Posts:
    207
    I'm having a problem when I spawn a object(Think a players pet) with client authority.
    This Pet object belongs to the player that spawns it, and should be de-spawned when the player disconnects(That is why it is spawned with client auth).
    The Pet object gets all it's instructions from the server as it is not directly controlled by the player.
    Here is where the problem lies.

    When a client that is not on the server creates a Pet object, SmoothSyncMirror is not moving the object on either the server or client. I believe this is due to SmoothSyncMirror thinking that because it has authority that the movement orders should come from the client. If I disable the SmoothSyncMirror on the server while it's running it will start to follow the player (only on the server of course).

    Is there a way to let SmoothSyncMirror know that the movement orders will still be coming from the server?
     
  35. Icaro-DLima

    Icaro-DLima

    Joined:
    Aug 6, 2019
    Posts:
    20
    Hey! The Mirror version is outdated! Please fix. :(

    Untitled.png
     
  36. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    @JjyKs @katasteel I've actually already added this. It will be in the next release.
    Cheers.
     
    JjyKs likes this.
  37. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    @Icaro-DLima See my email reply. I don't think this is an issue with Smooth Sync, but rather something else preventing Mirror and Smooth Sync from compiling. You can confirm yourself by testing in an empty project with nothing but the latest Smooth Sync and Mirror from the Asset Store.
     
  38. katasteel

    katasteel

    Joined:
    Nov 21, 2014
    Posts:
    207
    @Zebadiah Great! What will the setting I need to set be called?
    If it is not a setting what do I need to do to get it to work?
    Also any idea when the next release will be on the asset store?
     
  39. paulbettner

    paulbettner

    Joined:
    Jan 13, 2014
    Posts:
    9
    Hi @Fuestrine -

    When trying to build smoothsync + mirror using the latest version of Unity 2019.3, I get these compile errors in xcode:

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:11808:3: No matching function for call to 'NetworkWriterPool_Recycle_m1D2B0E1C9A72675D23363BBFCACDDE284EC387C9'

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:4858:41: Candidate function not viable: cannot convert from base class pointer 'NetworkWriter_t9867BCC201B0E0EB4E85B70D8322BFCC7B1B5B0D *' to derived class pointer 'PooledNetworkWriter_t5C3E4554285FF29054146CADF86AF9057BAEECC7 *' for 1st argument

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:11849:3: No matching function for call to 'NetworkWriterPool_Recycle_m1D2B0E1C9A72675D23363BBFCACDDE284EC387C9'

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:4858:41: Candidate function not viable: cannot convert from base class pointer 'NetworkWriter_t9867BCC201B0E0EB4E85B70D8322BFCC7B1B5B0D *' to derived class pointer 'PooledNetworkWriter_t5C3E4554285FF29054146CADF86AF9057BAEECC7 *' for 1st argument

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:11890:3: No matching function for call to 'NetworkWriterPool_Recycle_m1D2B0E1C9A72675D23363BBFCACDDE284EC387C9'

    /Users/paulbettner/playground-client/Builds/iOS/playground-ios-client/Classes/Native/Smooth.cpp:4858:41: Candidate function not viable: cannot convert from base class pointer 'NetworkWriter_t9867BCC201B0E0EB4E85B70D8322BFCC7B1B5B0D *' to derived class pointer 'PooledNetworkWriter_t5C3E4554285FF29054146CADF86AF9057BAEECC7 *' for 1st argument


    And the actual lines in the generated cpp code that are throwing the errors look like this:


    NetworkWriterPool_Recycle_m1D2B0E1C9A72675D23363BBFCACDDE284EC387C9(L_12, /*hidden argument*/[B]NULL[/B]);


    One other hint: the functions that throw this error are
    Smooth::RpcNonServerOwnedTeleportFromServer
    Smooth::CmdTeleport
    Smooth::RpcTeleport

    Which are the only Smooth methods that use the [ClientRPC] and [Command] attributes... although I'm not sure why those attributes are causing that last NetworkWriterPool line to show up in the generated cpp code (or why it's not able to cast NetworkWriterPool to WriterPool successfully, even though those classes are derived from each other...)


    Thank you for any help you can provide!

    Paul
     
    Last edited: Mar 13, 2020
  40. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    777
    Hi,

    seems sometimes the scale is synced wrong. The scale on one player is 3.8 and the other player its 1

    Any ideas?

    Thanks
     
  41. paulbettner

    paulbettner

    Joined:
    Jan 13, 2014
    Posts:
    9
    Zebadiah likes this.
  42. Flamacore

    Flamacore

    Joined:
    Dec 17, 2013
    Posts:
    81
    Hey there :)

    Just purchased this and started using it. The smoothness is really good. However, I have rather a different question. Since it states that I have to clearBuffer everytime I change ownerships, I'm stuck at a point and would like your opinion if possible.

    Think of it as a ball game. Naturally, to be able to apply rigidbody force from each client without any lag whatsoever, immediately reflecting the force on the client's screen, I change ownerships upon entering the proximity of the client's object (trigger collider). But after a couple of tests, say the ball passes near the player and its ownership changes accordingly, it immediately stops moving. If I don't call clearBuffer, it all goes haywire on ownerships. Obviously enough, I also tried to change ownership upon direct collision hit but that introduces another problem. Possibly, ownership change is not immediate and checks out with the server. Thus, misses the rigidbody force apply at that immediate frame.

    I know this may not be related directly to your asset but still, could you kindly think about this and guide me on this situation?

    Using PUN2 by the way.
     
  43. mailfromthewilds

    mailfromthewilds

    Joined:
    Jan 31, 2020
    Posts:
    46
    plugin helped me in some areas but other problems arised. how to avoid stutter? addforce in ground direction causes character shaking (except local player)
     
  44. esmaeeldoost

    esmaeeldoost

    Joined:
    May 8, 2017
    Posts:
    2


    Hi, I made this game with Mirror and Smooth Sync. I captured this video from PC and WIFI. I want to know what is the best settings for mobile networks?
    This is my default settings:


    I also add this:
    Code (CSharp):
    1. if (isServer) {
    2.             if (smoothSync != null)
    3.                 smoothSync.forceStateSendNextFixedUpdate();
    4.         }
    All objects are non-owner and controlled by server.
     
  45. unity_AMOPSv5o2kVS8Q

    unity_AMOPSv5o2kVS8Q

    Joined:
    Feb 10, 2019
    Posts:
    1
    Hey there! I have a problem using SmoothSync with PUN2.
    After the integration, I have a console error saying

    Code (CSharp):
    1. Assets\Smooth Sync\PUN2\Smooth Sync Asset\SmoothSyncPUN2.cs(673,30): error CS0115: 'SmoothSyncPUN2.OnPlayerEnteredRoom(Player)': no suitable method found to override
    what can I do? :(
     
  46. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    It's called "Controlled by Server" under the Miscellaneous section. I'll try and get it up sometime next week.
     
  47. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    Mirror, UNet, or PUN? Seems to be working for me. You can test in the example scenes using +/- to grow and shrink the balls.
     
  48. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    You definitely don't want to do that. That's going to make it try to send every frame which is going to cause a lot of network congestion and dropped / delayed packets.

    The default settings should work for most cases. For 2D you can save lots of bandwidth by turning things off that you don't need under "Variables to Sync"
     
  49. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    Do you have "Smooth Authority Changes enabled? It is made to fix exactly this.
     
  50. Zebadiah

    Zebadiah

    Joined:
    Apr 6, 2014
    Posts:
    27
    Are you still experiencing this issue? I just tested with the latest PUN2 and Smooth Sync from the asset store and I'm not getting any compilation errors and as far as I can tell the OnPlayerEnteredRoom method does exist in PunClasses.cs
     
unityunity