Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Implementing scene change for a client without pulling in other clients

Discussion in 'Netcode for GameObjects' started by marzdh, Sep 5, 2023.

  1. marzdh

    marzdh

    Joined:
    Jun 3, 2013
    Posts:
    31
    Hi,

    I've developing a VR multiplayer using Netcode following the architecture of a listen server where there is always a host/server and multiple clients.

    Incase of a listen server, I noticed that the clients are dependent on the host for any scene change. So if a host goes from SCENE1 to SCENE2, all the clients get pulled into SCENE2.

    But what I want is, for a client to go SCENE2 without the host.
    What is the best approach for doing the above? Are there any reading material/samples explaining it?

    Another question I have is, in case of a dedicated server (UGS), is the client requirement for changing scenes still dependent on the server? Can a client move to different scenes without automatically pulling the other clients present?

    For example - if a there are 10 clients, and they need to split into 2 groups of 5 and load SCENE2, but only for their group. Is it possible?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,019
    Last time I used NGO (v1.1 I think) it didn't have the feature where clients could be in a different scene than the server or host. There is no distinction between server and a host, who is merely a "serving client" (technically it's a server that happens to have a client already playing on it without network latency).

    You can however have them all in the same scene still - a scene is just a container for game objects. There is often no need to actually change the scene to, for instance, bring up a fullscreen menu of any kind. The same goes for what players see - you could just teleport one player to Room B which is just somewhere outside the viewing range of Room A - or you could design rooms so that they're enclosed spaces to begin with.

    If you run into performance issues, you can either implement culling or manually disable the MeshRenderers (and other renderers) for the object hierarchy that shouldn't be visible. Disabling networked objects themselves used to be disallowed in NGO so just disabling the renderers will at least reduce the work the GPU has to perform.
     
  3. marzdh

    marzdh

    Joined:
    Jun 3, 2013
    Posts:
    31
    I'm not sure if creating multiple rooms in the same scene would be a best practice because there could be a possibility of needing 10 or more rooms at the same time occupied by different clients.

    Also I plan to use a voice chat. Can voices be heard across rooms set at a distance? I have yet to test the voice feature so I'm not sure.
     
  4. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    603
    You could set up your own custom scene management for this but due to the complexity I wouldn't recommend it. A better option would be to launch a new server instance when a group of players join a room, that's if joining a room is equivalent to joining a new game and players aren't switching rooms.