Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. 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. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587


    Buy Smooth Sync Here.

    Simple drop in setup. Smooths Transforms, including Rigidbodies over the network with ease.​

    How to Use
    Add the SmoothSync script to any networked game object and watch it be smoooooth. That's it! The end.

    Reduce Network Costs
    Only send what you need, reducing the networking costs over Unity's Network Transform by up to 60%.
    Optionally compress floats to further reduce bandwidth.
    Use Unity's own calculator to see just how fast it will pay for itself and save you money.

    Details
    We've aimed to improve NetworkTransform on all fronts. Smooth Sync is more configurable, uses less bandwidth, and gives you smoother and more accurate syncing of your objects.

    Performs customizable interpolation and extrapolation in order to make your objects smooth and more accurate over the network.
    Comes with a fully functional example scene.
    The full source code is provided so you can see everything with detailed comments!
    Built in teleporting for when you need to instantly move an object and don’t want to interpolate.
    We are actively developing this plugin for use in our own multiplayer game so we are very fast to respond to issues and put out fixes.
    Runs on Windows, OSX, Linux, iOS, Android, Windows Phone, Web builds, Xbox, PlayStation, Nintendo. If Unity runs it, it'll run!


    Docs | API

    See Smooth Sync in Action

    Overview

    Requirements
    Unity 5.3 or above.

    If you have any questions just let me know. I hang around in the forums all the time. I'm also always available at the support email.

    Further Reduce Your Networking Costs
    Check out our NAT Traversal plugin to stop using those expensive Unity relay servers.
    Or check out our Noble Connect plugin to utilize the awesome power of cheaper relay servers.

    Thanks!
     
    Last edited: Jul 6, 2020
    ahmadriyandi likes this.
  2. Fsilva

    Fsilva

    Joined:
    Mar 31, 2015
    Posts:
    36
    Hi,

    What will be the price?
    Will have a launch discount?
    Who owns NAT Traversal will have a discount/upgrade?

    Thank you!
     
  3. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @Fsilva
    9 USD.
    No launch discount.
    I don't see a way to provide a discount if someone owns our NAT Traversal product. Is there a new feature of the asset store I missed?
     
  4. TubooBokBok

    TubooBokBok

    Joined:
    Mar 2, 2014
    Posts:
    30
    Hello,

    The asset looks amazing.

    In my project I have vehicles that can be controlled by difference players. Authority is assigned and removed as players get in and out of vehicles. The player in the vehicle should be responsible for syncing the transform of the vehicle.

    Does your asset sync movement correctly as Authority is changed between clients?
     
    thegreatzebadiah likes this.
  5. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
  6. TubooBokBok

    TubooBokBok

    Joined:
    Mar 2, 2014
    Posts:
    30
    @Fuestrine

    I just bought this asset, and am happy with the smoothness of synced movement.

    Would it be possible to add a replacement for the NetworkTransformChild script?

    I am unable to use NetworkTransformChild without a NetworkTransform script on the parent gameobject. Adding the SmoothSync script on to the child object requires a network identity on the child and parent object, which Unity does not allow.

    Thanks!
     
  7. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @TubooBokBok

    Yep. I can do that! I'll let you know when I'm finished so I can send you a copy if you want it before it hits the asset store.
     
    ahmadriyandi and TubooBokBok like this.
  8. TubooBokBok

    TubooBokBok

    Joined:
    Mar 2, 2014
    Posts:
    30
    @Fuestrine

    That would be great. Thank you very much!
     
  9. deliinteractive

    deliinteractive

    Joined:
    Oct 8, 2014
    Posts:
    25
    Howdy! We just bought this asset and immediately learned the hard way that SmoothSync.cs doesn't work with Rigidbody2D. Are there plans for 2D support? We didn't see any warning in the asset store that it wouldn't work with 2D. It's only 9 bucks, but any notification would be a welcome addition. Also, I may be a goofball and have missed some 2D--specific script to add to our game objects. Let me know either way. Thanks!
     
  10. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @deliinteractive

    Just a dumb oversight by me. I will have 2d rigidbody support submitted to the asset store by the end of the work week.
    I'll notify you when I finish so I can send you an early copy if you want.

    As a quick fix if you just want it up now, you can change "rb" from using Rigidbody to Rigidbody2D on SmoothSync.cs lines 70 and 88, and then comment out all of the lines that yell at you because of it. I can also just email it to you, but I will have a better architected version later in the week.
     
    Last edited: Aug 20, 2017
  11. Vaidoras

    Vaidoras

    Joined:
    Sep 5, 2013
    Posts:
    21
    Hi there. Just got your asset. Love it for the most part, except that I am having some pesky errors while spawning objects with Smooth Sync.

    Here is what I think is relevant in my spawn method, nothing too weird. I am moving the objects using NavMeshAgent.Move(). The object does have rigidbody on it. The errors show up on client side only.
    Code (CSharp):
    1.            
    2. GameObject spawned = Instantiate(avatar_Pref, _Army.transform) as GameObject;
    3. spawned.transform.position = _Army.transform.position;
    4. spawned.layer = _Army.gameObject.layer;
    5. spawned.SetActive(true);
    6. NetworkServer.Spawn(spawned);
    Every time I spawn on object with Smooth Sync I get 3 errors:
    1:
    2:
    3

    Let me know if you need more context to make sense of this.

    cheers!
     
    Last edited: Aug 20, 2017
  12. deliinteractive

    deliinteractive

    Joined:
    Oct 8, 2014
    Posts:
    25
    Thanks! Yeah I went in and made duplicates of SmoothSync, State, and SmoothNet, changing anything that required a Rigidbody or Vector3 to the appropriate 2D equivalent, and it all seems to work pretty steady. I'm just working on adjusting it now to do an automatic teleport update every now and then. Because I keep the send rate really low, I have some objects which don't exceed their snap distance, so they try to lerp over and over, but are falling through the floor (some terrain gets generated out of order with the entities that walk on it on the client end). I figure that would probably help clear it up.
     
  13. chansukim

    chansukim

    Joined:
    Aug 23, 2017
    Posts:
    1
    Hello, First I very happy, because I searched many article, I find your asset.

    I am creating a 3D Racing in mobile.(android), Single player or up to 2 players online.
    And When it multiplayer, sometimes other prefab Racing Cart looks like a teleport.

    So, I’m just wondering.
    If i use your asset, Am I improve for smooth moving? or Do you have any similar case or experience ( like mobile/android , 3d racing)?

    Thank you.
     
  14. studiocolon

    studiocolon

    Joined:
    Dec 14, 2015
    Posts:
    3
    Hello, I bought it.
    I wanna use the Dedicated Server.
    How to fix the "SmoothNet" script ?
     
  15. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @TubooBokBok @deliinteractive @studiocolon
    All of your problems are fixed. I submitted to the asset store but it'll take a bit before it's approved. If you want it sooner, send me a message at the support email with your invoice number and what version of Unity you are using and I'll send you a copy.

    @Vaidoras
    I may or may not have fixed your issue. I wasn't able to replicate it exactly so I'm not 100% sure. Message me your invoice number and editor version at the support email and I can get you a build to test. If you could post some more code or send me a project that I can use to replicate the issue that may also help.

    @chansukim
    Yep! It'll smooth all transforms with or without a rigidbody. I use it in my 2D racing game (www.grabblesgame.com) for PC and consoles but it will be fine for mobile.
     
    Last edited: Aug 25, 2017
  16. studiocolon

    studiocolon

    Joined:
    Dec 14, 2015
    Posts:
    3

    I sent email to supporting email address. Thank you!
     
  17. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    Change log for version 1.01 that is submitted to the asset store but is not approved yet by Unity.
    • Added Rigidbody2D support.
    • Added dedicated server support.
    • Added networked child object support.
    • Fixed spawn error messages when instantiating in a specific way.
    • Combined SmoothNet and SmoothSync into SmoothSync script so it would be simpler.
    • Updated documentation.
    If you buy a copy and want the updated version now, shoot me an email at the support email with your invoice number and which version of Unity you are using.
     
  18. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'm having trouble getting this to work and wondering what I'm obviously doing wrong. Using v1.01 (Unity asset store already updated). Previously I had cannonballs firing using NetworkTransform. I replaced NetworkTransform with SmoothSync and that results in the cannonballs instantiating and flying correctly on the server, but when spawned on the client they simply drop from their starting position straight down due to gravity to the sea floor. They don't appear to get any force applied or any position updates from the sever version of the objects. I don't see any changes after spawning of the X & Z positions of the cannonballs.

    Not sure what the issue is.

    I tried instantiating/spawning with both of these sets of code with no difference (both work fine with NetworkTransform other than some in flight jitters I was looking to smooth out). I tried increasing the snap value to 200 and reducing it to 5 with no difference.
    Code (csharp):
    1.  
    2.         newCannonBall.transform.position = GetComponent<Armament>().Cannon(cannonNumber, side).transform.position;
    3.         newCannonBall.GetComponent<Rigidbody>().AddForce(force, ForceMode.Impulse);
    4.         NetworkServer.Spawn(newCannonBall);
    5.  
    6.         GameObject newCannonFiringEffect = Instantiate(CannonFiringPrefab);
    7.         newCannonFiringEffect.transform.position = newCannonBall.transform.position;
    8.         NetworkServer.Spawn(newCannonFiringEffect);
    9.  
    Code (csharp):
    1.  
    2.         newCannonBall.transform.parent = GetComponent<Armament>().Cannon(cannonNumber, side).transform;
    3.         newCannonBall.transform.localPosition = new Vector3(0, 0, 0);
    4.         newCannonBall.GetComponent<Rigidbody>().AddForce(force, ForceMode.Impulse);
    5.         newwCannonBall.transform.parent = null;
    6.         NetworkServer.Spawn(newCannonBall);
    7.  
    8.         GameObject newCannonFiringEffect = Instantiate(CannonFiringPrefab);
    9.         newCannonFiringEffect.transform.position = newCannonBall.transform.position;
    10.         NetworkServer.Spawn(newCannonFiringEffect);
    11.  
     
  19. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @Joe-Censored

    I can't seem to recreate on my end in the example scene.

    Code (CSharp):
    1. newCannonBall = (GameObject) Instantiate(cannonBallPrefab, new Vector3(0, 0, 0), transform.rotation * Quaternion.Euler(0, 180, 0));
    2. NetworkServer.Spawn(newCannonBall);
    Is how I am spawning it on the server and it syncs to clients for me.

    Am I missing something here?

    You might want to try newCannonBall.GetComponent<NetworkIdentity>().AssignClientAuthority(NetworkServer.connections[0]); to force authority?
    Do your spawned objects have hasAuthority as false on both client and server?
     
  20. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The cannonball objects, and all network objects in my game, have server authority and are instantiated and spawned on the server. I'll try playing with assigning client authority and see if that does anything, though I don't actually want to end up with client authority. thanks
     
  21. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @Joe-Censored

    You should be able to assign server authority that way too, in the example scene.

    Though it should automatically be doing it and it is in the example scene for me using the player prefab to spawn and having "Local Player Authority" unchecked, by spawning the way you spawn. Let me know how it goes.
     
  22. deliinteractive

    deliinteractive

    Joined:
    Oct 8, 2014
    Posts:
    25
    @Joe-Censored I wonder if you might be running into a compatibility issue with NATTraversal. We just recently adjusted some scripts on our end because we were getting the same error as @Vaidoras and seeing the same issue you are - no synced movement. Essentially what was happening is that the connection replacement from relay to punchthrough was taking place after a player object with the SmoothSync component had been instantiated, so the SmoothSync-related message types were not being registered on the connection actually used - only the relay connection (which was soon gone). Take a look for errors on the client-side relating to an unknown message id, and if that's the problem, fool around with where you register those messages until it works with connection replacement.

    Hope that helps!
     
  23. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @deliinteractive @Joe-Censored Oh hey...that makes perfect sense. My bad. Easy fix though I think. Just replace the two calls to
    Code (CSharp):
    1. NetworkManager.singleton.client.RegisterHandler()
    with
    Code (CSharp):
    1. ((NATTraversal.NetworkManager)NetworkManager.singleton).RegisterHandlerClient()
    We'll have the fix in the next update. Good catch @deliinteractive
     
  24. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Hmmm, I'm not using the NAT Transversal package, as my game is based on clients connecting to dedicated servers. My simulation servers do though maintain client connections to a NetworkServerSimple master server and database access server for the purposes of server cluster management and centralizing access to the db. I'm wondering if there's a similar confusion going on with the RegisterHandler calls to the NAT Transversal issue mentioned.

    When I have a chance to get back to this issue I'll take a closer look. I didn't see any unknown message id errors at the time I was looking at this, but I wasn't checking the logs on the master and database servers, or I might not even see those errors since my connection does exist but may be listening or sending on the wrong one? Thanks for the info, gives me a place to look!
     
    Last edited: Aug 31, 2017
  25. TheWesselGames

    TheWesselGames

    Joined:
    Aug 31, 2016
    Posts:
    31
    Just bought the assets, it seems to work really well! One question though: Is there an option to only allow the Y position to sync with rotation. (The Unity Transform does offer this option).

    Also I don't know if this is possible, because the unity transform doesn't offer it. Is it possible to only sync the X and Z position floats, instead of XYZ.

    Also it seems like smooth Sync still syncs if both players are standing still. The standard Unity Transform doesn't do that, so Smooth Sync uses way more data.

    Because I'm assuming that's smooth sync?
    https://gyazo.com/dd9cbfbccf681084efb57d2fe435707c

    Here are my settings:
    https://gyazo.com/81a91fb7e57d35d37f4bc23c0c3e1017

    EDIT:

    I checked the script but it seems like you never use the movementThreshold, so the script actually never checks if an object moved.
     
    Last edited: Sep 2, 2017
  26. deliinteractive

    deliinteractive

    Joined:
    Oct 8, 2014
    Posts:
    25
    The details about SmoothSync sending without checking new position are correct from our assessment. We modified SmoothNet from the original 1.0 asset to hold the last State used to send in a private variable and check against it when it's about to send a new state (just checking position data in our case). If the position in the new state is the same as the old state, we only send if a 25% random chance is passed. That last bit is just to ensure that position updates still come in occasionally for objects which may have been extrapolating their position for too long (we keep our send rates crazy low and our extrapolation limits pretty high).
     
    thegreatzebadiah likes this.
  27. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @Joe-Censored
    Your problem is fixed!

    @TheWesselGames @deliinteractive
    Yep, should have had that in. I added a sendMovementThreshold for what you want and renamed the one already in there to receivedMovementThreshold. I used a new thing I learned so everyone's settings should stay the same! https://docs.unity3d.com/ScriptReference/Serialization.FormerlySerializedAsAttribute.html in case anyone's curious.
    I also added every single combination of syncing XYZ, XY, XZ, YZ, X, Y, Z, NONE for position, rotation, velocity, and angular velocity.

    It's the end of the night for me but I'll be cleaning it up tomorrow and adding alternative syncing position only and syncing rotation only for when the object is not moving or not rotating to save bandwidth. The plan is to submit to the asset store tomorrow. Things have been getting accepted within a day or two lately but anyone can hit up the support email with an invoice number and the version of Unity they use if they want a copy before it hits the asset store.
     
    Last edited: Sep 4, 2017
  28. lchaia

    lchaia

    Joined:
    Jun 5, 2014
    Posts:
    2
    Hey guys, so I bought this and I'm trying to implement it to my NavMeshAgents who were previously using the NetworkTransform.
    I've noticed that states won't be sent to owners when the ClientScene.ready is false. On my dedicated server it is always false, not sure if that's ok, and can't find anywhere that says so..
    Maybe it should be set as ready at some point, despite of being a dedicated headless server?
    For now, I attempted to modify the Update method to check the ClientScene.ready only on clients while waiting for a real answer, but that triggers some errors when spawning the agents, despite of being working really smooth:)

    Thanks!

    Could not find target for network state message. [..]

    NullReferenceException: Object reference not set to an instance of an object
    Smooth.SmoothSync.HandleSyncFromServerToNonOwners (UnityEngine.Networking.NetworkMessage msg) (at Assets/Plugins/Smooth Sync/SmoothSync.cs:677)
    [..]
     
  29. Jick87

    Jick87

    Joined:
    Oct 21, 2015
    Posts:
    124
    This asset looks interesting... :)

    I'm curious about how it all works though... How does this work in relation to physics-based players and interaction with server-owned physics objects? Does it work? Or do the clients need to own the objects in order for interaction to work well and smooth? Also, what about players with server authority? I guess you'd need some sort of client-side prediction and reconciliation so this asset wouldn't work in that case?

    Thanks.
     
  30. tobetobe

    tobetobe

    Joined:
    Nov 22, 2016
    Posts:
    13
    Hello @Fuestrine I got an error as below
    Code (CSharp):
    1. Assertion failed: Assertion failed on expression: '!CompareApproximately(aScalar, 0.0F)'
    2. UnityEngine.Quaternion:Lerp(Quaternion, Quaternion, Single)
    3. Smooth.State:Lerp(State, State, Single) (at Assets/Plugins/Smooth Sync/State.cs:81)
    4. Smooth.SmoothSync:interpolate(Single, State&) (at Assets/Plugins/Smooth Sync/SmoothSync.cs:456)
    5. Smooth.SmoothSync:setInterpolationPosition() (at Assets/Plugins/Smooth Sync/SmoothSync.cs:327)
    6. Smooth.SmoothSync:FixedUpdate() (at Assets/Plugins/Smooth Sync/SmoothSync.cs:300)
    And it happens from the Quaternion, of both start and end target, to be (0.0, 0.0, 0.0, 0.0).

    It only happens on remote players but not local player, would anyone know what might cause this? :/ Thanks!

    (Edit) more info: I have None for Sync Rotation on the parent SmoothSync script. Wonder if that's the reason..
     
    Last edited: Sep 7, 2017
  31. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    Alright, that latest update was a bit harder than I thought, but I finally pushed it out.

    A hurricane is coming right at me so I'm about to be without power for probably the next week. Hopefully you'll have no problems but if you do, just let me know and I'll get to it when I can.

    As always, if you want the updated version now, shoot me an email at the support email with your invoice number and which version of Unity you are using and I'll send it out, hurricane permitting of course.

    @lchproducciones
    Your problem should be fixed.

    @Jick87
    Interacting with server owned objects is not as smooth as interacting locally of course but it's pretty good with a decent send rate. You are correct that players with server authority would require some special handling. The plugin will sync them just fine but everything will feel delayed unless you somehow handle user input immediately with some sort of client-side prediction like you say.

    @tobetobe
    I don't get this issue when I set Sync Rotation to NONE on the new version I just put out. Check the new version when it comes out (or email me for it immediately).

    Change log:
    Fixed dedicated server issue.
    Added send position, rotation, velocity, and angular velocity thresholds so you don't need to send some things or any things when not changing or if haven't changed enough.
    Added receive thresholds.
    Added the ability to send any combination of position, rotation, velocity, angular velocity.
    Now uses rigidbody.MovePosition except when teleporting.
     
    Last edited: Sep 9, 2017
  32. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Hi there! I just purchased Smooth Sync.... I was previously syncing a VR player prefab with one NetworkTransform (the head) script and two NetworkTransformChild scripts, (the hands)... I calculate and show my outgoing bytes/sec for the client with a UI using NetworkTransport.GetOutgoingFullBytesCount, I just replaced the NetworkTransforms, have the children set appropriately on the two additional Smooth Syncs, have all compression on, velocity/angular velocity set to none, and my outgoing bandwidth on all clients went up quite a bit. Am I doing something wrong?
     
  33. aftokinito

    aftokinito

    Joined:
    Jan 30, 2013
    Posts:
    10
    I've got a problem where only the first client gets its position updated.
    The second client and further only get rotation updates and very sparse (it's very jerky).

    I'm using the default settings for SmoothSync and the default settings for NetworkManager. The Game Object is a simple one with a rigidbody and a mesh.
    The game is server authoritative, ie, all the objects are server authoritative and the clients only have authority over their own player prefab which sends commands to the server to apply movement (MoveTo) to their actual playable objects.

    As I said, it works perfectly fine on the first client and the server sees the scene properly too, but further clients don't get position updates for themselves and no updates at all for other players' controller objects.

    I have been fighting with this the whole day and I reached the conclusion that the target state on the non-owners always has the same position (the spawn one) on the second client, but the first one has its proper synced position on the target state for non-owners.

    Please advise.
     
  34. aftokinito

    aftokinito

    Joined:
    Jan 30, 2013
    Posts:
    10
  35. AlCaTrAzzGames

    AlCaTrAzzGames

    Joined:
    May 17, 2017
    Posts:
    25
    will this work with Photon PUN games?
     
  36. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    @Fuestrine hey if you're not going to respond as to why this asset uses more bandwidth than networktransform from client -> host, can i get a refund?
     
  37. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @aftokinito
    Sorry about that. I just fixed it and pushed a new version to the asset store. Feel free to email me with your invoice number and which version of Unity you are using if you want the update quicker.

    @PrimeDerektive
    More bandwidth in that scenario doesn't sound good. I'll look into it and get back to you.

    @AlCaTrAzzGames
    I'm not entirely sure what Photon PUN is, but Smooth Sync uses UNET. I would think if you can use UNET, you can use Smooth Sync. It's just a script that you add to objects that uses UNET to sync them.
     
    Last edited: Sep 14, 2017
  38. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Sorry I was a little salty before, i'm trying to get my bandwidth down in a VR game. I watch my clients upload to the server because I want to be careful to stay as far from the 4Kbps per user/per second limit, I was using NetworkTransform and two NetworkTransformChild scripts to do the head/hand/hand on my player prefab, i switched it to 3 smoothsync's and my client upload went from ~1400 bytes/sec to ~2000 bytes/sec, with full compression on the children and compressed rotation on the parent (head). I monitor client -> server bandwidth like this:

    Code (csharp):
    1.  
    2. [LIST=1]
    3. [*]using System.Collections;
    4. [*]using System.Collections.Generic;
    5. [*]using UnityEngine;
    6. [*]using UnityEngine.Networking;
    7. [*]using UnityEngine.UI;
    8. [*]
    9.  
    10. [*]public class NetworkAvatarStatsUI : NetworkBehaviour {
    11. [*]
    12.  
    13. [*]    int newBytes = 0;
    14. [*]    int lastBytes = 0;
    15. [*]
    16.  
    17. [*]    public override void OnStartLocalPlayer()
    18. [*]    {
    19. [*]        base.OnStartLocalPlayer();
    20. [*]        InvokeRepeating("RecordAndDisplayBytes", 0.0f, 1.0f);
    21. [*]    }
    22. [*]
    23.  
    24. [*]    void RecordAndDisplayBytes()
    25. [*]    {
    26. [*]        lastBytes = newBytes;
    27. [*]        newBytes = NetworkTransport.GetOutgoingFullBytesCount();
    28. [*]        if(lastBytes != 0 && newBytes != 0)
    29. [*]        {
    30. [*]            int bytesLastSecond = newBytes - lastBytes;
    31. [*]            Debug.Log("Outgoing bytes per second: " + bytesLastSecond.ToString());
    32. [*]        }
    33. [*]    }
    34. [*]
    35.  
    36. [*]}
    37. [/LIST]
    38.  
     
  39. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @PrimeDerektive
    Yeah, I'm definitely seeing the same issue here with children. Sorry about the problem and thanks for bringing it to my attention. I looked around but I couldn't find anything that stood out. This is going to require some solid time to figure out where I went wrong. The next few days are shot, but I'll get back to you on Tuesday and hopefully with a working solution.
     
    Last edited: Sep 16, 2017
  40. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @PrimeDerektive
    We just can't figure out why we only lose to NetworkTransform when syncing both children and parents at the same time and only from client to the server. We beat them in every other possible combination we found. We looked over the NetworkTransform scripts to see how they did it and nothing helped.

    I think I'm just going to have to say to lower your send rate because using NetworkTransform with children doesn't even work anyway right? If you have no rigidbodies it's super jerky, and if you have a rigidbody as the parent and a child collider, everything is just wrong. NetworkTransform can't sync our player controllers in the example scene at all.

    Let me know if you think it's not better than NetworkTransform after you lower the send rate. I definitely am going to ask some questions around anyway at least because this is just bugging the heck out of me now.

    I think you mainly care about client to server but keep in mind that you save bandwidth from the server relaying the client information around so you don't have to lower the send rate on child objects that much to make overall bandwidth lower than Network.Transform.
     
    Last edited: Sep 20, 2017
  41. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    New version 1.04 was just submitted to the Asset Store.

    If you want the updated version now, shoot me an email at the support email with your invoice number and which version of Unity you are using and I'll send it out.

    Change log for version 1.04:
    Added functionality to use the NetworkProximityChecker.
    Changed some errors to just warnings and fixed a null reference. They didn't have any impact but no one likes to see an error when it's not needed.
     
    lchaia likes this.
  42. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    New version 1.05 was just submitted to the Asset Store.

    If you want the updated version now, shoot me an email at the support email with your invoice number and which version of Unity you are using and I'll send it out.

    Change log for version 1.05:
    • Fixed using rigidbody instead of rigidbody2D problem.
    • Fixed falling through floor extrapolation problem.
     
  43. TheBored

    TheBored

    Joined:
    Aug 23, 2014
    Posts:
    10
    Was there ever a resolution to the issue that @Vaidoras posted? I am also running into this error. At the log message "Could not find target for network state message." the netId does not exist within the ClientScene. It seems that SmoothSync's message is beating UNet's instantiation of the object... though I doubt that's actually the case. If the problem hasn't been solved, let me know if I can assist.

    Second thing - more of a suggestion/request. I'm relatively new to Unity, but it feels like it's fair to assume that every game will have a different scale for unit movement. That is - someone simulating ants might think that .01 units is a relevant distance, while a space simulator might not care about anything less than 1. When I started using Smooth Sync (well, minus problems above) it was as advertised... it just worked after I added it. It wasn't buttery smooth though, because I needed to tool around with the interpolation/extrapolation settings.

    It would be helpful if there was a way to toggle warnings when interpolation/extrapolation limits are hit, to better tweak the values. In my case, units moved too fast and cause jumps pretty frequently... having warnings would let me better diagnose teleports vs framerate lag vs network lag (and others).

    Thanks for the asset and any assistance!

    EDIT: Unity 2017.1, SS 1.04
     
  44. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @TheBored
    Yes, the errors now do not display in the latest version on the store. I put a null check for one of the errors. The other two I downgraded to warning debug output that still sometimes gives two warnings upon instantiation, but you can ignore them. If you don't like seeing these warnings, you can comment out my debug when not trying to debug any problems. I'll try looking into why they get displayed upon instantiation again but I couldn't figure it out while still giving the warnings for other debugging purposes.

    I'm not really sure what some of the upper limits would be since someone might want huge ships. You do have a good point though because negative numbers at the very least don't make sense. I'll look into larger scale scenes and numbers but at the very least I'll put some less than zero fixes for pretty much every variable.

    Let me know if I missed anything or if you have anymore comments / questions.
     
  45. TheBored

    TheBored

    Joined:
    Aug 23, 2014
    Posts:
    10
    I pulled down the latest from the store and the issue is still around. After diffing the update, I think we might be talking about different issues. I'm receiving the warning from State.cs:344, and a NullReferenceException on SmoothSync.cs:1230. Likely due to these issues, the game object is not syncing to remote clients. After debugging, it appears the objects don't exist at the time of the errors but do immediately after.

    To go into a bit more detail, I looked at the Deserialize method in State.cs. Line 342 says if no object is found, log a warning and return null. Presumably when things are working, you would expect this method to be called many times per second while the object moves around. So I added an else condition to the if block, now it reads "if no object found, log warning --- else log message saying that object was found". The warning is fired once per object, the "message found" condition is never fired. Unsure of what this means on your side, but hopefully it sheds light.

    About the other part, regarding the numbers to use - I'm less worried about min/max. but more of a way for us to experiment with what values are good or bad. If there was a "Trace" option on the SmoothSync component, it could put up a debug message each time the interpolation/extrapolation limits are reached. Then it would be easier to play-test different values, weighing higher/lower values against realistic movement. It isn't always obvious when the distance limit is reached, a log message would make it pretty clear.

    Hope that makes sense.
     
  46. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @TheBored
    Definitely sounds new but I can't recreate the issue in the example scene. How are you spawning your networked objects?

    I like the debug suggestion you have. I'll put it in the next update.
     
  47. TheBored

    TheBored

    Joined:
    Aug 23, 2014
    Posts:
    10
    I don't believe I'm doing anything radical... here's a list of different things currently implemented:

    • Player is a prefab with SS (default options) component, sync works exactly as expected.
    • Bullet is a prefab is SS (default options) component, sync does not work.
    • Bullet is "shot" via a [Command] from the client, executed on the server.
    • Both Player and Bullet are instantiated on the server via the same class. This class is responsible for getting the requested prefab, instantiating (w/Zenject), and returning the object.
    • After obtaining an instance of the GameObject, Player is network spawned via NetworkServer.AddPlayerForConnection() and Bullet is network spawned via NetworkServer.Spawn().
    Neither object is really dealt with after instantiation, their components handle the remainder. Both have NetworkIdentities, neither has a NetworkTransform.
     
  48. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    587
    @TheBored
    I just tested NetworkServer.AddPlayerForConnection() and NetworkServer.Spawn(), and both sync the spawned objects for me with no errors. I don't recognize Zenject though. Can you send me a small project with the problem in it or can you try to recreate the problem in the example scene and tell me how to recreate it?
     
  49. TheBored

    TheBored

    Joined:
    Aug 23, 2014
    Posts:
    10
    I'll try and do that... somewhat of a gamble since I don't know what's causing the problem. Will probably be a couple of days.
     
  50. SpindizzyGames

    SpindizzyGames

    Joined:
    Jun 29, 2017
    Posts:
    108
    I am looking into porting the code to use a different physics & networking system with Unity.

    Can you get me up to speed on what I would have to do in order to accomplish this?