1
\$\begingroup\$

I need to send a message to all players in the room from a Photon server. Sending the message from a player would introduce too much latency so I need the server to collect data and distribute messages at a rate of 16/s without a player's influence. Is there a way to do this?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$
if (PhotonNetwork.isMasterClient)
    photonView.RPC ("SendMessageRPC", PhotonTargets.All, "Hello there!");

[PunRPC]
void SendMessage (string message) {
    chatBox.AddMessage (message);
}

The above is basically how to send a message, with you needing to impliment a GUI or UI for a chatBox and a script that has a public void function that is called AddMessage, which adds the string message onto the big string of all the messages.

I'm not sure if there is a way to guarantee the speed of delivery, as all the client's (and if you're using a server, also that) devices and network speed is not the same.

\$\endgroup\$
3
  • \$\begingroup\$ I need to initiate the message from the server. Calling it from the client would mean 1 extra trip for the message. \$\endgroup\$
    – JPtheK9
    Commented Jan 3, 2016 at 0:35
  • \$\begingroup\$ @JPtheK9 Sorry then, I'm not very sure how you do this :) \$\endgroup\$ Commented Jan 3, 2016 at 0:39
  • \$\begingroup\$ actually allot of games use client based applications to send "Master" or "Admin" messages this way. Arma 3 for example has RCON software to allow admins of servers to send global messages to all player from a client side application. I would recommend maybe making a admin tool for your game/application. \$\endgroup\$
    – Ryan white
    Commented Aug 16, 2016 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .