Exclusive: The Unity Team on Porting & Developing Multiplayer Games

Thom Hopper, Mathieu Muller, Kjetil Kalla, and Laurent Gibert from the Product Management team at Unity explained the nuances and different aspects of porting Unity-powered games and shared best practices and resources.

Unity for Multiplatform

Unity helps creators reach a wider audience with games that scale across platforms, giving players a consistent experience on all their devices. Developers can create a game once and ship it to players across desktop, mobile, console, and VR without compromising their creative vision. They can ensure that their game will be performant anywhere by leveraging Unity’s deep integration with leading platform partners like Sony, Microsoft, Apple, Meta, and Nintendo.

Porting Your First Game

Before starting your development journey for any console platform, the very first step would be to reach out to the platform holder to talk about registering for their developer program. Once you have an agreement in place, your team can get access to whatever development hardware, software, and documentation is available for that platform. 

Console platforms typically have fixed performance parameters and strict requirements around stability and the use of platform features. Having access to the documentation and development hardware and software will ensure that your game runs well and works correctly for the platform you're targeting.

On the subject of performance, once you have access to development hardware, I would suggest testing on the device regularly and often. Test as early as possible, make measurements, and track your performance goals as you proceed. Be sure to test and measure whenever you reach a milestone, add a feature, or make a significant change (at the very least).

When it comes to platform certification requirements, it's good to understand what requirements apply to your game as soon as you can. Don’t leave this work to the last moment as certification requirements can have far-reaching implications for your game. 

It's also a good idea to investigate how your game stores its assets before you begin porting to a closed platform. Some platforms have limitations around how you can provide updates and patches to your game. A well-structured game is easy to patch, and technologies like addressables can really help with this. 

Targeting new platforms can also mean new digital storefronts for the distribution of your game. Getting a good understanding of what each region-specific storefront requires, what customers of that store expect, and going through the process of buying games on that store can help you in meeting the expectations of your customer and giving your game the best chance of being discovered.

Rendering Considerations

Consoles and even most PCs have quite powerful graphics processors, which enable offsetting as much of the rendering as possible to the GPU. For VR, Mobile, and in general portable devices, one needs to be careful with the GPU which might heat and slow down the entire experience (power throttling). To limit this, the processors have been architected to split the work into tiles which allows to save time, energy, and memory bandwidth. Consequently, for these devices, one needs to find the right balance for rendering between CPU and GPU (for example CPU particles vs GPU particles), while limiting the rendering on the GPU to stay on tile (e.g., limit full-screen post process, do as much as possible in the vertex or fragment shaders).

The first thing to do is to profile, and we always recommend profiling on a build and not on the Editor to get a real snapshot of your performance. For example, IL2CPP and the bust compiler might massively optimize some systems that could have appeared as bottlenecks in the Editor. 

We have compiled many resources to learn more on our Profiling landing page.

For this, we provide multiple tools:

  • The Unity Profiler to get a hierarchical detailed view of all the processes
  • The Frame Debugger for a breakdown of each command sent to the GPU to assemble the frame
  • The Rendering Debugger stats to identify bottlenecks while playing using in-game graphics stats overlays 
  • RenderDoc and platform-specific profilers to analyze how the GPU executes the commands and shaders

Whatever your platform target is, often the first bottleneck is on the CPU and comes from the way your game will be sent to the GPU. Cull, merge objects and limit the number of shaders used so that objects can be sent as much as possible together. The most optimized objects are the ones never sent to the GPU. Think about your game camera and find a smart logic to quickly remove big chunks of content not visible.

When sending your world to the GPU, it is important to limit the number of state changes to be able to render a large number of objects at once. On mobile and VR platforms, you should use only a few uber shaders that control lighting, visual style, and even effects like fog or VFX. On higher-end platforms, you can use more shaders, but the same rule applies and you should still limit the number of shaders to the specific lighting models you want to push forward (e.g., hard surface, vehicles, vegetation, characters).

While using a few shaders, you can still use different materials to ease production workflows, leveraging Material Variants. If you use the Scriptable Render Pipelines (e.g., URP, HDRP), the SRP Batcher automatically packs the commands together even if you are using different material settings with the same shader. The GPU Resident Drawer in Unity 6 leverages BatchRendererGroup to automatically boost the processing of GameObjects renderers.

Depending on your renderer and the way it is configured in the graphics settings, your geometry will go through different passes. Well understanding the renderers and their settings as well as their benefits and cost is important to balance visual fidelity and performance. Multiple resources are available for you to master these in our e-books and blogs. You can start with our sample scenes (e.g., new URP 3D sample scenes) on the Unity Hub, already pre-configured with quality settings curated for various hardware tiers.

The next step is to optimize your lighting, finding the right balance between baked lighting, light probes, and real-time lights, and limiting the number of shadows rendered at each frame. For the most constrained performance conditions, consider fully baking lighting and use blob shadows as often done in many VR games. The more powerful the platform is the more you can rely almost solely on the new Adaptive Probe Volumes and have more dynamic lighting, leveraging the tiled-based renderers from URP (Forward+) and HDRP.

When porting a mobile game to PC, you can replace some of the simple or custom shaders with more off-the-shelf ones offering advanced rendering capabilities. You can also add more screen space and post effects. Lego Builder’s Journey is a great example of how a nice stylized mobile game can be magnified on PC and Consoles by leveraging physically based shaders and effects.

One key factor when pushing fragments or effects quality is the cost per pixel. To still afford nice but expensive pixels on high resolutions, you can use upscalers to only render at a smaller screen percentage and then upscale to the output resolution. There have been huge advancements in this area in the past few years, and Unity offers multiple solutions, some pipeline and platform-specific like NVIDIA DLSS, some cross-platform, like AMD FidelityFX FSR, or our own novel spatial-temporal upscaler introduced in Unity 6 called STP.

Finally, for advanced users, we now offer the ability to dig even deeper into hardware-specific performance optimizations thanks to the new Unity 6 Render Graph and Native Render Passes APIs. They allow the creation of effects and features that stay on tiles for tiled-based GPUs and optimize load and store actions which enables saving bandwidth and by doing so also preserves battery life and does not go into thermal throttling as fast.

Multiplayer Functionality

Unity multiplayer solutions have evolved very rapidly in Unity 2022 LTS, and those are supported across all Unity platforms. We introduced Netcode for GameObject and Relay services to make it easy to build small-scale and cooperative multiplayer games, Netcode for Entities, and Game Server Hosting Multiplay for more demanding competitive titles. There are many other backend services available such as Lobby, Matchmaking, and voice chat Vivox.

To help users get started and make a proof point of large-scale competitive multiplayer titles, we delivered Megacity Multiplayer, a sample play-tested with 64+ players, targeting high-end devices, pre-integrated with all those services and packages. To demonstrate how this can be assembled for cross-play multiplayer, we are about to deliver a major update to it, Megacity Metro, a mobile-friendly sample play-tested with 100+ players, and again coming pre-integrated with all those backend services.

Guidelines & Resources

The general tip for audio processing is you want to ensure the format you’re using is supported by both the editor and the platforms, whilst also striking a balance between compression and quality with performance budgets, you need project-size budgets as well for your builds.

As for platform-specific certification requirements, you need to contact the platform holders, as they keep these up to date on their development portals.

The official Unity website has a list of resources on both multiplayer and multiplatform solutions. An interview with Navegante and Roll7 giving tips on launching on multiple platforms would also be an interesting read for the developers.

A free roundtable Using DevOps to scale multiplatform is also available on demand.

Unity Technologies

Interview conducted by Arti Sergeev

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more