Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

MasterClient, Creating Rooms Newb?

$
0
0

Hi there,
another day of gaining inches, not miles as a newb multi player dev, with photon.

here are some questions that have come up today. If you can, please answer what you can.


a) using autoJoinLobby = true, at OnJoinedLobby(), I initiate a check on to see if anyone else is in the room (PhotonNetwork.otherPlayers.Length). If this number hits 1, then I know someone else has entered the room, and thus, can proceed to load a common level.

However, when running the standalone and the editor, no "other player", ever enters the room. They are internally separate. ???




b) Trying a slightly different approach, I decided to create a room, instead of the lobby, however this is even worse in its results. Using the return OnConnectedToMaster(), I create a room. I realize in its current form not checking if isMasterClient is an issue. But for now, I left it out since my check if(isMasterClient), never returned true after connecting.

So, 1) how is isMasterClient set? I thought it was the first player to arrive on the scene. No?

2) back to the next issue, OnConnectedToMaster(), for testing purposes, I decided to create a room with a few custom, RoomOptions, isOpen, isVisible and maxPlayers. I create the room....
Code (csharp):

print(":::connectedtomaster");
print(":::isMasterClient=" + PhotonNetwork.isMasterClient);
print(":::themasterclientis" + PhotonNetwork.masterClient);
RoomOptions roomOptions = new RoomOptions();
roomOptions.CleanupCacheOnLeave = true;
roomOptions.isOpen = true;
roomOptions.isVisible = true;
roomOptions.maxPlayers = 2;
PhotonNetwork.CreateRoom ("lobby25", roomOptions, TypedLobby.Default);
print("ROOMCREATED::");
checkRoomCreated();


Now, again for testing I want to check the room. I am thinking that this process can be used by non masterClient players, to see if it fits their criteria.
Code (csharp):

void checkRoomCreated(){
List roomInfoList = new List(PhotonNetwork.GetRoomList());
print("rilc" + roomInfoList.Count);
for(int i = 0; i < roomInfoList.Count; i++){
print("ril" + i + "n" + roomInfoList[i].name);
print("ril" + i + "m" + roomInfoList[i].maxPlayers);
}
}

However, the result is, that the roomInfoList, has a count of 0. So, how can I check??




Thanks for any help.
Rennie

Viewing all articles
Browse latest Browse all 15755

Trending Articles