How to setup a masterclient?

Options
Hello,

if i want to use a unity client as masterclient, how do i setup this kind of environment? I dont know how to start :(

Another questions are:

(didn't find it anywhere): how do i send rpc's to the the masterclient (PhotonTarget.MasterClient?) and is a rpc to the masterclient recived by the other clients (they ignor them only?)

how do i call custom operations from a unity client?

Comments

  • dreamora
    Options
    Thats correct, you send RPCs to him through the MasterClient PhotonTarget and no the others will not get it, the photonserver explicitely only sends it to him.

    As for custom ops: You would have to implement them in the NetworkingPeer as well as in the LoadBalancing project on the photon server (not the cut down one that comes with the AS download but the real photon 3 server)
  • dreamora wrote:
    Thats correct, you send RPCs to him through the MasterClient PhotonTarget and no the others will not get it, the photonserver explicitely only sends it to him.
    ok, i was afraid that other clients can sniff the packets :)

    dreamora wrote:
    As for custom ops: You would have to implement them in the NetworkingPeer as well as in the LoadBalancing project on the photon server (not the cut down one that comes with the AS download but the real photon 3 server)
    Thats not what i mean, if i had already add a op in the photonserver (i send the string ping, it send back pong), how do i call it from the unity client?
  • Tobias
    Options
    The master client is simply the active player with the lowest actornumber of a room. So it is setup automatically and "master" switches, if the current one leaves the game.
    Just to be sure: The master is not the same as the server. You can call RPCs on the master client but can't call custom operations on it. Any operations are handled by the server exclusively.

    To implement new, custom operations in the Photon Unity Networking plugin, you could extend the NetworkingPeer.cs. The method OpCreateGame in it is already using the custom operation feature of the client library, so you have a blueprint for this. Also, you can check out the docs in the DevNet: Custom Operations.