Find Game Photon Server Unity
I'm doing a half turn based half realtime game, for that, I'm using realtime. But i'm not using PUN, I done a server on my self machine. What I want to do now: The player click on a button "Find Game" and the server will list all players searching for a game, and connect 8 players on a room, and start automacally the game, for easy understand, its like Conter Strike Global Operation, or Dota 2 system of Match Making.
I just found the option for create rooms, and join a random room, but I want to "Jump this Step" of a player enter on a room and wait all click "Ready" to finally start the game, the Idea is: who's searching a game, automacally join in it when the number of players are reached.
Any Idea how to do that ?
I done this try, but I want to enter game if the max player limit is reached
using UnityEngine;
using System.Collections;
public class NetworkingConnector : MonoBehaviour
{
public string gameVersion = "";
// Use this for initialization
void Start ()
{
PhotonNetwork.ConnectUsingSettings(gameVersion);
}
// Update is called once per frame
void Update ()
{
print(PhotonNetwork.connectionStateDetailed.ToString());
}
void OnGUI()
{
GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
if (GUILayout.Button("Connect"))
{
PhotonNetwork.JoinRandomRoom();
}
}
public void OnPhotonRandomJoinFailed()
{
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 3, isOpen = true };
PhotonNetwork.CreateRoom("", roomOptions, typedLobby: null);
}
}
Your answer
Follow this Question
Related Questions
Noob problem with Photon 0 Answers
Photon & Unity Question 0 Answers
Photon Network Client Reading empty variables when connect 0 Answers
Photon Join Random CustomRoomProperties not working 0 Answers
My Photon Variable is only owned from MasterClient 0 Answers