Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

order of execution of buffered RPC

Discussion in 'Multiplayer' started by llavigne, Mar 17, 2008.

  1. llavigne


    Dec 27, 2007
    When a new player joins in, the other players are instantiated automatically because network.instantiate was used.

    On each of these other players, the history of their game, the pickups they got, how many hitpoints they lost etc... are all handled by RPC calls which happened during the game under RPCMode.AllBuffered

    1- if say 200 events were buffered, is it slow to be transfered (considering serializing here)

    2- what's the order of execution of these buffered RPCs that are being called before the game starts playing on the new player's computer, do they executed before or after the Start() of each script of the other players?
  2. jashan


    Mar 9, 2007
    In TRaceON, I originally used buffered RPCs for the team configuration. Each time a player created or removed, joined or left a team, a buffered RPC was sent. When I had about 10 or so changes, that already looked kind of funny in the GUI (all on my local network), so I would guess that having 200 buffered RPCs will take a moment. Probably, it won't be particularly long (just a few seconds), but it might already give you some funny effects, if not handled properly.

    Since I found the handling of the buffered RPCs a bit awkward for my purposes, I completely removed it and now keep the state on the server and only send the current state to the client (instead of including all the history since the first player logged in).

    I guess if the server sends an RPC to the client on connect saying "done", and not showing anything of the game before that should make it look fine, though... As the order of RPCs is guaranteed, you can rely on this RPC coming in after all the buffered stuff, so this should work just fine.

    The calls are guaranteed to be sent in the order they were created. However, I don't think there's any guarantees on how they are received on the client for obvious reasons. The order is guaranteed (i.e. RPC 1 will come in after RPC 2, if 1 was sent before 2), but not when they are received. I don't know when the first one might come in - but I'm sure some might be "dripping in late".

    However, it might be that the RPCs are handled somewhere in the Update-Loop which might imply that they are at least guaranteed to be received after Start(). But I don't know more about that... One thing I've been wondering about for quite some time is where exactly the RPCs are handled. That would also answer your question ;-)

    It would be nice to maybe add this information to:

    Sunny regards,