Multiplay
Overview
Multiplay is the Unity Hosting Service solution, built with Dedicated Server Orchestration in mind, that also provides a lot more features, like server health tracking and zero downtime updates.
More information can be found on the official Multiplay website here.
This page describes the necessary setup on the Photon Fusion SDK in order to deploy and run a Dedicated Server using Multiplay.
External Links
- Multiplay - Get started: [https://docs.unity.com/game-server-hosting/guides/get-started.html]
- Multiplay - Integration Requirements: [https://docs.unity.com/game-server-hosting/concepts/integration-requirements.html]
- Fusion Dedicated Server Sample: Sample Link
How to Run
Running Fusion as a Dedicated Server on Multiplay is really straightforward as the only main requirement is that the peer binds to a specific port when started.
The two interesting points network-wise for Fusion are the Dynamic IP address
and Dynamic port number
topics described on the link above.
It is required that any peer running on the Multiplay hosts binds to IP 0.0.0.0
(extra info) and to a port passed either via command-line arguments or a configuration file.
Check the Launch parameters page for more info.
Another important aspect of running a Dedicated Server on a global cloud hosting service, is the geographic location where this server will be in execution. Considering that a Fusion Server must be connected to a Photon Cloud Region, selecting the best Region for your Server is mandatory. Check the Region Reference Mapping below.
Once the port and region values are passed to the executable, Fusion can be started as shown below:
C#
private Task<StartGameResult> StartSimulation(
NetworkRunner runner,
string SessionName,
ushort port,
string customRegion,
) {
// Build Custom Photon Config
var photonSettings = PhotonAppSettings.Instance.AppSettings.GetCopy();
if (string.IsNullOrEmpty(customRegion) == false) {
photonSettings.FixedRegion = customRegion.ToLower();
}
// Start Runner
return runner.StartGame(new StartGameArgs() {
SessionName = SessionName, // Custom Session Name
GameMode = GameMode.Server, // Game mode always set to Server
Address = NetAddress.Any(port), // EndPoint to bind: 0.0.0.0:port
CustomPhotonAppSettings = photonSettings, // Custom Photon App Settings
// other arguments
});
}
One important note about Fusion in this scenario is that Fusion does not support any kind of integration with Multiplay out of the box, meaning that in order to get meta-information about the Dedicated Server, it is necessary a communication layer between the Server and the Multiplay Service, which can expose data like the current number of connected players or a description of the current Game Mode being served by the Server.
All necessary information can be found at the Game Server Hosting (Multiplay) SDK for Unity documentation page here, on how to integrate the server implementation with the Multiplay services.
Extra Information
Region Reference Mapping
Multiplay Region | Photon Region |
---|---|
US West | US |
US East | US |
US Central | US |
Europe | EU |
Russia | EU |
North East Asia (Japan/Korea) | JP |
South East Asia (Singapore) | ASIA |
Australia / Oceania | ASIA |
India | ASIA |
South America | SA |
China | CN |