Search Unity

Question What makes NGO limited to small scale games only?

Discussion in 'Netcode for GameObjects' started by CodeMonkeyYT, Sep 21, 2022.

  1. CodeMonkeyYT

    CodeMonkeyYT

    Joined:
    Dec 22, 2014
    Posts:
    125
    Hey everyone!
    What exactly is the limitation that makes NGO only suitable for small scale games?
    Is it in the NGO layer? Or in the Transport layer?
    Does that mean limited number of Players (1-4) or limited number of total networked objects?
    What happens if I were to connect 100 players? Would it support just 2 Players but 100 networked Enemies?
    Thanks!
     
  2. itisMarcii_

    itisMarcii_

    Joined:
    Apr 5, 2022
    Posts:
    111
    Currently NGO Unity Transport has a StackOverflowBug at the MaxPacketQueueSize configuration. BUGREPORT
    This makes the system unable to support large amount of messages at the same tick. With large amount of clients a even larger amount of messages will be needed to be send from server towards client and each client needs to receive more packages due the number of clients to synchronise.
    The biggest problem is actually the client spawn, since the server tries to send the current world state towards the client. This worldstate is ALL the current information, so NetworkObjects, NetworkVariables, Transforms, NetworkLists ...
    If the server cant send that in a single tick the client synchronisation is unreliable and the server will cut the connection towards that client.

    We tested that and the largest amount of clients (which do nothing instead of receiving a new color from the server) was ~214 Clients on a single server. All clients that tried to connect afterwards just couldnt connect. If the NGO system cant send a reliable message in time, the client will be disconnected since the server cant sync that client properly anymore.

    But like I mentioned, those Clients did nothing. If you increase the to send messages, the client number will shrink aswell.
    We had another project in which we let the clients walk,jump,rotate and shot on each Tick. A number of around 40 Clients was stable in the short run. But keep in mind that this was also the worst case scenario.

    I hope that information could help you! :)
     
  3. CodeMonkeyYT

    CodeMonkeyYT

    Joined:
    Dec 22, 2014
    Posts:
    125
    Oh interesting, so it's a question of too much data in a single packet.
    If that's the only limitation then it sounds like it would be possible to still support larger scale games by just being clever and limiting how much data is synchronized as soon as a player joins and instead sending the full game state over several packets through RPCs.
     
    HernandoNJ likes this.
  4. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    Another thing that may limit the scale of games made with NGO is that some features expected for large-scale games are not implemented (yet). For example, there's no AOI (area of interest) system, so everything in a scene is always synchronized, which can be taxing on bandwidth if there's a large number of networked objects.

    Also, the current design of NGO makes heavy use of reliable and ordered delivery in the transport, which also has bandwidth constraints (we need to track if packets we send have been received, and there's a limit to the number of such packets that we can track at any given time).
     
  5. HernandoNJ

    HernandoNJ

    Joined:
    May 13, 2018
    Posts:
    75
    Hello @itisMarcii_ and @simon-lemay-unity. Thanks for the info.
    Just to know if I have it clear.
    If in a game, I want to synchronize only the path of a ball or a bullet (Transform), currently, the data that will be sent includes the whole gameobjects in the scene in every tick (game status update)?
     
    Last edited: Sep 24, 2022
  6. itisMarcii_

    itisMarcii_

    Joined:
    Apr 5, 2022
    Posts:
    111
    Thats not the case. Only on spawn the client will synchronise every needed information like positions. Afterwards, without NetworkTransform, the client will not synch any position if you dont tell him to.

    So if you move, on server, an object from point A to B. The client, without NetworkTransform, will not synch that object from A to B. You need the server to send the client a message to do so.

    The NetworkTransform does that for you. It synchs the Transforms which you told him to. Its also server authoritan, which means that changing the position on client will not synch the position on server. Only from server to client the synchronisation will occure.
     
    HernandoNJ likes this.
  7. Tech_Bud

    Tech_Bud

    Joined:
    Jun 24, 2020
    Posts:
    18
    Is this a problem with the Unity transport or NGO in general? Could I overcome this bug by using a different transport layer like steam networking?
     
  8. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    That specific stack overflow bug is in Unity Transport. So yes choosing a different transport would avoid it.
     
    Tech_Bud likes this.
  9. lucasthier2015

    lucasthier2015

    Joined:
    Sep 1, 2022
    Posts:
    11
    Hi, do you think that it would be better for someone to try fix this on its own(the initial overflow and adding an AOI) or it would be better to just wait until Unity implements the AOI and fix the Overflow?
    What I mean with this is what would take longer, is it better to wait Unity to do it or do it myself?
     
  10. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    The stack overflow bug should be fixed in version 1.3.0 of
    com.unity.transport
    , which was just released.

    Regarding an AOI system, I'm not sure what the timeline is regarding us providing one. The best I can tell you is that it's on the roadmap. But before you start writing your own, my advice would be to test the current Netcode solution with something representative of the game you wish to build (in terms of world size, number of networked objects, number of players, update frequency, etc.). You may find out that you don't need an AOI system at all, or that other bandwidth optimization techniques are sufficient for your purposes.
     
    CreativeChris and lucasthier2015 like this.