How to use NGO with WebGL ?

Hi ! I’m trying to deploy a multiplayer karting game on a React web app with WebGL, and I find the official documentation quite poor on the subject. I’m using Netcode for game objects, and from my understanding NGO’s basic unity transport don’t work on browsers. Is that correct ? If so, what can I do to keep using NGO ? I saw that there are community transport libraries (GitHub - Unity-Technologies/multiplayer-community-contributions: Community contributions to Unity Multiplayer Networking products and services.). The websocket transport should work on a browser, right ? If so, is downloading the websocket transport package and changing my network manager’s transport protocol to “websocket” all I need to do ? I’ll be very grateful for any help/insight, thank you !

The default transport (Unity Transport) supports WebGL, but only starting with its 2.0 version. This is only available starting with Unity 2022.2. If you’re on that version (or later), then you simply need to install the 2.0 version of the com.unity.transport package (latest version as of writing this is 2.0.2) and check the “Use WebSockets” checkbox that will have appeared under the Unity Transport component in the editor. If using Unity Relay, you also need to use “wss” as the connection type when creating the Relay server data (instead of “udp” or “dtls”).

4 Likes

This is wildly critical information - can this be front and center of all demo READMEs relating to NGO, @simon-lemay-unity ?

PS: I also noticed you folks have demos that exclude consideration for headless servers, such as boss battle, causing breaking bugs. There’s also no native “Start on headless server” like all your competitors have (FishNet, Mirror, Photon…). Can you add this and backport it into the demos to support headless servers?

@simon-lemay-unity Hmm, I found inconsistencies in your instructions:

The max ver is only 1.3.4 in Unity 2022.3 LTS?

Version 2.0 is not part of the editor’s package manifest yet. You can install it directly however. If you click the small plus icon top-left in the package manager window, then click “Install by name” you can manually enter the version of the package you want to install. Alternatively, you can just edit the manifest.json file to update the version of the package to 2.0.2.

Boss Room is a sample for a client-hosted game. It is not meant to showcase deployment to headless servers. Also, what do you mean by “native start on headless server”? Unity supports a dedicated server build target that will create a build of your application for headless servers. And to start a server-only instance with Netcode for GameObjects, you only need to use StartServer instead of StartHost.

A dedicated server will include -batchmode -nographics, but has nothing to do with starting a NetworkManager server. All your competitors have this feature to start a NetworkManager server automatically when a headless build (#if UNITY_SERVER) is detected, so folks have to build their own -arg handlers and start it manually. Reinventing the wheel defeats the purpose of using NGO instead of, say, FishNet or Mirror that seem years ahead of NGO.

NGO just feels like there’s just no polish, no UX, and no scout of what the competition has already had for the past 6 years (respectfully, but factually, just asking me what is “auto start server on headless” reinforces these words).

Then the fact that the boss battle game (or ANY ngo demo) has no thought about headless servers for a networking solution just really seems unprofessional to me and screams a red flag of releasing an alpha status product too early. The fact that they don’t even have documentation mentioning in a single sentence that headless builds aren’t supported (which feels laughable for a networking solution - an official one, at that) is another red flag; how is this not even a thought?

You know what else had these red flags? UNET. I think Fishnet is the way to go.

I have done this, but its still showing the same error.