This document is about: QUANTUM 3
SWITCH TO

Regions

Photon Cloud provides global connectivity for low-latency gaming. It does this by hosting servers in various regions.

As the available regions change over time, clients get the current list from our Photon Name Servers.

The list of available regions differs per product.

The Region Allowlist defines which regions are available per AppId.

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

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
EuropeAmsterdameu
South AmericaSao Paulosa
South KoreaSeoulkr
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 about users all over the world?

Options are..

  • 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 the game`s UI.
  • d) let all users connect to the same region if the higher latency is acceptable for your gameplay.

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 The Photon Dashboard

C# Realtime API

Photon Realtime (used by most Photon SDKs) can detect the Best Region to connect to and enables you to stick to that region.

To do so, clients always fetch the list of available regions from the Name Server on connect.
The servers response is used to setup the LoadBalancingClient.RegionHandler which is also provided via the callback OnRegionListReceived(RegionHandler regionHandler), as defined in the IConnectionCallbacks.

Typically, the next step is to call regionHandler.PingMinimumOfRegions() to detect the current ping to each region. You need to pass a method to call on completion and in best case you can also pass the "best region summary" from a previous run (explained below).

After pinging the servers, the (new) results are summarized in the regionHandler.SummaryToCache which should be saved on the device for later use.

Without the SummaryToCache from a previous session, all regions will be pinged, which takes a moment longer.
If a previous result is available, the client will check:

a. if the region list changed (covers the case if the "previous best region" is still available)
b. if the ping is no longer acceptable (>= 1.5x slower than previously saved reference value)

If either applies, all regions are pinged and a new result gets picked.

Using Best Region works well with the server-side Region Filter in the Dashboard.
It enables you to change the list of regions available to players on demand.

To access the list of regions or to override previous results, refer to the API Reference for regions.

Connect to a specific Master Server

Direct connections to a master server using the generic region master server address are deprecated. Instead, the method to connect to a region master is provided by the used Photon client SDK.

To connect your clients to a specific region, set the AppSettings.FixedRegion to a valid Region token and call ConnectUsingSettings(settings).

For other platforms follow the link to the respective SDK and API from the SDKs list.

The SDK will get the master server address for the requested region from the Name Server (1 in the figure "Connect to Photon Cloud regions") and automatically connect you to the master server in the chosen region (2 in the figure "Connect to Photon Cloud regions").

With a FixedRegion, the client will not fetch the region list and skip pinging regions for a Best Region result. This speeds up the connection time.

If you compile a FixedRegion into your build, it can not be changed without an update. In best case, use Best Region and the Region Allowlist instead.

How To Show A Region List

To select the region at runtime - e.g. by showing a list of available regions to players and let them choose - a connection to the name server has to be made first.
This will automatically fetch a list of currently available region master server addresses (1 in the figure "Connect to Photon Cloud regions").

While we write about "the name server", the name server is geographically load-balanced across available regions. That keeps the time to request the master servers' addresses as low as possible.

C# Client SDKs

C#

    loadBalancingClient.ConnectToNameServer()

After a successful connection, LoadBalancingClient.OpGetRegions() gets called internally. The result of this sets up the loadBalancingClient.RegionHandler and calls OnRegionListReceived.

With the list of master servers, they can be pinged to determine the best region to connect to for lowest latency gameplay, or let the players choose a region. This can be done with RegionHandler.PingMinimumOfRegions().

When the client has determined a region, connect to the master server for that region (2 in the figure "Connect to Photon Cloud regions").

C#

    loadBalancingClient.ConnectToRegionMaster("us")

Finally, join or create a room for the game (3 in the figure "Client Connect to Photon Cloud").

Using The Chinese Mainland Region

Access to the Chinese Mainland region for your Photon application needs to be requested. Send an email to unlock it for an AppId.
Paid plans for the Chinese Mainland region can not be subscribed to on the Photon website. Reach out by mail to for a quote of 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 made to an app via the dashboard are not automatically reflected in the app caches for China. Notify us by email for updates.

Also, for legal reasons, a separate build for China is needed and it's recommended to use a separate AppId.
For example, a compile condition to change the AppId and the Photon Name Server depending on the build.

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

Back to top