Merging rooms by getting the room list and reconnecting

Options
Hi, this is Erik of Upstairs Digital, we are currently making a game about wrestling with space ships.

We are using Photon to build out our online multiplayer, but I have stumbled into a wall it seems.

We have 3 ways to get an online game going.
1. Click a button and it matches you up with an opposing team (1 or 2 people).
2. Invite a friend and play with them.
3. Have the friend you invited play on your team against an opposing team.

The way it's implemented currently:
1. Game starts in offline mode -> player sets up their team -> Connects to online -> Fetches the room list -> picks a game (if none exists it creates a room and waits) -> match found -> starts the game.

2. Game starts in offline mode -> player may set up their team -> clicks invite friend -> creates a hidden room -> friend joins -> players set up their teams. -> game starts.

3. Game starts in offline mode -> player may set up their team -> clicks invite friend -> creates a hidden room -> friend joins -> players set up their teams. -> clicks search for online game -> gets the room list -> changes the room to be visible if no game was found and waits for a match. ---- OR ---> master client sends the name of the room it has found to the friend -> both disconnect -> both connect to the found room -> (notice no setup team step) game starts.

The first 2 have been trivial to make, but the 3. one seems impossible. The problem is the step were the master client tries to fetch the game list. When that happens Photon prints two errors:
Operation failed: OperationResponse 217: ReturnCode: -2 (Unknown operation code). Parameters: {} Server: GameServer UnityEngine.Debug:LogError(Object) NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Imported Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1567) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[]) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Imported Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

GetGameList failed: OperationResponse 217: ReturnCode: -2 (Unknown operation code). Parameters: {} UnityEngine.Debug:LogError(Object) NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Imported Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1518) NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Imported Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1876) ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[]) ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() PhotonHandler:Update() (at Assets/Imported Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)

There was a post back in 2013 discussing this. It begins with a snippet of the documentation where it says "/// Not available while being in a room.". However, this is no longer in the documentation (or I cannot find it).

So is it possible now to get the room list while in a room? Is there another way (perhaps a better way) of merging two rooms?

Thanks.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited May 2017
    Options
    Hi @UpstairsDigital,

    Thank you for choosing Photon!

    GetGameList works on Master Server only, i.e. when not joined to a room.

    So for your 3rd use case why don't you make use of ExpectedUsers (Slot Reservation) and FindFriends operation as described here. You only need one room and one player does the matchmaking.
  • @JohnTube Thanks for the reply.

    The reason the expected users from find friends won't be sufficient is that the friends should have set up their team, ahead of time.

    So that when a stranger joins the room, the game begins immediately.

    I could of course have the friends setup the room and make it visible to strangers, then immediately start as a stranger joins. But then I cannot have a team of friends vs another team of friends.
  • UpstairsDigital
    edited May 2017
    Options
    For the people in the future finding this thread, with the same use case, here is what you should do (/this is how we solved it):

    Register webhooks on the photon dashboard (https://www.photonengine.com/en-US/dashboard)
    You will need to hook into PathClose and PathCreate
    On PathCreate create an entry in a database keeping track of the room. On PathClose remove that entry.
    Filter as needed, time out records and so on. Create a way to retrieve this list (or just one room). We implemented this with php (about 100 lines of code total) and a mysql database.
    From inside the game you could probably use WebRpc (we used something else but webrpc's will do) and retrieve the room list.

    You can now maintain your own room list, that can be called as needed, at any point of the game.


    SIDENOTE: if you use JoinOrCreateRoom, OpCreateRoom is not called, so you will need to also register the webhook PathJoin.