What if client load level before host ?

Hi,

I made a multiplayer game based on host/client networking (no master server).

The hoster is the one who launch the game, and tell everyone to load the game scene.

Then, I want to check if everyone is ready to start the game (if everyone has finished to load the game scene). For now, clients just send with an RPC “i’m ready !” to the server, and when every client has sent “i’m ready”, the game can start.

But i was asking … what if the hoster have a bad computer and client load faster the scene.

They send with an RPC “i’m ready”, but the hoster is still loading : What happen ?

  • Unity is smart and the hoster receive the RPC after the scene is loaded, and then running the function ?
  • The RPC is lost and my game will never start (cause they send the “ready” message one time) ?
  • The hoster receive the RPC but he consider that he receive it on a previous scene, and then it crash cause the function “i’m ready” doen’t exist in the previous scene ?

Or is there an other way to check if everyone has loaded the scene ?

Thanks a lot everyone.

Unity guarantees that all messages are delivered. However - it’s up to you to make sure that the NetworkView and RPC exist so I certainly wouldn’t make something like that scene-dependent.

i may have an idea, make the host load the game and when he is ready send the clients a RPC saying " can load" then the clients start loading.

Thank you two !

I found the “SetPrefix” trick, which desactive messageQueue between loading. But i agree with you Kelso :slight_smile: thx !

Rafael : I was thinking of this but i decide to do an other thing : All the client send every x sec a message “i’m ready” until the server says “okay guyz you are all ready”. If the server is not loaded yet, i dont care about where the RPC falls, because i blocking message queue with Network.isMessageQueueRunning :slight_smile:

Resolved !