This document is about: VOICE 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

Photon Cloud has servers in several regions, distributed across multiple hosting centers over the world.

Each Photon Cloud region is identified by a "region token".

List of available regions and tokens:

The strings for region tokens(or codes) are case insensitive. Example: "EU" or "eu" are both accepted and refer to the same Europe region.
RegionHosted inToken
AsiaSingaporeasia
AustraliaSydneyau
Canada, EastMontrealcae
Chinese Mainland (See Instructions)Shanghaicn
EuropeAmsterdameu
Hong KongHong Konghk
IndiaChennaiin
JapanTokyojp
South AfricaJohannesburgza
South AmericaSao Paulosa
South KoreaSeoulkr
TurkeyIstanbultr
United Arab EmiratesDubaiuae
USA, EastWashington D.C.us
USA, WestSan Joséusw
USA, South CentralDallasussc

Region Allowlist

You can filter the list of available Photon Cloud regions per application on the fly directly from the dashboard.

photon cloud: regions allowlist
Filter Photon Cloud Regions

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

  • the allowlist should be a string of region tokens separated by semicolons. e.g. "eu;us".
  • region tokens are case insensitive and are defined here.
  • undefined or unrecognized region tokens will be ignored from the list.
  • empty ("") or malformed string (e.g. ";;;") means empty list.
  • empty list means all available regions are allowed.

Once you confirm and save, the NameServer will return only the filtered list of regions. Thus, clients should select from that list. Take into consideration that dashboard updates propagation can take up to 10 minutes.

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 Selection

PUN and Photon Voice rely on the Realtime API to pick the Best Region.

C# Realtime API

Photon Realtime 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.

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.

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.

Photon Voice

Without PUN integration (manual voice client connection)

C#

void ConnectToChina()
{
    // you could also set these values directly in the VoiceConnection.Settings from Unity Editor
    // in that case call voiceConnection.ConnectUsingSettings(); without passing parameter
    AppSettings chinaSettings = new AppSettings();
    chinaSettings.FixedRegion = "cn";
    chinaSettings.UseNameServer = true;
    chinaSettings.AppIdVoice = "ChinaVoiceAppId"; // TODO: replace with your own Voice AppId unlocked for China region
    chinaSettings.AppVersion = "ChinaAppVersion"; // optional
    chinaSettings.Server = "ns.photonengine.cn";
    voiceConnection.ConnectUsingSettings(chinaSettings);
}

With PUN integration and using PUN settings

Since PUN is included in Voice, we just need to follow the steps required for PUN. Photon Voice will automatically connect to the same servers unless PhotonVoiceNetwork.Instance.UsePunSettings is set to false. In that case use the manual voice client steps stated above.

Using PhotonServerSettings

pun 2: photonserversettings for china
PUN 2: PhotonServerSettings for China

Using Code

C#

void ConnectToChina()
{
    AppSettings chinaSettings = new AppSettings();
    chinaSettings.UseNameServer = true;
    chinaSettings.ServerAddress = "ns.photonengine.cn";
    chinaSettings.AppIdRealtime = "ChinaPUNAppId"; // TODO: replace with your own PUN AppId unlocked for China region
    chinaSettings.AppSettings.AppIdVoice = "ChinaVoiceAppId"; // TODO: replace with your own Voice AppId unlocked for China region
    chinaSettings.AppVersion = "ChinaAppVersion"; // optional
    PhotonNetwork.ConnectUsingSettings(chinaSettings);
}
Back to top