Search Unity

RPC problems

Discussion in 'Multiplayer' started by roblin, Sep 29, 2009.

  1. roblin

    roblin

    Joined:
    May 1, 2009
    Posts:
    14
    hi, I have a problem with a networking project I'm doing right now.
    I'm using (a slightly altered) Connectgui script from the example networking project, so far, the server initializes the server with port 25000, the clients join on the same, so far so good, now, the game is supposed to make it possible for the server to change scenes from a premade selection, and the clients should tag along to whatever scene the server loads, here is the problem.
    the server can switch scene just as it should, however, the clients (in most cases) won't do a thing, sometimes, one or two of the clients will follow but the rest stay behind, but, as I said, in most cases none of the clients follow.

    the script code for the RPC is as follows :
    Code (csharp):
    1. networkView.RPC("joinScene", RPCMode.OthersBuffered, Application.loadedLevel);
    Code (csharp):
    1. @RPC
    2. function joinScene (level : int) {
    3.     Application.LoadLevel(level);
    4. }
    I really don't get what's wrong here, please help.

    p.s. don't know if this matters but the networkview is set to "Observe" the script this code is from and the state synchronization is off.
     
  2. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Did you check for errors in the console log output , when you have a client running in the editor ?

    --
    oxl
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the buffered rpcs are available to the server only.
    Clients can't request buffering.
     
  4. oxl

    oxl

    Joined:
    Nov 21, 2008
    Posts:
    325
    Hm... where do you read that the client is requesting it ?

    --
    oxl
     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Thats an assumption basing on the fact that the others mode is beeing used.
    Thats commonly used if you want to send an RPC from a client to all others.

    From the server you wouldn't use the other modes normally.
     
  6. roblin

    roblin

    Joined:
    May 1, 2009
    Posts:
    14
    Nope, it's the server that uses the "other" thingy, in fact the clients don't use anything, no RPC:s no state synchronization, nothing. only the server have any control of anything, the clients just enjoy the ride.

    I have found the problem, the client destroys the gameobject called "multiplayerlogic" and with it, the script, as such, there is no receiver for the RPC and nothing happens.

    I can take it from here, thx guys