Search Unity

Problem starting the game (application.loadlevel) with more than 3 players connected?

Discussion in 'Multiplayer' started by Sargon_of_Akkad, Aug 20, 2012.

  1. Sargon_of_Akkad

    Sargon_of_Akkad

    Joined:
    Jan 16, 2011
    Posts:
    147
    I'm using a master server tutorial to host a game lobby (a multiplayer game that starts on a scene called 'lobby') on the Unity master server, and players can connect to it fine. The server then determines what map the game will load, and sends the information to the players connected to the lobby via an RPC call (using all, not allbuffered) that instructs the clients to load the specific level using application.loadlevel.

    This works fine for 3 or fewer people in the lobby, but when four or more players connect the game grinds to a halt. If the server initiates the game then the other players do not seem to receive the RPC call, and stay sat in the lobby scene, and do not load the level scene.

    I am at a loss as to why this is happening, is this something anyone else has encountered? I couldn't find any threads with anyone having the same issue.

    I can't post the code at the moment as I am at work, I will post later if required.

    Thanks in advance.
     
  2. Boomsma1995

    Boomsma1995

    Joined:
    Mar 21, 2011
    Posts:
    95
    What you can try is to call an (C#) foreeach (UnityScript) for to loop trough all the connected players and send all the RPC's to the player instead of using RPCMode.All

    In my game i dont have any problems with using RPCMode.All. Even when 100 RPC's are send, every player gets the call and this was tested with 5 people inclusive me.
     
  3. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    Have the editor act as the 4th client and switch on network debugging. Then at least you'll be sure if the RPC call arrives or not. At this time your just guessing and thats not what you want to do when you troubleshoot networking.
     
  4. Sargon_of_Akkad

    Sargon_of_Akkad

    Joined:
    Jan 16, 2011
    Posts:
    147
    Thanks for the input guys. I haven't managed to do another large-scale test yet, but after investigating I can only find one common attribute between the players who can't connect/start the game.

    If all players are connected to their routers by a wired lan cable, they can connect and start perfectly. If one or more players are on a wireless network, they cannot connect and start the game. This is literally the only common point I can find, but I refuse to believe that it is due to being on a wireless network.

    None of the players are on the same local network, and are connecting via the internet, but only people connected to their routers via a wired connection seem to be able to start. I have tested this on multiple wireless networks and each time the same issue occurs. I must be doing something wrong!

    Will post if I find any solutions...