Photon Network - Synchronizing a queue over the server into a photon room

I have developed a matchmaking system (similar to league of legends) using Unity 3D and PUN (Photon Unity Networking). So far what I have is after the user connects to the server, and joins the lobby, I have set it up so it adds that player to a unity 'Queue'. Once in the queue, my co-routine is called and removes the first object(player) from that queue and moves them into a room, or creates one if there is no room available.

Basically what I'm trying to do is after the user is connected and in the lobby, my goal is to have other clients join that same queue and to then allow that queue to be loaded into a room. This is where my issue comes into play: when running 2 clients, it adds each player into the queue for that CURRENT INSTANCE, then instantiates each player into a different room.

So here's what im wondering: is what I'm trying to do possible with PUN? If it is, how can I rework this to work with the server side. If not how can I implement my system into something that will work with PUN? I have been trying to figure this out for quite some time now and am just looking for someone to point me in the right direction. I have posted all relevant codes below.

Any help is appreciated! :)

Cheers, Dev.

GameManager.cs

http://pastebin.com/HS827jzf

Matchmaker.cs

http://pastebin.com/HdgmPAyP

GameLobby.cs

http://pastebin.com/D580b5g5

Comments

  • Tobias
    Tobias admin
    edited October 2015
    Duplicate post from Unity forum.
    Further discussion will be here.

    I am not entirely sure if I understand your problem correctly. For "this instance"?
    Players can only interact with each other while in a room.

    You make all players join a room to get (in order of joining) into another room?

    Photon has matchmaking and it can be quite sophisticated, too. Can you explain why our proposed workflow with JoinRandomRoom doesn't work for you?

    See:
    http://doc.photonengine.com/en/pun/current/tutorials/matchmaking-and-lobby

  • Yet another, similar discussion going on?!
    http://forum.photonengine.com/discussion/6827

    Please limit topics to only one thread, @Dev
  • Yeah I posted that, than fixed my error. My bad, should of deleted that thread.
  • The reason that the JoinRandomRoom doesn't work is because I want to be able to queue up the players and wait for them to be 'ready', before the game actually starts and loads them into the game. With JoinRandomRoom, we have no control over whether or not they can 'ready' up and 'prepare' the players for the game.
  • What would be the best way to do this with PUN? Since the way I am doing it isnt the right way
  • You can join everyone into rooms and then check the ready state to play the game, I would assume.
    Anything that needs to be done before being "ready" can be done without being in a room, usually. When you move them from a matchmaking room into the actual match, they also prepare without being in the correct room.
    Do time-out players who are not ready and then start the game.

    Unless you do some tricky stuff in the matchmaking room, just let Photon distribute your players to get them into rooms faster.