Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Photon Networking Traffic Reduction

Discussion in 'Connected Games' started by JayKamat, Jul 19, 2019.

  1. JayKamat

    JayKamat

    Joined:
    Apr 30, 2017
    Posts:
    3
    Hi,
    We were trying to reduce the photon network traffic for a game we were working on. Our current game has a sendRate and sendRateOnSerialize values of 10. We are also using Unreliable instead of Unreliable on Change as of now. Changing that did help a bit, but in a case where players are continuously moving we needed further traffic reduction.

    We were using OnPhotonSerializeView to send 5 short values which should result in a data packet of 15bytes (3 = type_info(short) + sizeof(short) per short).

    We wanted to optimize our total network traffic shown in Photon Stats GUI by further 40% so decided to send only an int and a short which should result in a data packet of 8bytes (5 for int, 3 for short).

    Our total network traffic after the above optimization seems to be reduced only by 7-10% when we were expecting about 40%. Isn't sending a different data type with a smaller size an important multiplying factor adding to network traffic? . Can we know what other major factors may affect the total network traffic shown in Photon Stats GUI.

    Thanks,
    Jay Kamat
     
  2. JayKamat

    JayKamat

    Joined:
    Apr 30, 2017
    Posts:
    3
    Hi, anyone has any suggestions regarding saving all this network traffic?
     
  3. tcmeric

    tcmeric

    Joined:
    Dec 21, 2016
    Posts:
    173
    Try simple sync, which has built in compression for photon sync transform, as well as comes with a bit crusher included that can be used elsewhere. I am certainly no expert on the subject, but the creator of this asset is pretty helpful via email. https://assetstore.unity.com/packages/tools/network/simple-network-sync-134256

    Also consider using network culling as needed, by creating groups in PUN.
     
  4. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    77
    Well, the reduction of the data you're sending is around 40% but the generated network traffic comprises more "stuff" than that. Stuff such as the ENet protocol overhead, UDP header, IP header etc... Which is why the measured traffic reduction looks smaller, imo.
     
    Joe-Censored likes this.