Search Unity

Third Party Photon Region Select

Discussion in 'Multiplayer' started by sezbladex, Feb 24, 2014.

  1. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    Hello guys i want to select region like america ,europe and asia part server If you know please send me example project :S i dont know i cant do
     
  2. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    Help pleaseee :SS
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    You can set this in the Editor before you compile. In Menu: Window > Photon Unity Networking. In the Wizard: "Setup" and you can pick a region. Don't forget to save.
     
  4. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    i know but i saw a game i want this how can i make ? $selectregion.jpg
     
  5. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    Help me guyss :S please
     
  6. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
  7. sezbladex

    sezbladex

    Joined:
    Sep 15, 2013
    Posts:
    22
    Source code please :S
     
  8. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    sezbladex:
    Creating the UI is up to you.
    Per region, Photon's Master Server's have a different address: http://doc.exitgames.com/photon-cloud/Regions

    So once the user selected a region, you can call PhotonNetworking.ConnectToMaster(masterServerAddress, 5055, appId, gameVersion);
    It works like ConnectUsingSettings(gameVersion) but connects to a specific masterServerAddress.
     
    unity_Kr2YprMBVDvK2Q likes this.
  9. pixelysoftmusic

    pixelysoftmusic

    Joined:
    Sep 15, 2021
    Posts:
    1
    using UnityEngine;
    using System.Collections;
    using Photon.Pun;
    using Photon.Realtime;
    using UnityEngine.UI;
    public class EscogerHost : MonoBehaviour
    {
    [Header("Config Host")]
    public ServerSettings sSs;
    public Text textoHost;
    public Text contadorPlayers;

    // Use this for initialization
    void Start()
    {
    textoHost.text = PlayerPrefs.GetString("ElHostt");
    }
    void Update()
    {

    }

    public void UseCloud(string code)
    {
    contadorPlayers.text = PhotonNetwork.CountOfPlayers.ToString();
    PlayerPrefs.SetString("ElHostt", textoHost.text);
    sSs.AppSettings.FixedRegion = code;
    textoHost.text = code;

    }

    }
     
  10. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    Hello,
    one user is based in USA and can connect to the app, the other based in Europe can connect to the app also.
    The Europe user creates the lobby, but the US user cannot see the lobby in the list. Any idea?
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
  12. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    Thanks, but the region was not specified in our app, so I suppose that, according to the documentation, Photon chooses the best one for each user. And in this case, two different regions US & Europe. Do you confirm ?
     
  13. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    Yes, this can happen. Ping times can vary anytime and it happens that two clients in the same location may select different regions. Maybe one didn't get a reply for pings, etc.
    If this happened more than once, up the "Network Logging" level in the PhotonServerSettings, run until the clients have the issue and send logs (complete ones for the start, not a screenshot) from both clients. The log I would look into is a multi-line log showing all ping times.
     
    tolosaoldfan likes this.
  14. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    We fixed it by providing a list of the available regions: effectively, even we're based in Europe, and we choose "us" as a region, we can login in the same lobby than a "us" user. Thanks.
     
  15. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    There is a "Region Whitelist" in the App Dashboard, which you can use to limit the available regions for clients.
    It's best to limit the regions this way, because it tells is you only want these regions and you keep the option to add more regions if needed (the clients will notice a changed region list and re-ping the regions of a changed list).

    No matter that, great you found a working solution.
     
    tolosaoldfan likes this.
  16. tolosaoldfan

    tolosaoldfan

    Joined:
    Sep 14, 2012
    Posts:
    92
    Thanks for this advice, we'll do it!