[PUN2] Best Region: investigation and improvements

Hi,

We have been getting various reports about clients (Unity Editor or build) unexpectedly not connecting to the same region when "Best Region" is used. By "unexpectedly", I meant clients in the same geographical area, connected to the same network or even running on the same machine.

We started addressing this issue on documentation, see "Best Region Considerations".

However, we think that this is not enough and we want to improve the heuristics we use to determine the "Best Region".
But in order to do this, we need your help. We need you to provide us with some logging entries which will help us investigate and decide what to do next.

To know which region you are connected to, one way is to log it in OnConnectedToMaster callback, something like this:
        public void OnConnectedToMaster ()
	{
              Debug.LogFormat("PUN2 client connected to region: {0}", PhotonNetwork.CloudRegion);
	}
First of all, you need to update to latest PUN2.

Logging instructions:

The region pinging results can be logged very easily:

In the PhotonServerSettings, set the "PUN Logging" level to Informational at least.
For the editor, you can force the "Best Region" pinging. Use the "Reset" button in the PhotonServerSettings to clear the "Best Region Preference".
Via code, you can also clear the setting:
PhotonNetwork.PhotonServerSettings.ResetBestRegionCodeInPreferences();

Log entries needed:

Two log entries are of interest:

"PUN got region list. [...]" and "Region Pinging Result [...]" which contains multiple lines.
We need those from the clients that have different opinions of which region to choose.
You can copy them directly from Unity Editor Console window or from Editor log or build log file (log files).

When you manage to reproduce the issue of two PUN2 clients, geographically located next to each other or connected to the same network or running on the same machine but were connected to different regions using "Best Region" (default), get the logs mentioned above using the instructions explained above as well.
You can copy those and send them to us via [email protected], preferably use the same subject as this discussion: "[PUN2] Best Region: investigation and improvements". Do not forget to send us PUN2 version, Unity version and other details about the report that you could consider useful (if clients are connected to the same network, Unity Editor or build, which device, which OS, running on the same machine or not, etc.).

We appreciate your efforts and all your help.
Thank you for your time and understanding.

NOTE: PUN Classic is in maintenance or feature freeze mode. So we will focus on PUN2 only.
Sign In or Register to comment.