Get room list when inside room, Using another peer
Options
Hey, I'm making a game where instead of the lobby you immediately connect to a room which is like your hang out place and you can invite friend and all that.
But i want the person to be able to browse the room list when inside his room.
I read somewhere that this can be achieved by using 2 peers. I don't care about the player count, so this seems like a good idea.
I got a peer running by doing:
peer = new PhotonPeer(ConnectionProtocol.Udp);
peer.Connect(PhotonNetwork.ServerAddress, "VariationC");
and in the update
if(peer.PeerState == PeerStateValue.Connected)peer.Service();
But i don't know where to go from there. Any help appreciated
But i want the person to be able to browse the room list when inside his room.
I read somewhere that this can be achieved by using 2 peers. I don't care about the player count, so this seems like a good idea.
I got a peer running by doing:
peer = new PhotonPeer(ConnectionProtocol.Udp);
peer.Connect(PhotonNetwork.ServerAddress, "VariationC");
and in the update
if(peer.PeerState == PeerStateValue.Connected)peer.Service();
But i don't know where to go from there. Any help appreciated
0
Comments
-
UPDATE:
I tried using the load balancing client api.
But another problem occurred:
public LoadBalancingClient client = new LoadBalancingClient();
void Start()
client.MasterServerAddress = PhotonNetwork.ServerAddress;
client.AppId = PhotonNetwork.PhotonServerSettings.AppID;
client.AppVersion = "0.01";
client.AutoJoinLobby = true;
client.Connect();
void Update()
print(client.State);
And it's stuck on ConnectingToMasterserver.
What am i doing wrong here?
I want to get the client.RoomInfoList. to get the rooms while in another room0 -
0
-
I added client.Service(); in update, and now it's stuck on
ConnectingToNameServer
EDIT
I added client.ConnectToNameServer(); at start.
now it's only prints ConnectedToNameServer
ANOTHER EDIT:
hh okay so i added client.ConnectToRegionMaster("eu"); after ConnectToNameServer(), at start.
And it says "Joined Lobby".
But i'm not getting the server list.
Both the PhotonNetwork and the load balancing connect using "0.01" App Version. But i still don't get the server list.
foreach (var item in client.RoomInfoList.Keys)
print(client.RoomInfoList[item] + " " + item);
is not printing anything.0 -
Service() function needs to be called on a regular basis like ten times a second. Since you only want to receive a room list, try calling it just four or five times a second. You have multiple possibilities to do that: Coroutines, Tasks, Threads, InvokeRepeating. Please make sure that Service() function is called regularly.0