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).
The list of available regions differs per product (Fusion, Quantum, Chat etc.). With the Region Allowlist, you can further define which regions should be available for your clients.
Below is the list of regions for this product.
- Available Regions
- How To Choose A Region
- Connect To A Specific Master Server
- How To Show A Region List
- Using The Chinese Mainland Region
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".
|Chinese Mainland1 (See Instructions)||Shanghai||cn|
|Hong Kong||Hong Kong||hk|
|South America||Sao Paulo||sa|
|USA, East||Washington D.C.||us|
|USA, West||San José||usw|
Dashboard Regions Filtering
You can filter the list of available Photon Cloud regions per application on the fly directly from the dashboard.
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?
- 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.
Connect To A Specific Master Server
Direct connections to a master server using the generic region master server address are deprecated. Instead, use the method to connect to a region master as provided by the SDK you are using!
If you know the closest region for your client to connect to you can connect to it passing the region code.
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 for you from the name server (1 in the figure "Connect to Photon Cloud regions") and then automatically connect you to the master server in the chosen region (2 in the figure "Connect to Photon Cloud regions").
How To Show A Region List
If you want to select the region at runtime - e.g. by showing a list of available regions to your players and let them choose - you need to connect to the name server 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
After a successful connection,
LoadBalancingClient.OpGetRegions() gets called internally. The result of this sets up the
loadBalancingClient.RegionHandler and calls
OnRegionListReceived if your code implements it and registered for callbacks.
With the list of master servers, you could now ping all to figure out the best region to connect to for lowest latency gameplay, or let your players choose a region. This can be done with
When your client has determined a region, connect to the master server for that region (2 in the figure "Connect to Photon Cloud regions").
Finally, join or create a room for your game (3 in the figure "Client Connect to Photon Cloud").
Using The Chinese Mainland Region
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.
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.