Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Disconnect / Timeout on Network Spawn

Discussion in 'Netcode for GameObjects' started by Snotax, Aug 26, 2023.

  1. Snotax

    Snotax

    Joined:
    Jan 28, 2019
    Posts:
    14
    Hi everyone, we are using NGO 1.5 with Unity 2022.2.12.

    Whenever we spawn more than ~15 gameobject over the network, the host seems to stop sending packages.
    We don't receive any error message inside the console or the log.

    The GameObject to be spawned is really small: Network Transform, Network Rigidbody, Rigidbody and 1 NetworkBehaviour with only 1 NetworkVariable.
    If we add a delay of ~0.5 seconds between each spawn then it works fine, but this looks just terrible.

    We don't know what exactly happens and we we suddendly loose communication with the clients.

    We've also set the max payload size of the NetworkManager to: 61440. That should easily be enough.

    Screenshots:
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,117
    Hmmm ... candy. :)

    What are these? Do they need to be networked?

    Let's see .. if they are elements in a match 3 game, you'd synchronize the board's state and spawn each candy locally. They don't need to be networked.

    If they are drops from killing an enemy, you'd send an RPC that this enemy got killed and each client spawns the candy locally. The spawn position, velocity, and any other parameters are deterministic, so that for each client the candy lands at the same position. You don't need to network these.

    Maybe those are projectiles, from a candy shotgun perhaps? In that case, you'd send an RPC that the weapon got fired, and again each client locally spawns those candy, again with deterministic parameters so they take on the same trajectory for all clients. You don't need to network these either.

    If it's none of the above, chances are they still don't have to be networked. ;)

    Anyway, I'm kinda thinking maybe you don't just spawn 15 but 1500 or more? Could that be the case?
     
  3. tomwolf1210

    tomwolf1210

    Joined:
    Jul 21, 2020
    Posts:
    3
    Hi, I work with Snotax. :)
    The candies are objects laying on the ground, which can be picked up by the players. They are spawned when we start the match or whenever a player drops them. They roll around using unity physics so I don't know if that is determistic enough to allow not networking them. But that's a good idea and something I didn't think of before and maybe could be done by calculating the roll ourselves. Thanks!

    However we still really need to understand what's going on here since we have a similiar problem when spawning too many Player-Characters at the same time. We think perhaps the same thing is happening there.
    It also seems very weird to me that spawning just 15 rather small Objects would be too much.

    I also double-checked, we are not spawning 1500 or any other amount, just 15.
     

    Attached Files: