Synchronize scene change

Options
Hi,

we are developing a game that do a random matchmaking. So when I click on Play, it does a JoinOrCreateRandomRoom.
When 4 player are in a room, we would that all clients (MC included) load game scene. When entered, MC should start game initialization flow with some RPCs.

This looks quite simple using isMessageQueueRunning boolean, but we have encountered this problem:
Initialization RPCs are on a Photon View that is created when new scene is loaded. If MC send and RPC when a client hasn't disabled MessageQueue yet (and so, also hasn' t loaded the new scene yet), it will be lost (it arrives but the target photon view doesn t exist because it will be create when the new scene will be loaded).

Are there any workaround for problem like this?

Thanks for help.
Andrea.

Comments

  • equality
    equality
    edited January 2016
    Options
    Wouldnt it work with buffered RPCs? That way, the clients recieve the game init RPCs from the Master, whenever they finished loading the level.

    Or make the clients send an RPC to the master client, when they finished loading, that does playersReady++;. When playersReady == room.playerCount, start game initiation on the MC.
  • erre
    Options
    Thanks for your help.

    We tried your solution and we had some problem:
    Buffered RPCs can be dropped if they arrive before the game scene is loaded (because they arrive, and no photon view is found).

    For the second idea, we have tried it, but the PlayerReady RPC may be dropped with the same probability as StartGameInitiation RPC. (in this case when I send RPC before MC has loaded scene game).

    Our current solution is use Player Custom Property (MC iterates on them).

    If you have any other ideas, we' re happy to try and discuss it! :)

    Thanks again.
    Andrea.
  • vadim
    Options
    Hi,
    You may wait until all clients send "level loaded" RPC to master before sending initialization RPC.
    Or use room properties instead of RPC to initialize game.