1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Unity Multiplayer [Official] Multiplayer Improvements

Discussion in 'Multiplayer Networking' started by Erik-Juhl, Mar 10, 2016.

  1. Alturis2

    Alturis2

    Joined:
    Dec 4, 2013
    Posts:
    14
    Totally agree! That is one of my big takeaways from working with Unity. Everything feels like it was designed well on paper but when it comes to working in the trenches things tend to fall apart or fail to live up to what is documented or much worse just crash on a regular basis causing lost project changes.
     
    isidro02139 likes this.
  2. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    I've bug reported some UNET issues and I just got an email saying "working as intended" and they are closing the bug report. So I'm posting here to see if anybody else has ran into the same bugs, and if so please say so to raise awareness so hopefully the bugs will be addressed instead of closed.

    Specifically
    1: SyncVar values can be changed without hooks being called on persistent game objects around a scene change.
    2: SyncList's can be changed without hooks being called on persistent game objects around a scene change.
    3: RPC's are not always received (even on the host!) on persistent game objects around a scene change
    4: OnDeserialize() is not always received... and the object will be "spawned" multiple times on the same client for persistent game objects
    5: SyncVars become desynced between server and existing client when a new client connects (the new connecting client calls OnSerialize which clears dirty bits and leaves the existing client with and old desynced value).

    Has anybody seen those bugs?
     
    isidro02139 likes this.
  3. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    62
    1: SyncVar values can be changed without hooks being called on persistent game objects around a scene change.
    >> Never tried/experienced (what is the nature of the scene change? Additive or not? Async?)

    2: SyncList's can be changed without hooks being called on persistent game objects around a scene change.
    >> Never tried/experienced

    3: RPC's are not always received (even on the host!) on persistent game objects around a scene change
    >> Never tried/experienced

    4: OnDeserialize() is not always received... and the object will be "spawned" multiple times on the same client for persistent game objects
    >> Never tried/experienced

    5: SyncVars become desynced between server and existing client when a new client connects (the new connecting client calls OnSerialize which clears dirty bits and leaves the existing client with and old desynced value).
    >> I think you need to manually set syncvars the first time in OnStartClient..? Seems like that could be the same issue (not sure).

    Good luck! Keep reporting those bugs ;)

    Arun
     
  4. Tyrfingur

    Tyrfingur

    Joined:
    Mar 21, 2013
    Posts:
    4
    Hey @Zullar I'm using the NetworkLobby and I had a problem with RPCs around scene changes. When the server changes scenes it calls NetworkServer.SetAllClientsNotReady() and RPCs won't be sent/received until clients are set as ready again.
     
  5. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    Who are you?
    Dylan Hunt of Imperium42 -- developer of Throne of Lies: The Online Game of Lies & Deceit

    What kind of game are you trying to build or would like to build?
    90% complete developing an online turn-based, match-based game (Unity MP with PlayFab BaaS)

    How does Multiplayer fit into that? What use-cases do you have?
    100% players in a 15-player matchup - a social deduction game. Use abilities on others, in-game chat, and try to murder others while finding out who your allies are at the same time.

    What are the GOOD things about the new Multiplayer system you like?
    MOST everything! Integrated MP, intuitive high-level goodies -- no need to access low level unless I want to. This is amazing! And the docs are 90% clear (the 10% below).

    What are the BAD things about the new Multiplayer system you dislike?
    1. Host Migration still does not work (reported June, confirmed/reproduced by Unity QA). Which, in our case, in a 15-player game where it's common for someone to leave if they die on round #1 -- if that's the host, then they disconnect 14 players! We literally cannot launch without this fixed :((

    2. Docs have broken links all over the place and are somewhat inconsistent. Although broken links generally mean UPDATES, so this is technically a good thing :) eventually!

    3. Some doc explanations are a bit vague, such as the NetworkManager callbacks -- should go more in-depth. For example, you can't even access most of the named callbacks without inheriting from NetworkLobbyManager ... which isn't even in the docs! I thought I was crazy trying to call funcs like StartHost() and having it not be found anywhere. Definitely needs more clarification.

    How can we make it BETTER?
    1. Fix host migration as #1 for sure -- everything else that's wrong are small inconveniences while this is a major advertised feature that's been completely MIA with no mention of updates since confirmed in June.

    2. For the love of anything, I am begging for a revamp of the entire Lobby docs - there are inconsistencies, mentions of mysterious asset packages with no links, almost NO matchmaking guides. There's pretty much no guides even regarding staging! There also needs to be WAY more links to other related doc tutorials, because I have to keep Googling them and the top of Google has 1/2 broken links (leading to #3) and 1/2 obsolete docs. This section doesn't need some work -- it needs a full revamp and and second QA to ensure accuracy/readability.

    3. Hire a Google-Unity-Researcher QA -- it's very common to come across broken links at the very top of Google. For example, at the very top of Google:
      [​IMG] https://docs.unity3d.com/ScriptReference/Networking.Match.ListMatchResponse-ctor.html

    4. Ensure doc consistency and 301 your old links to the new links.

    5. Have an online MP test project and keep it updated so that there's no errs out-of-the-box for whatever the latest Unity version is.

    6. Fix this lobby bug.

    7. When clicking "switch to <latest API docs>", it should switch to the CURRENT version of the current link/topic. For example:
      * I Google for matchmaking.
      * I find some obsolete material or a broken link.
      * I click "switch to <latest API version> docs"
      * I get sent to the general page and can't find my topic anymore within! Either because of a name change or too many similar ones. If I search for the same topic, sometimes I don't know which one I was originally at or may not even exist anymore. There's a word for this, but I forgot - bread crumbs?
     
    Last edited: Nov 2, 2016
    Artaani, Wobes and PhilSA like this.
  6. LutzKellen

    LutzKellen

    Joined:
    Oct 3, 2016
    Posts:
    4
    Hey, I'm a Senior at a University for Game Design and Development Bachelors. I focus on Networking.

    I like to build multiplayer games, it doesn't really matter what kind, with or without a lobby.

    What are the GOOD things about the new Multiplayer system you like?
    A lot less confusing and crazy to get working. It really makes getting a networked game up and running really easy.

    What are the BAD things about the new Multiplayer system you dislike?
    The documentation varies from decent to terrible. Lobby Manager has almost no support besides the two Asset store projects which are incredibly obtuse to most implementations. The code for those scripts are under-commented and over optimized making it a pain to figure out how I should actually implement a simple ready up system.

    How can we make it BETTER?
    Need simpler projects, or better documentation. Perhaps tutorials that don't use such advanced techniques. The Network Manager tutorials are simplistic and not advanced at all, which allows me to implement Network Managers more easily and at my own level.
     
    dylanh7244 likes this.
  7. nonom

    nonom

    Joined:
    May 1, 2014
    Posts:
    10
    Hey guys! Take care using Unity UNET because its not ready for production.
     
    benzsuankularb likes this.
  8. benzsuankularb

    benzsuankularb

    Joined:
    Apr 10, 2013
    Posts:
    69
    What are the GOOD things about the new Multiplayer system you like?
    Easy to get worked (at beginning).
    SyncVar RPC etc. are work pretty well for me. I didn't try those network transform yet and I don't really need it now.

    What are the BAD things about the new Multiplayer system you dislike?
    It's much much more harder when I have to customise NetworkManager. Method naming + description and sequences are always too confuse and complicated. Many time I don't know this method gonna run on client or server or both. Many time I want an extra overriding behaviour maybe because of less picture in my head on how unet sequence step by step.

    How can we make it BETTER?
    Do good simple example. Good simple description. More simple and clear naming.
    Explain whole NetManager, ClientScene, NetIdentity 's Sequences.

    AND I NEED SERVER DLL.
     
    Last edited: Nov 10, 2016
    LittleRainGames likes this.
  9. iCode

    iCode

    Joined:
    May 25, 2013
    Posts:
    25
    Couldnt agree more with this.
     
    isidro02139 likes this.
  10. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    isidro02139 likes this.
  11. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    289
    well hey.... looks like Unity is looking for someone to make an example online game to showcase what's possible to do with Unity networking: https://careers.unity.com/position?id=272351

    I'm just hoping it's actually a fast-paced network-heavy game and not just a mobile turn-based kind of thing. It says "for PC or consoles", so that's really encouraging
     
    Last edited: Nov 18, 2016
  12. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    Some additional notes:
    • TL;DR: Old code examples (the NetworkLobbyManager component is barely mentioned and not used in almost any examples),
      Conflicting doc code with old code,
      NetworkLobbyManager component callbacks don't fire,
      NetworkLobbyManager and NetworkManager conflict and should be warned not to have both,
      & what should we do if we don't want lobby as first scene.

      ________________________________________________

    • https://docs.unity3d.com/550/Documentation/Manual/UnityMultiplayerIntegratingHighLevel.html
      This refers to old-UI OnGUI() events and the use of `NetworkMatch` when the newer `NetworkLobbyManager` has this integrated within, causing unnecessary confusion - especially for those that don't know about the NetworkLobbyManager component.

    • Conflicting docs for UNET callbacks (I just noticed this - possibly more, not sure):
      (Wrong) https://docs.unity3d.com/550/Documentation/Manual/UNetManager.html
      (Correct) https://docs.unity3d.com/550/Documentation/Manual/UnityMultiplayerIntegratingHighLevel.html

    • OnMatchList() and OnMatchCreate() does not fire when called from the NetworkLobbyManager component. Well, they fire, but you can't override it unless you make your own callback, which not sure if this is intended or the actual way to do it (docs should clarify) because the custom lobby script should be Mono (out of scope to call OnMatchMakingCallbacks).
    • The NetworkLobbyManager component class script derives from NetworkBehavior. This means that you don't need a NetworkManager in your lobby, even though most demos and script samples show calls from the NetworkManager. If you have one, it will conflict and destroy each other. This should be clarified and emphasized somewhere while there are way too many samples showing the old strategies since you only need the NetworkLobbyManager ~

    • The quickstart API doc instructs us that we have to have the lobby as the FIRST scene in the build settings - and that it will not work without it. This is awkward for those that desire a login screen (most mplayer games will have one) prior to the lobby. There are no instructions of what to do if you want a scene before the lobby screen.

    • In our game, we cannot spawn a GamePlayer prefab immediately. However, it's required that we have one, making things a bit awkward for the next scene. This also means we can't make use of serialization of a GamePlayer, which should contain quite a lot in a multiplayer game. We messaged support and were told it's not possible at this moment.
     
    Last edited: Nov 21, 2016
    Artaani and isidro02139 like this.
  13. Iron-Warrior

    Iron-Warrior

    Joined:
    Nov 3, 2009
    Posts:
    633
    Probably Chess.

    I did make a multiplayer "shooter" game awhile back using Unet, but each time I iterated on it I basically removed more and more of the built in components. I wish they'd just go for a philosophy of providing really simple, well implemented communication components (sending RPCs, syncing data) and then building a higher level framework on top of that. Right now the low level is very low level, and the High Level API is just unusable.
     
    ThaiCat likes this.
  14. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    I agree. The HLAPI is unusable at this point and I've ended up removing it all bit by bit as I've come across bugs that have no workarounds. But I believe the UNET team did say they are not going to work on HLAPI... that they are working on the core robustness at the moment. I think this the right decision.
     
  15. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    62
    Where did you read this Zullar :eek: ?? Is there a roadmap or (semi) official discussion anywhere on the state/direction of UNET?
     
    dylanh7244 likes this.
  16. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    I'm interested, too. I've focused my entire project on HLAPI -- it would explain why there's minimal docs or demos for it.. this makes me nervous to hear.

    EDIT: A high-up Unity staff member ensured me that HLAPI is STILL under active development - woot! Tag @isidro02139
     
    Last edited: Dec 15, 2016
    slake_it likes this.
  17. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    I read that from here. But maybe they were talking about the transport layer, not UNET as a whole?

    https://forum.unity3d.com/threads/new-multiplayer-transport-release.435133/#post-2824676
    "However, we've focusing more on bugs, stability fixes and documentation improvements and will do that until those are in a good state. When stuff like the new transport and dashboard improvements are done we'll rather work more on bugs, rather than adding other shiny features (besides the ones listed here), at least until we're happy with the foundation."



    I think the UNET HLAPI is structured well and the components will be really nice once complete. But the HLAPI has been nothing but problems for me. It's too buggy/incomplete at the moment. I've ended up removing all UNET HLAPI and using messages instead. Here's a list of HLAPI issues I've had.

    NetworkAnimator
    -Works well for 1 animation layer. But if if you have multiple animation layers only the base layer network syncs, not other layers.

    NetworkTransform
    -Jittery
    -Compressed rotation resolution is poor (for 16bits it should have 0.005deg resolution but it has 1deg resolution)

    NetworkIdentity
    -Does not allow split authority. i.e. you cannot have Server control NetworkAnimator and Client control NetworkTransform. All components must be the same direction (either client --> server or server --> client). However many games give client control of motion with server control of actions & animations... and this is not supported.
    -observers drop off during scene change for persistent DontDestroyOnLoad objects. This is my biggest issue... and causes ~10 bugs.

    NetworkBehaviour
    -OnNetworkDestroy is inconsistent. Sometimes it's called before OnDisable, and sometimes after. Sometimes it's called on Server but not on Client (like for spawned networked objects on scene exit). You don't know if it's being called due to Scene Exit, Application Close, or a forced destroy called by NetworkServer.Destroy(). The same issue for OnDestroy(). It's hard to use because it's inconsistent and there is no context. (i.e. if you generate shrapnel on destroy... well you don't want to do this on scene exit or application exit... but how do you know?)
    -Cannot add scripts at runtime. For simplicity I use scripts/inheritance to populate a lot of common stuff (so I don't have to manually add & set on each prefab). But you cannot add NetworkBehaviours at runtime or even during Awake.
    -Inefficient. At least 8bits dirtyBit are sent for each script's dirtyBitMask. In my case I have a script for each feat (even untrained unusable ones) because I cannot add/remove NetworkBehaviours at runtime. So lets say I have 50 feats. That's 50x8 or 400bits of overhead on each OnSerialize... not including the payload. If I'm my networkSendInterval is 50ms then the overhead becomes 400bits x 20sends/sec or 8,000 bits/sec for just ONE player object. That's just the dirtyBitMask overhead not including other overheads or payload.

    RPCs/Commands
    -Does not support inheritance. Any RPC/Command with the same name will go to the first script in the hierarchy... not the script that called it (Funny bug I attacked with my sword and a fireball popped out...). Likely cause is the hash being the same between scripts?
    -RPC's can fail to deliver. They even can fail to deliver to host when called on the host! This has to due with NetworkIdentity.observers dropping off during scene change for persistent DontDestroyOnLoad objects.

    SyncVars/SyncLists
    -Repeatedly setting a SyncVar to the same value sets dirtyBit and chews up network bandwidth.
    -Limited to 32 SyncVars/script
    -SyncVars can become desynced between clients. This is due to a late connecting player forcing OnSerialize(initialState = true) and clearing dirty bits. Any existing clients will have old values and will never receive updated values until the SyncVar is changed.
    -SyncVar hooks can fail. During initialization and around a scene change SyncVar hooks will fail. This is due to NetworkIdenity.observers dropping off, then getting re-added and OnSerialize (initialState = true) refreshes all SyncVars w/o calling hooks.
    -SyncList callbacks have insufficient information. i.e. you will get a callback saying something was removed from list... at index 13... but you have no idea *what* was removed because it's after the fact. In general callbacks should give access to oldVal AND newVal but they don't.
    -Cannot have client control over SyncVar/SyncList

    NetworkReader/Writer
    -Must write in full bytes. So when you write a bool it actually uses up 8bits instead of 1bit.

    UNET Message Inheritance is Broken

    -Any serialized fields in parent classes do not get read. They will receive the default value after the message is deserialized.



    How to Fix?
    Due to all these bugs I ended up scrapping the UNET HLAPI. I made my own which was almost identical to UNET's (which is why I say UNET HLAPI will be really nice once it's bugs are fixed). Here's what I did.
    -NetworkReader/Writer can write 1bit at a time.
    -Each script has a 1bit dirty Mask. So with 50scripts the overhead is only 50bits not 400bits.
    -Each syncVar has it's only dirtBit. Structure is like this. This has the benefits of not limiting syncVars to 32, and also not having 8bits of dirtyMask overhead if there are say only 0 or 1 syncVars.
    SyncVar0: 1dirtyBit Xbitpayload (if dirty)
    SyncVar1: 1dirtyBit Xbitpayload (if dirty)
    SyncVar2: 1dirtyBit Xbitpayload (if dirty)
    ...
    -Each script can send either client --> server -> otherClients or server --> client. On one object the directions of information can be mixed. So on one object you can have motion control that is client --> server and animation/action control that is server --> client. This also allows clients control over my SyncVars.
    -Observers do not drop off during sceneChange for persistent DontDestroyOnLoad objects. This prevents RPC's from failing and also prevents everything being reseialized (initial state = true) upon scene entry.
    -When a late connecting player connects if an object is dirty it sends all information to all existing clients (initial state = false). Then serializes and sends all data to the new client (initial state = true). This prevents desyncing of clients. All clients will have the same data and all dirty bits will be cleared at the end of this.
    -Custom network transform
    ---Send interval is adjusted based on distance to closest player (top-down game so no need to update off-screen stuff fast)
    ---Compression is optimized. You can say WriteFloat(0, 360, 12, value) and it will write between 0deg and 360deg with 12bits of resolution. Only data that is changed is sent.
    ---The object's hierarchy is split. The visual component is broken off and LERP'd to the base transform. The base transform is snapped.
    ---In addition to current position/rotation/velocity I also send commanded angle & velocity so that physics can be run locally on client in-between networkSend interval updates. I did this because the player has rigidbody physics.
    -SyncVar & SyncList callbacks provide access to both oldVal AND newVal.
    -CustomNetworkAnimator supports multiple animation layers
    -I can also use the same serialization to read/write to file (with a little error proofing to handle future version changes).
    -I still haven't found a good way to do commands/RPC's though.

    Any questions about bugs or fixes let me know. If anybody at Unity reads this and wants reduced code to replicate a bug please let me know.
     
    ThaiCat and dylanh7244 like this.
  18. Driiades

    Driiades

    Joined:
    Oct 27, 2015
    Posts:
    53
    "NetworkTransform
    -Jittery
    -Compressed rotation resolution is poor (for 16bits it should have 0.005deg resolution but it has 1deg resolution) "

    Normal when you just say : (short)rigidbody2D.rotation xD.

    The NetworkTransform is so funny, there are 3 lines like this :

    Code (CSharp):
    1. float orientation = rigidbody2D.rotation%360;
    2. if(orientation < 0)
    3. orientation += 360;
    4.  
    5.  
    6. //And ... ? That's it, orientation is never used after that xD

    RPC/Command are funs too, because if you place 2 same networkBehaviours : Rpc/Command go to the first (only !!!!)

    I will love that zullar work on HLAPI.

    And i will also love this : "WriteFloat(0, 360, 12, value) " :D
     
  19. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    1,523
    You should probably use the bug reporter for all the bugs that you found, mentioning it on the forum doesn't usually help much / they would probably send it to QA anyway.
     
  20. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    251
    It's really a shame that the HLAPI is so buggy, i wasted a lot of hours on basics.

    I'm really looking forward to Photon Thunder, i see they now have a page up: https://www.photonengine.com/en/Thunder
     
  21. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    I have bug reported these. Unity QA was very responsive and has replicated most of them, but there seems to be a breakdown because the UNET team has not fixed any of them. Not sure what else to do... so I'm posting here as well.

    Most issues are closed "By Design" or "Postponed" or "Closed".

    By Design. Command/RPC Hash Bug Does that mean this bug will NEVER be fixed?
    https://issuetracker.unity3d.com/issues/commands-with-duplicate-names-call-wrong-command

    Postponed/Closed: NetworkAnimator Multiple Layer Bug
    https://issuetracker.unity3d.com/is...t-layer-animations-are-synced-through-network
    https://fogbugz.unity3d.com/default.asp?794443_l24atkuvp8v1kcli

    Postponed/Closed: Message Inheritance Bug
    https://issuetracker.unity3d.com/is...ebase-doesnt-call-overridden-serialize-method
    https://fogbugz.unity3d.com/default.asp?747334_sfs90f3bcm8nrcok

    Postponed/Closed: SyncVar Hooks Failing
    https://issuetracker.unity3d.com/is...-syncvar-value-is-changed-during-scene-change
    https://fogbugz.unity3d.com/default.asp?821462_77akksd73ndpi6du

    Closed: RPC's Failing
    https://fogbugz.unity3d.com/default.asp?831893_63262uhermqgeju4

    Closed: OnSerialized Called Repeatedly Each Scene Change
    https://fogbugz.unity3d.com/default.asp?821633_5ps5qsis7vrrevrr
     
    Wobes, ThaiCat and iddqd like this.
  22. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    TL;DR: I'm upset that they made a big deal about this stuff, but then don't even support it, don't answer questions, don't fix bugs, and don't even update us on the current situation of things. I decided to go commercial with this and although it's potentially wonderful, the current state is just that it actually is easy to use, but no one knows exactly the standard or workflow to use and there's no clue anywhere except for your own trial/error.

    ALL OTHER Unity subjects, they have docs, videos, demos, update the API, step-by-step for advanced stuff, show us the workflow, and update us - so why is HALPI/UNET/Lobby/HostMigration left out?

    ____________________________________________________________

    <rage>
    Not only have they not been fixed, but some of these were reported over 6 months ago (for example, Unity QA actually confirmed that HostMigration is broken back in June, yet it's still heavily advertised and not fixed yet).

    It's not that they haven't been fixed yet, my issue is that there's been no communication about the HLAPI/Lobby/HostMigration/UNET since it was released. No addressing Q+A. No replies to Unity Answers. No response to tickets (only QA that make guesses). No doc updates (so sparse/conflicting), not 1 HLAPI/lobby demo or video, 0 lobby... well, anything, anywhere, and overall it's like HLAPI/lobby events don't even exist anymore. That current lobby demo is bloated with OnGUI and such old code that it doesn't even look like the current networking schema - and definitely doesn't use HLAPI (which would make sense to use in a "just a basic setup" demo).

    I'm having issues with lobby and disconnection (sometimes callbacks are called, sometimes they aren't).

    While I'm here: In the lobby, preferably using a NetworkLobbyManager class, what is the best way to disconnect as a server? as a client? Client callbacks don't always return when disconnecting (I've been using this.StopHost() which works, but surely isn't the best. I always see the server d/c, but it only provides me with a NetworkConnection but what I really want is the slot # of the disconnection, which I can only get from overriding a NetworkLobbyPlayer class.... which doesn't always fire O__o

    (If I disconnected as a server with StopHost(), it works, but it will still show a server as 1 player for 30 seconds until the match destroys itself and shows up in match list as a real "1 player".... so if I create a match, leave, and search for a game within 30 secs, I can actually join my own created game that's pending being destroyed!)

    </rage>
     
    Last edited: Dec 16, 2016
  23. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    251
    I'd rather have fixes instead of communication. No communication regarding HLAPI probably means they don't have anything to say or in progress.
     
  24. dylanh7244

    dylanh7244

    Joined:
    Jan 12, 2016
    Posts:
    352
    Artaani likes this.
  25. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    1,523
    I can understand that they don't care about your scene change bugs too much, UNET isn't really meant to work with multiple scenes right now.

    Closing your command hash bug as "By Design" is very concerning though. Reminds me of: "If a bug can be reproduced, it can be fixed."
     
    Last edited: Dec 16, 2016
  26. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    So you scare me a little bit when you say UNET doesn't support multiple scenes. Have they explicitly stated this? Because not supporting multiple scenes means they don't support DontDestroyOnLoad persistent networked objects... which means they don't support a persistent networked player character that travels from scene to scene. I just can't believe that isn't intended to be supported because many games will do this.
     
    ThaiCat likes this.
  27. vis2k

    vis2k

    Joined:
    Sep 4, 2015
    Posts:
    1,523
    Sorry, what I meant was: if you run a dedicated MMO server, it only holds one scene at the time. You can't have two scenes running in parallel (e.g. main world + dungeon).
     
    Last edited: Dec 16, 2016
    ThaiCat likes this.
  28. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    251
    Since nested prefabs are not supported, i made my game levels with Scenes as it seems that this is the direction Unity is going with the SceneManager and so on. Well, then i noticed that additive Scene loading is not supported with UNet out of the box, but i was able to make my own system that worked with additive scenes. But once again, it was annoying.
     
    kira419 likes this.
  29. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    62
    iddqd can you expand a little bit on how "additive Scene loading is not supported with UNet out of the box"?

    I plan to have 3 sceens in my game:

    Scene 1) home: the "root" scene that is always present and has some singleton manager classes for general functionality like loading sprite-sheets, etc.

    Scene 2) lobby: loaded additivly with "lobby" set as the offline scene and "battle" set as the online scene

    Scene 3) battle: loaded additivly (will/should unload lobby if it exists?), this scene can be loaded directly from home if in 1-player mode.

    Can you tell me if this type of setup will have problems in unet?

    Thanks!

    Arun
     
  30. Driiades

    Driiades

    Joined:
    Oct 27, 2015
    Posts:
    53
    I think it's for "Networked GameObject in the scene" that doesn't work. Because i have no problem without this ....
     
  31. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    251
    Well i don't quite remember the details anymore, but i think the server has a method to load scene and automatically load this scene on the clients. Seems like this: https://docs.unity3d.com/ScriptReference/Networking.NetworkManager.ServerChangeScene.html

    However this does not load the scene additive. So of course the idea will be then to tell the clients: Load Scene X by your self, but then all components with NetworkIdentities are not connected together ;-)

    So what i do is
    - Each Client loads Scene X additive, client destroys each GameObject with a NetworkIdentity, but keeps all static components
    - Host loads Scene X additive, creates a clone of each NetworkIdentity Gameobject in the MainScene and destroys the original NetworkIdentity Gameobject in Scene X

    maybe there are better ways, but you know, when you have to figure everything out by yourself because most doesn't work properly...


    this is pretty much what i have:

    Code (CSharp):
    1.  
    2.  
    3.   public override void OnStartClient()
    4.   {
    5.   base.OnStartClient();
    6.  
    7.   SceneManager.sceneLoaded -= SceneLoaded;
    8.   SceneManager.sceneLoaded += SceneLoaded;
    9.   }
    10.  
    11. // this is where the clients (and host, which is also a client) load the new scene
    12. [ClientRpc]
    13.   public void RpcLoadLevelNr(int lvl)
    14.   {
    15.   UnloadCurrentScene();
    16.   SceneManager.LoadScene("Level" + lvl, LoadSceneMode.Additive);
    17.   }
    18.  
    19. public void SceneLoaded(Scene scene, LoadSceneMode mode)
    20.   {
    21.   StartCoroutine(ClientHasLoadedLevel());
    22. currentLevel = scene;
    23.   if (isServer)
    24.   {
    25.   StartCoroutine(SpawnSceneObjects());
    26.   }
    27.   }
    28.  
    29. private IEnumerator ClientHasLoadedLevel()
    30.   {
    31.   yield return new WaitForEndOfFrame();
    32.  
    33.  
    34.   if (isServer == false)
    35.   {
    36.   // delete them on the clients, the host will recreate/spawn them
    37. foreach (GameObject go in currentLevel.GetRootGameObjects())
    38.   {
    39.   if (go.GetComponent<NetworkIdentity>() != null)
    40.   Destroy(go);
    41.   }
    42.   }
    43.  
    44.   }
    45.  
    46.  
    47. private IEnumerator SpawnSceneObjects()
    48.     {
    49.         yield return new WaitForEndOfFrame();
    50.  
    51.         foreach (GameObject go in currentLevel.GetRootGameObjects())
    52.         {
    53.             if (go.GetComponent<NetworkIdentity>() != null)
    54.             {
    55.                 GameObject prefab = Resources.Load(go.GetComponent<MultiplayerComponent>().selfPrefabName, typeof(GameObject)) as GameObject;
    56. // apply settings to the new GO if needed
    57.                 GameObject prefabClone = Instantiate(prefab, go.transform.position, go.transform.rotation) as GameObject;
    58.  
    59. // this spawns the clone in the Main Scene on all clients
    60.                 NetworkServer.Spawn(prefabClone);
    61. // destroy the original
    62.                 Destroy(go);
    63.             }
    64.         }
    65.     }
     
    kru and isidro02139 like this.
  32. jopi404

    jopi404

    Joined:
    Nov 29, 2012
    Posts:
    27
    When updating a prefab, this creates problems with different errors that are very hard to understand. For example if I add a gameobject to a prefab or even if I just scale one of the children :(
    I always have to remove and reattach the NetworkIdentity component (and all components that depend on it!!!) to make it work again.
    So, Unity, please update the NetworkIdentity component automatically the prefab it is attached to is changed/updated.
     
    Zullar likes this.
  33. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    I've heard sever people say they had to remove and re-add NetworkIdentity + other components to fix issues. It's never happend to me, but I've seen a few other people have the same issue as you.
     
    ThaiCat likes this.
  34. Railon23

    Railon23

    Joined:
    Jan 30, 2014
    Posts:
    12
    How can I join that slack channel? I'm new to slack. I get this message:
    "If you have an @cmune.com or @unity3d.com email address, you can create an account."
    Is that channel not public?
    Thanks
     
  35. MaZy

    MaZy

    Joined:
    Jun 29, 2012
    Posts:
    60
    What are the BAD things about the new Multiplayer system you dislike?
    I want to be serious to this question. You will be clear why just with one question related to unet and unity.

    -Of course only the server because of the authority-owner.

    This so stupid in my opionion. I made with old networking of unity many different multiplayer games. I had never these problems there.

    Just old thing
    So now I could check if player can do this on the server.. (ofc he can) so send to all players open the door event.
    Now this is very S***ty. UNet itself says already NOPE YOU can't do this. Why I cannot decide myself who can do what? I feel me like I am limited on this UNet. Simples things are now so difficult.

    I know there is an alternate to do this. Just make many many commands on the player object like CmdRequestDoorOpen(GameObject whichDoor) but I would need to do this on every thing on the map. This seems not the right way.

    How can we make it BETTER?

    Do an implementation to allow to use commands from every remote clients or cleintserver..
     
    Last edited: Mar 4, 2017
    dylanh7244 likes this.
  36. Deni35

    Deni35

    Joined:
    Jul 10, 2012
    Posts:
    39
    BAD:
    Bad architecture.
    • If you have LLAPI and HLAPI then put it in different namespaces. Not using namespaces is a bad practice.
    • Classes which contain server and client code is too complicated.
    • NetworkManager is a special case. This is a very complex, large, inflexible and silly class.
    • NetworkTransport.GetAssetId is probably not LLAPI. Anyway this does not apply to Transport.
    • And problems with OOP.

    Misc.
    • No information about NetworkTransport.Shutdown.
    • NetworkTransport.IsStarted is deprecated. But there is no another way to check if NetworkTransport is initialized or not.
    • NetworkTransport hasn't function to get host list. Before calling NetworkTransport.Shutdown I need to check is there running hosts.
    • UNET is done poorly. The development is very slow.
     
    dylanh7244 and ThaiCat like this.
  37. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    289
    The biggest problem is the same as always: We don't know what's going on

    Unity, hire an official UNET community manager if you have to. But find a way to keep us updated on UNET, because it is clearly not out of beta yet, and everyone's wondering if it'll be done one day.
     
  38. isidro02139

    isidro02139

    Joined:
    Jul 31, 2012
    Posts:
    62
    I think the HLAPI architecture strikes a good balance between the Unity component model, ease of use, and a fundamentally secure (server-authoritative) architecture.

    That being said, I strongly agree with:
    • Need more information about NetworkTransport.Shutdown
    • NetworkManager should be redone (or explained in detail in an official blog post)
    • Community manager, 100% agree!!
    Keep up the great work Unity, everyone please realize that important stuff is being done behind the scenes but of course we need to hear about problems with UNET too, just try not to be abusive of the staff or it will turn them off!
     
  39. francois85

    francois85

    Joined:
    Aug 11, 2015
    Posts:
    106
    The biggest wall I keep running into is physics over networking. Unet really doesn't provide any helper method making it really difficult to implement. Also dicumentation is still a bit thin
     
  40. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    289
    Is there a problem with NetworkTransform in Rigidbody mode? (I haven't really tried it enough to know)
     
  41. Driiades

    Driiades

    Joined:
    Oct 27, 2015
    Posts:
    53
    NetworkTransform doesn't work.
    It's very very very naive approache.
    I recommend to not use that.
     
  42. TheDogtoy

    TheDogtoy

    Joined:
    Jan 5, 2017
    Posts:
    10
    As someone who has used Bolt and is looking for a multiplatform solution its hard to move the team to unet.
    -Users are sighting advertised features as not working. I have no easy way to determine the current state of Unet. Love to see an overview page per feature.
    -Unity devs have stopped responding to many threads discussing upcoming Unet features. E.g. steam integration.
    -The tanks!!! project is a nice tech demo but does not give confidence that Unet can be used in a full sized product.
     
    PhilSA likes this.
  43. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    154
  44. TheDogtoy

    TheDogtoy

    Joined:
    Jan 5, 2017
    Posts:
    10
    I misspoke a bit about Bolt. It is multiplatform very much aimed toward peer to peer. It doesn't do a lot of the heavy lifting if you need a primarily peer to peer solution that also integrates with a dedicated server. I may be able to use bolt + photon (zeus isn't there yet as far as I can tell)
     
  45. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    155
    Zullar likes this.
  46. Iron-Warrior

    Iron-Warrior

    Joined:
    Nov 3, 2009
    Posts:
    633
    You actually can do this. On Windows, using a directory symbolic link from your Assets and Project Settings folders effectively allows you to have two "different" projects open at the same time. I use this setup for network testing, so that I can have the full power of the editor on all hosts/clients.

    That being said, I'd totally love some built in functionality to address this need.
     
    Bluk, TobiasW and Zullar like this.
  47. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    411
    Good suggestion. Having to build to generate a 2nd client takes a lot of time when testing.

    One thing you can try (if you don't have already) is a SSD. It takes ~1min to build instead of ~5min. Huge improvement when you are building multiple times per day.
     
  48. TobiasW

    TobiasW

    Joined:
    Jun 18, 2011
    Posts:
    41
    I wish I could like this post more than once. So far I've been using a batch file to copy things via robocopy, but this will make it even more painless. I can't believe I didn't think of using symbolic links myself! Thanks you so much!
     
  49. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    865
    It needs to be done using the "hard link", and not the "symbolic link" that is referred to as the "soft link" in the article, right?
     
  50. Iron-Warrior

    Iron-Warrior

    Joined:
    Nov 3, 2009
    Posts:
    633
    That's correct, thanks for pointing that out—you'll want the /J directory junction option, not the /D symbolic link.
     
    isidro02139 likes this.