Search Unity

Showcase Mirror - Open Source Networking for Unity

Discussion in 'Multiplayer' started by mischa2k, Aug 11, 2016.

  1. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I just looked into your bug report. I didn't noticed that you used network simulation - this feature was confirmed to be broken forever. Don't use it, that probably explains the interpolation issues.
     
  2. surfknasen

    surfknasen

    Joined:
    May 8, 2017
    Posts:
    14
    I have the interpolation issues if I upload the build to my server too.
     
  3. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Experimental Version Update: added NetworkTransformChild again.
    Note that I don't like that design at all, it should just be NetworkTransform with an optional target property, but for the sake of HLAPI compatibility I wrapped it in a NetworkTransformChild class.

    Enjoy!

    Does it happen with non rigidbody sync too? Maybe the server is laggy etc.
    This is hard to reproduce for me, sorry for the trouble.
     
  4. surfknasen

    surfknasen

    Joined:
    May 8, 2017
    Posts:
    14
    Yes it also happen with a non-rigidbody sync too. The server is not slow, I've checked. I really gotta get this working soon :/ Do you have a server that you test on?
     
  5. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    So the default HLAPI NetworkTransform works better than the one in HLAPI Pro for you?
     
  6. surfknasen

    surfknasen

    Joined:
    May 8, 2017
    Posts:
    14
    No the default one works a lot worse, so I downloaded HLAPI Pro hoping I could get smooth movement on my player.
     
  7. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Can you add more than one? as you can add as many NetworkTransformChild components to a NetworkTransform as you want in vanilla UNET.
     
  8. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Of course
     
  9. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Okay, so it's weird. Got this message again:
    DefaultReliable is 0 and 1? wut

    Also, Channel setup in NetworkManager:
    Channel #0 - Reliable Sequenced
    Channel #1 - Unreliable
    Channel #2 - All Cost Delivery
     
  10. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    This isn't saved or detected properly the first time for some reason, someone else had this problem too. Just resave, restart and it will go away at some point.

    My guess is that this is related to the UNET bug that we had a while ago where some networkmanager settings weren't saved at all.
     
    xVergilx likes this.
  11. Artaani

    Artaani

    Joined:
    Aug 5, 2012
    Posts:
    423
    Wow! This is my post!
    So I am a pushed a creator of LLAPI to answer on some critics, which eventually encouraged you to develop the HLAPI Pro.
    Incredible!

    Your work sounds amazing! Thanks! We are definitely will help to test it.
     
  12. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Thanks!
     
  13. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Network source is available for 2017.2. Hope to see an updated version soon :)
     
  14. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Been looking into that today but there seems to be a bug:

    @larus when I take the 2017.2 code from Bitbucket, build it and copy Output DLLs into 2017.2.0f3 Unity folder on OSX and then open Unity I still get this error:
    upload_2017-10-17_22-10-16.png

    Even though I did overwrite the Weaver dll exactly like I did with the 2017.1 HLAPI version. Am I missing something?
     
  15. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yeah, I had same error with current version of HLAPI Pro and 2017.2. I guess they've changed something in UnityEditor lib;
     
  16. TriangularCube

    TriangularCube

    Joined:
    Apr 6, 2016
    Posts:
    16
    So...here's a weird question. The following evaluates to null:
    Code (CSharp):
    1. var leavingPlayer = connectedPlayers.Find( x => x.playerNumber == msg.ReadMessage<IntegerMessage>().value );
    but change it a little and it's fine
    Code (CSharp):
    1. int val = msg.ReadMessage<IntegerMessage>().value;
    2. var leavingPlayer = connectedPlayers.Find( x => x.playerNumber == val );
    Is this a bug in the behaviour of how NetworkMessage is deserialized or something...?
     
  17. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You might be reading message twice. Since it's not caching anywhere.

    Also, please don't hijack this thread. I kinda like it :p
     
    Deleted User likes this.
  18. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    @vis2k

    I am using 2 projects, one for the client, the other for the server...

    After replacing my unity files with your solution i tried to build a client of the client project but i could not proceed due to the following errors :

    Type '[Assembly-CSharp]UnityEngine.Networking.NetworkManager' has an extra field 'clientLoadedScene' of type 'System.Boolean' in the player and thus can't be serialized (expected 'isNetworkActive' of type 'System.Boolean')
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    Fields serialized in target platform, class 'UnityEngine.Networking.NetworkManager'
    'm_NetworkPort' of type 'System.Int32'
    'm_ServerBindToIP' of type 'System.Boolean'
    'm_ServerBindAddress' of type 'System.String'
    'm_NetworkAddress' of type 'System.String'
    'm_DontDestroyOnLoad' of type 'System.Boolean'
    'm_RunInBackground' of type 'System.Boolean'
    'm_ScriptCRCCheck' of type 'System.Boolean'
    'm_MaxDelay' of type 'System.Single'
    'm_LogLevel' of type 'UnityEngine.Networking.LogFilter+FilterLevel'
    'm_PlayerPrefab' of type 'UnityEngine.GameObject'
    'm_AutoCreatePlayer' of type 'System.Boolean'
    'm_PlayerSpawnMethod' of type 'UnityEngine.Networking.PlayerSpawnMethod'
    'm_OfflineScene' of type 'System.String'
    'm_OnlineScene' of type 'System.String'
    'm_SpawnPrefabs' of type 'System.Collections.Generic.List`1[UnityEngine.GameObject]'
    'm_CustomConfig' of type 'System.Boolean'
    'm_MaxConnections' of type 'System.Int32'
    'm_ConnectionConfig' of type 'UnityEngine.Networking.ConnectionConfig'
    'm_GlobalConfig' of type 'UnityEngine.Networking.GlobalConfig'
    'm_Channels' of type 'System.Collections.Generic.List`1[UnityEngine.Networking.QosType]'
    'm_UseWebSockets' of type 'System.Boolean'
    'm_UseSimulator' of type 'System.Boolean'
    'm_SimulatedLatency' of type 'System.Int32'
    'm_PacketLossPercentage' of type 'System.Single'
    'm_MaxBufferedPackets' of type 'System.Int32'
    'm_AllowFragmentation' of type 'System.Boolean'
    'm_MatchHost' of type 'System.String'
    'm_MatchPort' of type 'System.Int32'
    'matchName' of type 'System.String'
    'matchSize' of type 'System.UInt32'
    'clientLoadedScene' of type 'System.Boolean'
    'isNetworkActive' of type 'System.Boolean'
    'matchMaker' of type 'UnityEngine.Networking.Match.NetworkMatch'

    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    Error building player because script class layout is incompatible between the editor and the player.
    UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

    Starting & Connecting both projects worked without problem.

    Using v2017.1.0f3
     
  19. TriangularCube

    TriangularCube

    Joined:
    Apr 6, 2016
    Posts:
    16
    ;) Sorry, wasn't trying to hijack the thread, just trying to figure out if it's an HLAPI Pro bug, or a Unity bug, or a C# bug...I'm not terribly familiar with Lambdas so it could be that.
     
  20. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I am not sure if I understand you. You said both projects worked but they don't work?
     
  21. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Progress: tried to build HLAPI 2017.2 with the DLL files from my Unity folder, still getting:


    Anyone managed to build the fresh HLAPI project and use it in 2017.2?

    @larus @aabramychev I know you guys are busy, but could you please test the Bitbucket HLAPI source again?

    And any words on HLAPI's future in general?
     
    Last edited: Oct 20, 2017
  22. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    The project works as should during play mode... but when i try to build the client i am getting all those errors...
     
  23. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Are you guys saying that even 2017.2 default HLAPI builds doesn't work? If so, that's a huge f*** up from Unity team side.
     
  24. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Do you use cloud build? If yes, try not to.

    Untouched Unity works, but if you build HLAPI from Bitbucket and copy it in there then it doesn't
     
  25. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I guess nobody tested it after uploading. That's quite... professional :D
     
    Last edited: Oct 20, 2017
  26. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    just regular build
     
  27. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Which Unity version? Can you try on another computer? Can you try Unity 2017.1.0p1?

    I am not sure, maybe it only happens under some circumstances.
    In either case, the lesson to be learned is that this whole Weaver thing might not be optimal. It's a pain to work with and modify - having all the scripts in the Project would be way easier.
     
  28. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    Alright...

    i installed Unity 2017.1.0p3 (only one i could find)
    Applied your changes, and it worked!

    i installed Unity 2017.2.0p3 again
    Applied your changes, loaded up my client project and the following was spamming the console:

    - I have verified to make sure i did not do anything wrong during copying/replacing...
    - A new empty project did not spam the console(with your changes applied)
    - Just importing the assets folder started spamming the console again
    - I tested the editor without your changes, no errors
     
  29. nicerice

    nicerice

    Joined:
    Apr 15, 2017
    Posts:
    2
    Can HLAPI Pro NetworkTransform synchronize the positions of specific axes only ? (eg X and Z only, not Y)

    I can tolerate movement delay, but jump delay is unacceptable.
    Therefore,I want to send a jumping event using Command and ClientRpc and update the Y axis position of the player character on other clients, but HLAPI Pro NetworkTransform always synchronizes the Y axis position.
    I want to turn off the synchronization of Y axis of NetworkTransform during jumping.
     
  30. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Yes, we were discussing 2017.2 above. The HLAPI source for 2017.2 throws that error that you got and I asked the UNET devs above, but no one replied. So there's nothing we can do until they upload a HLAPI version that works.

    Maybe later, I want to get it to work 100% perfectly first.
     
    nicerice likes this.
  31. nicerice

    nicerice

    Joined:
    Apr 15, 2017
    Posts:
    2
    I am very glad to hear that!
    I will continue to use HLAPI Pro NetworkTransform for my project.
    Thanks!
     
    mischa2k likes this.
  32. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    This is most likely then the cause of my bug report posted before this... sorry for bothering you with it...
     
  33. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    NetworkProximityChecker Suggestion/Request
    ( I did a quick scan of the thread and i believe there is no talk about this, if there is, apologies...)

    1.) With my current project, i have separated the client and the server code, which is working quite well except for syncvars and NetworkProximityChecker. These will break with this approach... I am hoping you can fix that!

    2.) I did some reading about the default NetworkProximityChecker and in my opinion it does not come close to what it is supposed to do!

    In my opinion what it should do is, when the NetworkProximityChecker component is added to the server network object, the server should do a distance check per player vs network objects with an NetworkProximityChecker component and see which are within the requested range.

    (You could add an interval maybe with/or some kind of spread?)

    If these network objects are not in range, the server should stop any (NetworkTransform) updates to the player client and remove the network objects locally and inverse the action when they do come in range.

    Is this possible?
     
    Last edited: Oct 21, 2017
  34. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    2.) That's what it does. Sphere casts to find players in range, adds to observers, sync then sends it to all observers

    No problem
     
  35. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    huh... really... i was under the impression it only "hides" the local remote objects...
    it would be awesome if it did all that!


    -> Could you look into the fact that a client - server separated code run projects do not work with the NetworkProximityChecker?

    I can supply you with the 2 basic projects setup if you want...
     
  36. Deleted User

    Deleted User

    Guest

    Why do you have 2 different projects? You can split the server side code and the client side code with global defines.
    https://wobesdev.wordpress.com/2016/10/10/preprocessor-directives/

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.Networking;
    4.  
    5. public class NetworkManagerCustom : NetworkManager
    6. {
    7.     string login;
    8.     string password;
    9.  
    10.     void Awake()
    11.     {
    12.         NetworkManager.singleton = this;
    13.     }
    14.  
    15.     public override void OnServerDisconnect(NetworkConnection conn)
    16.     {
    17.         GameObject player = conn.playerControllers[0].gameObject;
    18.         Save(player);
    19.     }
    20.  
    21. #if Server
    22.  
    23.     // Server save system
    24.     void Save(GameObject player)
    25.     {
    26.         login = "DatabaseLogin";
    27.         password = "DatabasePassword";
    28.  
    29.         //save...
    30.     }
    31.  
    32. #endif
    33.  
    34. }
    The code between #if Server and #endif wouldn't be compiled into the client build. @vis2k is working in order to improve HLAPI in general, but not for fixing your wrong project architecture. So I would like to suggest for you to stop doing off-topics.
     
  37. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    What are you talking about man, this is my preferred way of doing the client/server setup... has nothing to do with applying a wrong project architecture... there is no difference... the end result is all the same...
     
    Last edited: Oct 22, 2017
  38. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    @vis2k

    1.) The default NetworkProximityChecker seems to be broken..
    i am assuming the network object never gets spawned locally...

    The same happens after i update the editor with your editor files...
    Verified it with 2017.1.03f

    Anything you can do at your end?

    -----------

    2.) I would like to suggest an addition to the NetworkProximityChecker...
    ( i am sure you have nothing on your TODO list ;) )


    I am assuming it is cross checking -all- the server network objects that have the proximity component... i can imagine this becoming quite costly at some point were you to have a lot of them...

    Would it be possible to assign groups to the proximity component?

    NetworkObject_A - Group 1
    NetworkObject_B - Group 8
    NetworkObject_C - Group 999
    NetworkObject_D(<you) - Group 8, 999

    You do not receive any network updates from A
    You do receive updates from B & C (that are within the distance check)


    the developer needs to be able to add/remove groups to the proximity component...
    the developer needs access to a list of members of the groups that meet the requirements
     
    Last edited: Oct 22, 2017
  39. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    I just want to fix HLAPI bugs without breaking the architecture for now
     
    Deleted User likes this.
  40. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    Fair enough! - so what about:
     
  41. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    Are you sure you are using it right?
    It works fine for all my rather big UNET projects (uMMORPG, uMOBA, etc.) and no one mentioned that here before.
     
    Deleted User likes this.
  42. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi,

    I'm only interested by NetworkTransform reimplementation.

    There is any way to have only this reimplementation without overriding the entire dll ?

    Thanks
     
  43. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You can take code from bitbucket and make your own class. And use it instead.
    There's no other way without replacing dll.
     
    amynox likes this.
  44. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    @aabramychev

    a user having to update your unity code, what is that about ?
     
  45. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    LLAPI actually works
     
  46. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    i dont know any other tags to address so your awesome work gets noticed... sorry

    i am assuming he knows other unity network developers :)
     
    Last edited: Oct 23, 2017
    mischa2k likes this.
  47. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    @vis2k

    1.) Where can i find a description on Send Interval and Compress rotation from the Network Transform component; so i can understand the idea behind it better?

    2.) Scripts attached to my network objects (deriving from NetworkBehaviour) show an interval send and channel description on the bottom of the component in the hierarchy... the send interval value here does not match the value i have set in the Network Transform component... No idea if this matters to you...


    Thank you :)
     
    Last edited: Oct 24, 2017
  48. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    1) Send interval = send every ... seconds
    Compress = compress quaternion rotation floats into shorts or bytes. Just use the default if you aren't sure.

    2) Yes, that's ok
     
  49. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Any news from UT team about 2017.2 source fix? I wonder if there's a quicker way to poke them.
     
  50. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    191
    as in
    send an update every 0.100f = 10 updates/second?
    send an update every 0.090f = 11.1 updates/second?
     
    Last edited: Oct 24, 2017