Turnbased Networking Unity

I signed up for a turnbased server and after combing the net for anything I can find on the topic, this is the code I have been able to piece together:
using System; using UnityEngine; using UnityEngine.UI; using System.Collections; using Random = UnityEngine.Random; public class networkManager : MonoBehaviour { public Text theText; // Use this for initialization void Start() { PhotonNetwork.logLevel = PhotonLogLevel.Full; PhotonNetwork.sendRate = 1; PhotonNetwork.sendRateOnSerialize = 1; PhotonNetwork.ConnectUsingSettings("0.1"); logState(); } void OnJoinedLobby() { theText.text = theText.text + "\r\nOperation Response 229: Connected to server";// + PhotonNetwork.autoJoinLobby.ToString(); Debug.Log("Joined Lobby"); theText.text = theText.text + "\r\nLobby connection - " + PhotonNetwork.lobby.ToString(); PhotonNetwork.JoinRandomRoom(); } void OnPhotonRandomJoinFailed() { Debug.Log("Can't join random room!"); theText.text = theText.text + "\r\nOperation Response 225: In Lobby - " + PhotonNetwork.inRoom.ToString(); PhotonNetwork.CreateRoom("Room 1"); } void OnJoinedRoom() { theText.text = theText.text + "\r\nReturn Code:0 \r\n Proceed - True"; // PhotonNetwork.JoinRoom(RoomName); //We are joinging a room named lobby theText.text = theText.text + "\r\nIn Lobby - " + PhotonNetwork.inRoom.ToString(); // theText.text = theText.text + PhotonNetwork.playerName; StartCoroutine(wait()); } void logState() { theText.text = PhotonNetwork.connectionState.ToString(); theText.text = theText.text + "\r\n" + PhotonNetwork.ServerAddress; Debug.Log(PhotonNetwork.connectionStateDetailed.ToString()); } IEnumerator wait() { yield return new WaitForSeconds(1); theText.text = "Players in lobby:\r\n"; // generate a name for this player, if none is assigned yet if (String.IsNullOrEmpty(PhotonNetwork.playerName)) { PhotonNetwork.playerName = "Player" + Random.Range(1, 9999); } //theText.text = theText.text + PhotonNetwork.playerName; foreach (PhotonPlayer player in PhotonNetwork.playerList) { theText.text = theText.text + "\r\n Player" + Random.Range(1, 9999); } } }

This code works great, but what to do now? According to this page: http://doc.photonengine.com/en/turnbased/current/getting-started/turnbased-intro I need to create a LoadBalancingClient instance and call ConnectToRegionMaster
They give the following include
using ExitGames.Client.Photon.LoadBalancing;
which Unity does not recognize. Doesn't regonize this type either:
private LoadBalancingClient client;
So is the necessary files for Turnbased not included with PUN?
I'm not at all familiar with LoadBalancing but do I need to call this and select my region if I am using this: PhotonNetwork.ConnectUsingSettings("0.1"); which has the settings entered into the inspector?


My biggest question is am I going anywhere with this, or should I just be using the standard PUN server? tia

Comments

  • PUN and Turnbased are two separate products. To continue, you need to remove PUN and add the Turnbased SDK under the Unity section here: https://www.photonengine.com/en/Turnbased/Download

    Confusingly, they also list PUN on that page. What you are looking for is a bit further down the page and named "Unity 3D SDK" currently version v4.0.0.12.

    Your code above won't work for Turnbased, as "PhotonNetwork" is for PUN.