Multiplayer sessions
Note: The Multiplayer Services SDK uses sessions to manage groups of players. Sessions relies internally on different combinations of Unity Gaming Services such as Relay, Distributed Authority, Lobby, Matchmaker and Multiplay Hosting, and thus contributes to the billing of those services.
Implement multiplayer functionality in your games using sessions, a unified system that manages player connections and interactions across multiple Unity Gaming Services.
A session represents a group of connected players and manages their interactions through various connection types, including client-hosted solutions like Relay and Distributed Authority, or dedicated game servers through Multiplay Hosting. Sessions work with either the Netcode for GameObjects or the Netcode for Entities networking libraries. Sessions provide an abstraction layer for managing multiplayer game states, handling everything from initial player connections to ongoing gameplay interactions, and automatically handle complex multiplayer operations such as host election, player joining and leaving, and network connection establishment.
Beginning with Unity 2022 LTS, developers can use session operations to create their multiplayer experiences. Instead of having to manually coordinate between the SDKs for Lobby, Matchmaker, Multiplay Hosting, and Relay, the Multiplayer Services (MPS) SDK merges the functionality previously spread across these individual services' SDKs into a unified API centered around sessions. For example, when creating a session, the MPS SDK automatically handles lobby creation, relay allocation, and manages the Netcode connection. Similarly, while joining a session, the MPS SDK manages lobby joining, and Netcode connection establishment. This combined approach maintains all the capabilities of the underlying Unity Gaming Services (UGS) Multiplayer services while reducing implementation complexity.
Topic | Description |
---|---|
Install and upgrade | Install the Multiplayer Services package, and upgrade any individual services' SDKs to the unified Multiplayer Services SDK. |
Get started | Learn the different methods to add sessions-based multiplayer functionality to your game. |
Sessions tutorials with Unity Netcode | Create simple multiplayer games using Unity Netcode solutions to learn key concepts, such as sessions and how to join them. |
Working with the Multiplayer Services SDK | Learn about different ways to configure a multiplayer game programmatically. |
Migrate to the Multiplayer Services SDK | Learn how to migrate from using individual UGS SDKs to the unified Multiplayer Services SDK. |
Deploying Multiplayer configurations | Learn about the configuration items provided by the Multiplayer Services SDK, and how to use the Deployment window to deploy them directly from the Unity Editor. |
Reference | Learn about any related foundational information. |