PhotonView target

Options
Hello everyone,

The subject already says what I am looking for, I want to supply a Photontarget for my PhotonView. In my case "MasterClient" only, but I didn't find a way to do this.

For those who are now thinking to themselves why I would ever want to do this, here is why: I'm using Photon Cloud where one client is also the master and also authoritative, so most of the PhotonViews are controlled by the Master. When a client clicks on a spot to move his character to, an RPC is sent to the MasterClient, which then validates the information and performs the movement, then sends the new transform to all other clients. The problem I have with that is that RPCs can be sent often per second, depending on how fast the player clicks. If the client clicks 5 times per second, 5 RPCs per second will be sent, and according to some testing RPCs are very network heavy. That's why I want to have an empty GameObject with a PhotonView attached to it on all clients, which resembles the clicked position. But since the MasterClient is authorative, I don't want to send the data to all other clients, it's only meant to be synced from each client to the MasterClient, who then validates the data.

Is that possible, or is my approach even reasonable? I'm still kinda new to networking, so if the way I am doing it is a total mess just let me know.

Thanks,

yellowpaper

Comments

  • vadim
    Options
    Hi,

    You can specify PhotonTargets.MasterClient as target (2nd parameter) for any RPC call.

    Master client feature was designed for things like this, so your approach is ok I think.
  • Tobias
    Options
    I guess it's ok but you have to keep in mind that the Master Client is not guaranteed to stay in game all the time.
    In worst case, that user times out and the server and the other clients need several seconds to detect this! Due to that, in your setup, several messages might not reach their target and no one else.
    Sadly, we can't change this really. We need the timeout to give each client a chance to recover from minor network issues but if the Master is really gone, we can't re-route the messages to someone else.

    Hope this info helps, too.