This document is about: FUSION 2
SWITCH TO

Regions

Photon Cloud provides you with global connectivity to allow low latency gaming all around the world. This is done by hosting servers in various regions.

As the available regions may change over the lifetime of a project, clients get the current list of regions from our Photon Name Servers.

Each region is completely separate from the others and consists of a Master Server (for matchmaking) and Game Servers (hosting rooms).

photon cloud regions' connect flows
Connect to Photon Cloud regions

The list of available regions differs per product (Fusion, Quantum, Chat etc.). With the Region Allowlist, you can define which regions should be available per AppId (see below).

Below is the list of regions for this product.

Available Regions

The Photon Cloud consists of servers in several regions, distributed across multiple hosting centers over the world. Some regional servers only support specific products and client SDKs. This means for example that Fusion clients can use the region Japan but Chat can not.

Each Photon Cloud region is identified by a "region token", which is a case insensitive, short string. For example, "EU" or "eu" are both accepted and refer to the same Europe region.

List of available regions and tokens:

RegionHosted inToken
AsiaSingaporeasia
Chinese Mainland (See Instructions)Shanghaicn
EuropeAmsterdameu
Hong KongHong Konghk
JapanTokyojp
South AmericaSao Paulosa
South KoreaSeoulkr
USA, EastWashington D.C.us
USA, WestSan Joséusw

The Industries Circle has these Fusion regions:

RegionHosted inToken
AsiaSingaporeasia
EuropeAmsterdameu
IndiaChennaiin
JapanTokyojp
South KoreaSeoulkr
United Arab EmiratesDubaiuae
USA, EastWashington D.C.us

Region Allowlist

There are several reasons why you should consider limiting the regions available to your players and users (see below). The Region Allowlist enables you to customize the available regions per application directly from the dashboard - without client side changes.

Open the dashboard, click "Manage" for a chosen application and then click "Edit Allowlist". You will find an input field where you can enter the list of allowed regions as follows:

  • the available regions are defined above per SDK and sometimes separately for the Industries Circle.
  • the allowlist must be a string of region tokens separated by semicolons. e.g. "eu;us".
  • region tokens are case insensitive.
  • undefined or unrecognized region tokens will be ignored from the list.
  • empty ("") or malformed string (e.g. ";;;") means all available regions are allowed.

Within 10 minutes of a change (confirm and save), the Name Servers will send the filtered list to connecting clients. To avoid conflicts on the client side, connect to the "Best Region" by ping or make sure to pick a region received with the regions list.

How To Choose A Region

Users in the US have the lowest latency if connected to the Photon Cloud US region. Easy.

But what if you have users from all over the world?

You can

  • a) let the game client ping the different Photon Cloud regions and pre-select the one with the best ping, read our how-to
  • b) distribute client builds tied to a region, so users from different regions connect to different Photon Cloud regions or
  • c) let the user choose a matching region from within your game`s UI.

Alternatively, you can d) let all users connect to the same region if the higher latency is acceptable for your gameplay, e.g. with any "not-so-realtime" games.

All Photon Cloud apps are working in all available regions without any extra charge. See pricing.

Photon Cloud's dashboard lets you monitor the usage of your game in each region and easily upgrade or downgrade your subscription plan. Go to your dashboard.

Best Region Considerations

"Best Region" option is not deterministic. Sometimes it may be "random" due to little variations or exact same ping calculations.

Theoretically, you could:

  • have the same exact ping to multiple regions from the same device. So it is random, if you end up with different regions on clients connected to the same network.
  • different ping values for the same region on different devices (or different retries on the same device) connected to the same network.

For instance, in the case of "us" and "usw" (or "ru" and "rue"), you could either make use of the online regions allowlist to select the ones you want and drop the others or connect to an explicit region.

To debug, set the logging level to "Info" and clear the "current best region" (in PUN: PhotonNetwork.BestRegionSummaryInPreferences = null). Have a look at the details or send us the log via mail.

How To Select A Region At Runtime

By default, if no Region is set either on the PhotonAppSettings or via code, Fusion will try to connect to the Best Region. Meaning that at the start-up process, it will ping all available Regions and connect to the one with the lowest ping. Keep in mind that Best Region is not deterministic and sometimes it may be "random" due to little variations or exact same ping calculations.

If the Best Region feature is not desired, it is possible to let the player choose which Region to connect to at runtime. This can help to lower the ping between players if they are connecting to a common Region or just want to join a Session with friends that are playing on a specific Region.

The Region selection can only be done when the NetworkRunner is not running, as this can't be changed while it is already connected to a particular Region. In the following snippet, it is shown how a NetworkRunner can use a custom Region in runtime:

C#

public class FusionInit : MonoBehaviour {

    // ...

    // Start a NetworkRunner with a Game Mode and connect to the specified Region
    public Task<StartGameResult> StartSimulation(NetworkRunner runner, GameMode gameMode, string region) {

        var appSettings = BuildCustomAppSetting(region);

        return runner.StartGame(new StartGameArgs() {
            // ...
            GameMode = gameMode,
            CustomPhotonAppSettings = appSettings
        });
    }

    private AppSettings BuildCustomAppSetting(string region, string customAppID = null, string appVersion = "1.0.0") {

        var appSettings = PhotonAppSettings.Instance.AppSettings.GetCopy();

        appSettings.UseNameServer = true;
        appSettings.AppVersion = appVersion;

        if (string.IsNullOrEmpty(customAppID) == false) {
            appSettings.AppIdFusion = customAppID;
        }

        if (string.IsNullOrEmpty(region) == false) {
            appSettings.FixedRegion = region.ToLower();
        }

        // If the Region is set to China (CN),
        // the Name Server will be automatically changed to the right one 
        // appSettings.Server = "ns.photonengine.cn";

        return appSettings;
    }
}

Using The Chinese Mainland Region

You need to request access to the Chinese Mainland region for your Photon application. Send us an email so we could unlock it for your AppID.
You cannot subscribe to paid plans to be used in the Chinese Mainland region via our website. Reach out to us by email to receive a quote for any subscription.

The Photon Name Server has to be local to China, as the firewall might block the traffic otherwise. The Chinese Photon Name Server is "ns.photonengine.cn".

Connecting with clients from outside of China mainland will most likely not produce good results. Also, connecting from the Photon servers to servers outside of China mainland (e.g. for Custom Authentication, WebHooks, WebRPCs) might not be reliable.

Important: in the current phase, changes you make to your app via your dashboard are not automatically reflected in the app caches for China. Let us know by email if you have an update request there.

Also, for legal reasons, you need a separate build for China and we recommend using a separate AppId with it. For example, use a compile condition (of your choice) to change the AppId and the Photon Name Server depending on the build.

Follow the instructions corresponding to your client SDK to make a special build for the Chinese market.

Fusion

Using PhotonAppSettings

fusion: photonappsettings for china
Fusion: PhotonAppSettings for China

Using Code

C#

public class FusionInit : MonoBehaviour {

    // ...

    async void ConnectToChina()
    {
        var runner = BuildNetworkRunnerInstance();

        // Start new Runner with the Host Migration Token
        var result = await StartSimulation(
            runner,
            GameMode.AutoHostOrClient, // Or any other GameMode
            "cn" // Select China Region
        );

        // Check results as usual
        if (result.Ok == false) {
            Debug.LogWarning(result.ShutdownReason);
        } else {
            Debug.Log("Done");
        }
    }
}
Back to top