Photon Cloud provides you with global connectivity to allow low latency gaming all around the world.
The initial connection of clients goes to a Photon Name Server, which provides the list of available regions.
Each region is completely separate from the others and consists of a Master Server (for matchmaking) and Game Servers (hosting rooms).
The full list of available regions is below. In the Dashboard, you can define which regions should be available for the clients.
- Available Regions
- How To Choose A Region
- How To Start Your Game With The Lowest Latency
- How To Select A Region At Runtime
- 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|
1: Chinese Mainland needs separate AppId and subscription.
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 whitelisted regions as follows:
- the allowed list 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.
How To Start Your Game With The Lowest Latency
Connect To The Nearest 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 only the region.
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 Select A Region At Runtime
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. You can then query the name server for a list of currently available region master server addresses (1 in the figure "Connect to Photon Cloud regions").
While we write of "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, you get the list of available regions.
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.
When your client has determined the 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.