Service() Frequency

Options
Since the Service() function is responsible for sending outgoing property updates, it seems you would often want to call this on a per frame basis - so possibly at a rate of 60 Hz or more. But I noticed the comments on the function in the Realtime SDK suggest calling it 2-20 times per second. The docs online suggest calling it 10-50 per second. Are these suggestions arbitrary or is there a reason you shouldn't call this at frame rate if above 50?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited August 2019
    Options
    Hi @minotter,

    Thank you for choosing Photon!

    We will align the documentation to have the same values.
    The reasons for not calling Service() too often is to avoid exceeding the soft limit of 500 messages per second per room.
    This is also proportional to the number of players per room.
    Also, I believe the new Photon Realtime SDK for Unity, if you are using that, has a ConnectionHandler that no longer calls Service() but calls "its inner methods" DispatchAllIncoming and SendAllOutgoing separately.


    EDIT:
    my colleague @Tobias suggested rectifications:

    - The number of messages per room per second is proportional to the number of players per room. (I did not mean to say that the number of calls of Service() is proportional to the number of player per room)
    A lower send rate does not change the messages/sec.
    It helps aggregate messages in less datagrams, which is less traffic and overhead.
    Aside from anything the game logic writes, there are also acks to send as reply, etc.
    Due to that, writing messages in fixed intervals does not guarantee a certain amount of datagrams.
    You would want to "send" whenever the logic produced and update for the others.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    We have synchronized and adjusted suggested values in different places to the value of "10-50 per second" for the number of Service method calls.