Custom Room Properties Not Updating?

Options
UDrew
UDrew
Hello!

I'm having an issue similar to this one: http://forum.exitgames.com/viewtopic.php?f=17&t=4947 I don't see that they got a resolution though. Basically, my issue is that I'm setting up custom room properties for match making, game state, etc. I can get the initial properties to get set just fine when creating the room, however, if I try to update the properties after the room has been created, it only updates the properties for the client(s) already in the room. Anyone who tries to join still sees the original properties until they join the room. My understanding is that using SetCustomProperties should update the properties of the room to the whole lobby and not just the room's client(s). Am I doing something wrong?

Below is the code I'm using to try and update the room's custom properties. One example of when this is used is after the room is already created and the game starts. I want to update "C3" to be 1 (In game) from 0 (In Lobby). When I do this, all the clients in the room see that "C3" updated to 1, but clients outside the room still see that "C3" is at 0, which is the default value. Same thing happens with C0 through C2.
RoomOptions newRoomOptions = new RoomOptions();
		newRoomOptions.isOpen = true;
		newRoomOptions.isVisible = true;
		newRoomOptions.maxPlayers = 4;
		
		newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable();
		newRoomOptions.customRoomProperties.Add ("C0", NetworkSettings.gameType); // Game Type; 0 = Team Tackle, 1 = Death Match, 2 = Survival, 3 = Random
		newRoomOptions.customRoomProperties.Add ("C1", (newRoomOptions.maxPlayers - playerCount)); // Number of open player slots available
		newRoomOptions.customRoomProperties.Add ("C2", NetworkSettings.HighestRating()); // Highest rating of player in game (for matchmaking purposes)
		newRoomOptions.customRoomProperties.Add ("C3", 1); // Flag for if the game is currently in lobby; 0 = In Lobby, 1 = In Game, 2 = Private
		
		newRoomOptions.customRoomPropertiesForLobby = new string[] {"C0","C1","C2","C3"}; // this makes "C0, C1, C2, C3" available in the lobby

		PhotonNetwork.room.SetCustomProperties(newRoomOptions.customRoomProperties);

If you need any other information, please let me know and I'll be happy to provide it!

Comments

  • Tobias
    Options
    The RoomOptions have to be used in CreateRoom(string roomName, RoomOptions roomOptions, TypedLobby typedLobby).
    It's not enough to set them as properties afterwards.
    Sorry we confused you with that. Otherwise your code looks fine.
  • UDrew
    Options
    Hi Tobias!

    Thank you for your response! Unfortunately, that doesn't fix my issue. Below is the following code that I am using to initially create the room:
    RoomOptions newRoomOptions = new RoomOptions();
    			newRoomOptions.isOpen = true;
    			newRoomOptions.isVisible = true;
    			newRoomOptions.maxPlayers = 4;
    
    			newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable();
    			newRoomOptions.customRoomProperties.Add ("C0", NetworkSettings.gameType); // Game Type; 0 = Team Tackle, 1 = Death Match, 2 = Survival, 3 = Random
    			newRoomOptions.customRoomProperties.Add ("C1", (newRoomOptions.maxPlayers - playerCount)); // Number of open player slots available
    			newRoomOptions.customRoomProperties.Add ("C2", NetworkSettings.HighestRating()); // Highest rating of player in game (for matchmaking purposes)
    			newRoomOptions.customRoomProperties.Add ("C3", 0); // Flag for if the game is currently in lobby; 0 = In Lobby, 1 = In Game, 2 = Private
    
    			newRoomOptions.customRoomPropertiesForLobby = new string[] {"C0","C1","C2","C3"}; // this makes "C0, C1, C2, C3" available in the lobby
    
    			// let's create this room in SqlLobby "myLobby" explicitly
    			TypedLobby sqlLobby = new TypedLobby("myLobby", LobbyType.SqlLobby);
    			PhotonNetwork.CreateRoom(roomName, newRoomOptions, sqlLobby);
    

    As you can see, I am using CreateRoom to initially set the properties. When I use JoinRandomRoom with the sql filter, it works perfectly. So there isn't any issue with getting the properties setup when the room is created. The issue is that AFTER the room is created, any changes I try to make (see my code from my first post) to the properties only shows up to the people inside the room and anyone joining doesn't see it until after they join the room. So for example:

    Player 1 creates a room and sets property "C0" to 1.
    Player 2 searches for a room with "C0 = 1" and joins Player 1's room.
    Player 1 switches "C0" to 2 via the code from my first post.
    Players 1 and 2 can view PhotonNetwork.room.customProperties["C0"] and see that it is switched to 2.
    Player 3 searches for a room with "C0 = 1" and gets matched to Player 1's room. Once joined in the room, Player 3 can see that the "C0" is 2, but Player 3 couldn't see that until after they joined.

    So for some reason, the updates aren't getting to the lobby, they only stay at the room level. I hope this helps clear up the issue, but if there's any more information I can provide, just let me know!

    Thanks!
  • Tobias
    Options
    Now I got your problem. I will have to check if changing the value does not update the lobby or only after a short delay.
    Test-wise you could give the server ~20 seconds between changing C0 and searching for it again in matchmaking?
  • UDrew
    Options
    Thank you for looking into this, Tobias! I did give it a good 30 seconds between the change and the search, and I even tried waiting a few minutes in between, but the same thing happened. The lobby isn't updating.

    If there's anything else you'd like me to try out, I'd be happy to give it a try.

    Thanks again!
  • Tobias
    Options
    I can reproduce the issue and will try to get a fix soon.
  • UDrew
    Options
    Great, thank you again for your assistance with this!
  • Hi there, is there a solution for this problem? or am i just blind
  • Nvm it works now
  • ErwinALX
    Options
    what is sql lobby?