Search Unity

Question Where to start with simple Server-client command sending

Discussion in 'Multiplayer' started by pat_trick, Apr 28, 2022.

  1. pat_trick

    pat_trick

    Joined:
    May 23, 2016
    Posts:
    27
    Hello, we currently have a project where there is a user in a simulation in a VR headset, and the teacher who is sitting at the computer the VR headset is running from is able to manipulate environment variables (visibility of some game objects, the properties of some game objects, the active scene, etc.).

    What we'd like to do is set it up so that multiple users with VR headsets can connect to a server. This server would be able to list the connected users, and allow the teacher to manipulate the state of the current scene for all connected users.

    We do not need everyone to be able to see each other, literally just a "Connect/Receive/Update" type of workflow for the Clients. Essentially we'd just like to be able to:

    1. Launch Server
    2. Client(s) connect to Server, Server keeps list of connected Client(s)
    3. Server sends commands to Client(s)
    4. Client(s) actively listen for and receive updates and act on them.
    5. Client(s) disconnect from server
    6. Server updates list showing Client is no longer connected

    Looking through the various Networking options available in Unity and the complexity that they have, it seems like most of them are overkill for the simplistic functionality we want. I could do something like a webserver that sets a static file which the clients just pull using UnityWebRequest to get the current configuration as a JSON object...but that would require setting up a web server to run on the client's computer that could receive http requests to pull the client configuration on a regular basis.

    Is there a more simplistic way to achieve what we're trying to do, or should I be looking at a particular Unity library to achieve this process? I've started poking at uNet but that looks like it's going away. Netcode for Game Objects seems like it's too much, since we don't need multiplayer, and it's also not ready for "full release" from what I'm reading. Transport seems like it's lower level but would do the job? Then I could just build a "server" Unity build to handle incoming connections, and the "client" Unity build to connect to it and operate. I've been reading through the documentation for the above, I just don't want to dive into a particular solution until I understand its intended purpose better. There are also a wide variety of free and paid Unity assets available that I can't even begin to wade through.

    I do have a lot of network programming knowledge, just less knowledge on the Unity ecosystem and its available options.

    Thank you for any assistance!