Unity’s brand new multiplayer solution Netcode for GameObjects (NGO) is out now along with a number of powerful plugins and numerous sample projects to help you get started. NGO is intended for smaller multiplayer games without large numbers of players or network synced objects, but is a powerful multiplayer tool with support for Dedicated Servers and Matchmaking built in. For more complex multiplayer games with high numbers of networked objects, Unity is currently building a separate tool called Netcode for Entities which will be released later.
Unity NGO Installation and Setup
With NGO it’s easy to start making multiplayer games. Just download two packages from the Package Manager - “Netcode for GameObjects” and “Multiplayer Tools”.
Then create a new
GameObject in your scene, attach a
NetworkManager component and set it’s Transport to UnityTransport. Drag a prefab into the PlayerPrefab variable, and then simply initiate your multiplayer session via the Start/Stop button on the NetworkManager component and run your game.
From here we can begin creating objects to sync across the network, which is as easy as the initial setup was. Create a new
GameObject and attach any of the needed networked compontents such as the
NetworkTransform, create a prefab of that object and then simply drag them into the NetworkedPrefabs list so that the NetworkManager knows this is one of the objects to syncronize. All networked objects including the Player must be included in this list.
Benefits and Features of Unity Netcode for GameObjects
With this extremely simple setup, NGO may now be the easiest multiplayer system to implement into your game. Even compared to other Unity multiplayer plugins like Proton, Mirror and Normcore, which are themselves very intuitive, NGO is even easier. And after configuring your player and any networked GameObjects your game requires, with only a little bit more work you can enable the built-in support for Lobbies, Dedicated Servers and Matchmaking, or implement some of Unity’s accompanying plugins to add leaderboards, voice and text chat, cross-platform login, cloud saving and friendlists, analytics and debugging diagnostics.
So let’s get into a little bit more detail about the benefits and drawbacks of NGO. As mentioned, the main benefit is streamlined setup and ease of use. The NGO library contains a number of handy components which you can use to syncronize a GameObjects Transform, Rigidbody, and Animations with the server. For example, simply attach a NetworkedTransform script to your GameObject, select the axes which should be synced and everything is handled for you. This includes built-in position update smoothing to mask when network tickrates are lower than game framerate, which is normally something you must to manually with other Unity multiplayer solutions. This is another level of simplicity not found in other Unity multiplayer libraries. It also has support for Addressable Workloads, which allows users to stream assets as well as downloading them from remote CDN servers and can help reduce download size and runtime memory usage. NGO supports all platforms which Unity can build to except WebGL, and has a modular transport interface so that any third party transports, such as SteamWorks, can be integrated.
Unity Multiplayer Limitations
But there are a number of drawbacks to the NGO library. The main limitation is the feasible number of networked objects. It’s essential to keep your total number of players and networked objects relatively low or stability problems may crop up. NGO is intended for small multiplayer and co-op games, with player counts around 10-12 at most. Similarly, NGO does have built in support for Rigidbody physics synced across the network, but you cannot use high numbers of physics objects without running into issues.
This library is still new and although it’s fully ready to be used right now, there are many additions coming in the future. Unity is working on new features to allow things like fast-paced precision multiplayer such as competitive shooters, an Interest Management System which will only send relevant data to each player to allow for large scale maps and game simulations, and a client-side prediction and reconciliation system which will allow clients to apply player inputs immediately in attempt to predict what changes will happen in the near future. There is also a proposal to build a Networked Nav Mesh component which could support online dynamic terrain editing, and this is all just the beginning.
Unity has shown they are willing to spend a lot of effort building and improving this comprehensive package and have been responding quickly to complaints and suggestions for additional features. Many of the major changes made since NGO’s release have come from community feedback, and Unity has been great at communicating their roadmap thus far. You can download the package for free right now in any Unity editor version 2020.3 or later and try it out yourself. I think you will find that it is very simple to get started, and there are useful sample projects available.
If you liked this content follow us on Twitter for more!