Performance Question

Hi guys,

Just getting into Photon, seems pretty good out of the box. I have some questions regarding the way Photon is built and how optimal it's going to be to use PUN for what I'm trying to do.

The blue-sky goal: Have 100 players simultaneously sending "Control" messages to the host at ~10 messages/second. The communication is one-way. The host does not respond to the players. The players do not receive the inputs of other players. (The idea is having lots of players in the same room watching a big projection of the game, using their phones as a controller).

At the moment I'm using PUN and RPCs. It's an early implementation, but something's breaking after ~3 players have joined. Before I go any further, thought I'd ask about what PUN is up to under the hood.

• Are RPCs (with targets, e.g. PhotonTargets.MasterClient) actually sent to everyone in the Room, but only "appear" for the target?
• Are room state events (e.g. "New player joins...") compulsory? So, will all 99 players receive them when the 100th player joins, even if they're not interested? Can this behaviour be turned off?
• Finally, is PUN a good way to achieve the goal, overall? Is there an alternative that will achieve the goal in a more efficient way?

Cheers!
Digl

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2017
    Hi @Digl,

    Thank you for choosing Photon!

    100 players sending 10 messages / second to host / Master Client
    100 * 2 (to + from server) * 10 = 2000 messages / room / second
    This is not supported by PUN / Photon Realtime where we recommend to stay below 500msg/s/room.

    but something's breaking after ~3 players have joined
    What do you mean? Could you elaborate?

    Are RPCs (with targets, e.g. PhotonTargets.MasterClient) actually sent to everyone in the Room, but only "appear" for the target?
    No they are just sent to Master Client so each RPC should count as 2 messages: sender -> server + server -> Master Client.
    Are room state events (e.g. "New player joins...") compulsory? So, will all 99 players receive them when the 100th player joins, even if they're not interested? Can this behaviour be turned off?
    It's possible to turn this off using RoomOptions.SuppressRoomEvents = true. The client will not receive join and leave events which may break PUN (logic and errors) as it relies on it. You will need to switch to Photon Realtime Unity SDK instead of PUN.
    Finally, is PUN a good way to achieve the goal, overall? Is there an alternative that will achieve the goal in a more efficient way?
    Alternatives? Bolt maybe? Self-hosted custom client/server logic?
  • Hey @JohnTube,

    Thanks for your response, exactly what I was after! I'll switch to the Realtime SDK and give it a shot. The 100 players @ 10m/s are idealist figures so not a deal-breaker at this stage.

    Out of curiosity: What happens if the application goes above 500msg/room/second? Will the room end up crashing or just have some latency?

    Finally, don't worry about the "breaking after ~3 players" bit - the system was an early implementation that was just meant as a trial, the main purpose of this question was about the inner workings of photon so I knew how to best write a proper version of what I want to do.

    Thanks!
  • Hi,
    the msg/s limit is not a hard cap, so you can go over a bit.
    Keep in mind
    - mobile clients may get overwhelmed with sending too many messages
    - keep an eye on your used traffic (see pricing page for overage cost)
    - we might ask you to lower your msg/s rate, if your app starts to have any negative effect on the cloud due to msg/s rate
    Best,
    Markus
  • Thanks @Markus, noted!