Skip to main content

Maximum limit of synced gameobject/message data

Key Problem

UploadWhen object in 1 scene is very massive, how to sync all gamobject when there are some limitation for maximum message / gameobject to be synced

Expected Output/Definition of Done

Able to limit synced massage

Key Solution

  • Cited From @Steven Chin answer regarding this subject. (here for the pages ).

    Use Area of interest, so object that are far away (or in a different interest group) should not be replicated message sent should be 1 message/tick/connection on the server (assuming message is not fragmented because of size). by default any object that has no data changes should not be replicated, so this is not a problem other than this, you have to ask photon to increase the message limitation

  • Cited From Photon Fusion Glossary about Message.

    Messages are in general anything that updates someone else or does something on the server.

    • In Photon terms: All Operations, Responses and Events are messages.
    • In PUN terms: All RPCs, synchronization updates, Instantiate calls, changing Custom Properties (including PlayerName) are messages.

    Sending an Event (or RPC) to all other clients counts as one message per player in that room: One send, the others receive.

    PUN is special, because it tries to aggregate updates by  OnPhotonSerializedView. If possible, the updates of several objects are aggregated into one message. Also, the observe mode affects this: "Unreliable On Change" stops sending anything when the GO doesn't move between updates. In Progressworst case one object can cause 10 messages per second per player. That's not common however.

    We limit the messages (updates) per room and per second for two reasons :

    • Things break when you send too many updates. There is no fixed cap though. This depends on traffic, devices, etc.
    • make sure everyone has a fixed slice of our shared servers.

    The messages per room and second are shown in the Dashboard.

  • According to this page in Load Balancing section, messages are limited to up to 500 per room, and the only way to increase it is by directly contacting photon to remove the limit. As for optimization, a better designed system (e.g., sending message only when required, minimize usage of RPCs, do synchronization when needed, etc.) should do the trick.

  • As for the size of message itself, here are some recommendation from photon

    Cited from here, scroll to Can I Send A Huge Message Using Photon? section.

    • For messages that get sent very regularly (10 times a second or even more often) we would recommend to keep their size below 1KB.
    • If a message only get sent rarely (for example once at the start of a match), then a size of multiple KB is still fine, but we still would recommend to keep it below 10KB.
    • In exceptional cases something like 20KB or even 50KB might make sense. But usually messages that big indicate that there is something wrong and you should review what you are doing and reconsider your options.
  • As for photon recommendations regarding message size, please keep in mind what kind of game is about to make, sometimes a couple of bytes per network object isn't enough.

  • Client shouldn’t sync all player, only sync relevant player, those who relevant can be determine using Interest Management. this way, can be count as optimizing message size.

  • As for optimizing message size, both Interest Management, and for extends, Interest Groups, reduce message size by performing network culling, restricting data that can be send.

  • Fusion has built-in network stats, useful for tracking network-related stuff.

    https://youtu.be/8aSqqjVpaIQ