Best Practice When Loading a Deck of Cards by RPC

Options
I'm just dipping my toes into networking, but your plugin has helped me get going amazingly quickly.

I want to keep track of two or more decks of about 80 cards whose positions, rotations, place in decks, etc. are synced between players. Each card has a PhotonView, and mostly they don't move, so during the game RPCs are few and far between. However, arranging all 160+ cards with RPCs when the level loads is resulting in the old "QueueIncomingReliableWarning" message. This is not a performance critical stage, so I don't care unless I'm actually losing some of these RPCs. Am I?

Comments

  • Tobias
    Options
    We send all RPCs reliably, so you won't lose anything.
    But I see how that is annoying anyways.

    I am unsure if RPCs are the best way to sync positions and rotations here. I guess you are even sending them manually when someone joins?
    You could just observe the transform of their GOs. The recently introduced synchronization mode "Unreliable On Change" was built especially for GOs that move only sometimes. It stops sending updates if the values stay the same as before.
    Optionally, you could drop a few values from being synced per card. You don't need all angles of rotation (most stay 0 or "on the desk", I assume). Also, the position will only be x,z while they are on the table, right? You can try to send only those minimal values a script's OnPhotonSerializeView and observe that script.
  • Thanks for responding so quickly!

    I'll experiment with those techniques and see how it goes. The initial RPCs are just strings (which the client then uses to look up the card in an internal database); I imagine those are rather heavier than, say, an int. Perhaps I could use ids in their place.
  • Tobias
    Options
    Yes, compared to integers, strings are a bit bigger byte-wise. Aside from the actual characters, we also have to write a length info.