Want to use OnPhotonSerializeView, but only to MasterClient

Options
Hey everyone,

I'm kind of wondering something here. I currently, as a client, am saving a List of input snapshots like 'left mouse 'down, or 'walk left button up' (one List of snapshots between each send, single snapshots are in the form of an integer, which will be hold against a bitmask, to keep things quick), and at every 'OnPhotonSerializeView' I want to send this over. For security reasons and to keep the network load as low as possible, I want to target this to the MasterClient (since it's authoritative) only. Other clients have no use to know what I am pressing.

I know an RPC gives me this option, but I'm not sure if RPC is the way to go with things that change a lot (like in my actiongame, think of its input as a First Person Shooter).

So what is the way to go? Can I target 'OnPhotonSerializeView' to the MasterClient or should I go for RPC's?
Also, I know RPCs are reliable, but does that also mean their order is guaranteed? Because that's something I definitely want (otherwise, for instance, pressing 'walk' and releasing 'walk' might cause undesired results).

Thanks for your time :)

Comments

  • Tobias
    Options
    If you want to optimize things this way, you should use RaiseEvent(). It's independent from PhotonViews and you can target the event any way you like. It gives you more options and you can get best performance, too.
    Please refer to the documentation from the package for details. Let me know if something is unclear.

    Aside from that: If you send messages to the Master Client, there is always a change that the client drops out anytime. In some cases, you won't notice the player missing until a timeout happens.
    You should be aware of that and have a backup plan. In some cases, it might make sense to send events to more players, so someone can respond.
  • sp33s
    Options
    Thanks for the reply Tobias, really appreciate that :)
    However, I've got two questions on RaiseEvent()
    1. What is not clear to me, if the order in which they are handled is guaranteed. Because of course, for input, that is very imporant. Is this determined by the sendReliable field as well? Because I felt that just confirms that is was received by the other end.
    2. Is each and every RaiseEvent instantly sent, or is that determined by the PhotonNetwork.sendRate?
  • vadim
    Options
    1. Events sent by single client received on all clients in same order as sent. Two events sent from different clients received in same order on all clients (depending on which event handled first by server).
    2. PhotonNetwork.sendRate determines how quick RaiseEvent is actually sent.
  • sp33s
    Options
    Thanks for the reply vadim, all I wanted to know :)