Bandwidth Usage MUCH Higher Than Expected (x4!)

Options
Hi,

Short Version
I am expecting 390 Bytes / second based on syncing a single Vector3 in my game using a send rate of 30 between 2 characters (only one moving at a time).

What I am actually seeing is 1700 Bytes / sec, measured using two separate tools (included NetStatsGui script and 3rd party Netlimiter program).

Long Version
I have setup a simple test using PUN in my game, I am testing with just two players (one on PC and the other on my phone over Wi-Fi). Each player has a single PhotonView paired with a single Photon Transform View that only synchronises the position.

For these tests I was using a sendRate of 40 and a sendRateOnSerialize of 30. These numbers will likely be a lot lower in the actual game, but I am playing around with things for now.

I would expect the data sent to be:

(sizeof(data) + extra packet information) * sendRateOnSerialize

I don't know how much overhead a packet adds, but I'm assuming it's not much... let's assume it's zero for now.

I also couldn't find the data size of a Vector3 in the docs at https://doc.photonengine.com/en/realtime/current/reference/serialization-in-photon
but I've extrapolated from the float size and guessing a single Vector3 is 13 bytes.

So that gives us 13 * 30 = 390 Bytes / sec

To verify this, I tried to use the PhotonStatsGui over a 10 second window. I can't read the Stats on my phone screen, so the numbers below are just from the PC client on 2 separate run throughs, one where it was the movement sender and the other time the movement receiver. They roughly agree with each other and gives an average of 1800 Bytes / sec of data being sent/received.

Outgoing (10 secs)
TotalPacketBytes: 17438
TotalCommandBytes: 14774
TotalPacketCount: 222
TotalCommandsInPackets: 228

Incoming (10 secs)
TotalPacketBytes: 19220
TotalCommandBytes: 164484
TotalPacketCount: 228
TotalCommandsInPackets: 243

Given that these numbers are so far from my estimation, I thought I would sanity check the numbers in the Stats script using NetLimiter. This tells me it's between 1700 and 1800 Bytes / sec. When nothing is moving it is between 30 and 50 Bytes / sec (expected due to keep-alive)

So, it looks like it really is sending about 1700 Bytes per second when I think it should only be sending about 400 Bytes / sec, why is it more than 4 times the amount?

Am I missing some fundamental knowledge here or is something broken?

Thanks,

Niall

Comments

  • nindim
    Options
    @Kaiserludi @Tobias

    Hoping this hasn't got lost through the cracks... :)

    Maybe this isn't a bug, but rather me misinterpreting how to calculate the data. If it is a bug though it's a fairly big one ;)
  • Kaiserludi
    Options
    Hi @nindim.

    A Vector3 is 16 bytes as it is a custom type and as you can read on the page that you have linked, those have 4 bytes of overhead + the payload, which is 12 bytes in Vector3 case.

    Also as you can see at https://doc.photonengine.com/en-us/realtime/current/reference/binary-protocol, there is quite some overhead for the protocol (UDP header + enet package header + enet command header + the operation itself), which is certainly bigger than those 16 bytes of payload.