[Multiplayer] How do I calculate total downloaded data size

0 favourites
  • 10 posts
From the Asset Store
Cue in the war drums and battle cadences with Total War Game Music Loops!
  • [quote:uih1xnrd]StatInboundBandwidth

    StatOutboundBandwidth

    Return the total estimated inbound and outbound bandwidth for all data transmission through the Multiplayer object, in bytes per second.

    StatInboundCount

    StatOutboundCount

    Return the total number of separate inbound and outbound messages sent and received by the Multiplayer object. This includes internally-used messages for things like ping and synchronisation; generally the bandwidth is the more practically useful statistic.

    Above is the excerpt from the manual, so what I'm trying to achieve here is calculating the total size of transferred data. I'm not sure whether this is doable or not, I've been trying, it seems I never get the math right for some reason/limitation. I've used events like every 1 second and all condition I can think of, but never seems to be plausible.

    I need to start fresh with the math, so can anybody throw me some math expression to calculate this correctly?

    Note: This is none important for game mechanics, but I think it will be useful to gauge the requirement of your game in terms of bandwidth. This is not an issue if the game is PC based, but for mobile, it might be important to gauge some game that throwing array.asjson in and out since mobile sometimes are limited in terms of available transfer quota. Think of Clash of Clans, it's the only game I play on mobile, and it can easily go over 500mb in a month of play.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • come, on guys give this dude some help, he really was specific...

  • Ashley is this possible to be done mathematically using the 4 available expression?

  • Just add up the estimated bandwidth every 1 second. It will be an underestimate since it measures only payload and not WebRTC/transport layer overhead.

  • Just add up the estimated bandwidth every 1 second. It will be an underestimate since it measures only payload and not WebRTC/transport layer overhead.

    Oh I already did that, it just that the values are wildly inconsistent with marginal different more than 70%, so I thought there are more consistent way to measure it. Btw, this is just 7 sample of full gameplay of similar sequence/action.

    I guess taking average of 200~500 sample and traditional statistical math is the way to go after all.

    Nonetheless, thank you for the response.

  • All it does is add up the bandwidth in/out in bytes in the past second, and since the value updates every second, accumulating it every second should give you a reasonable value of the bandwidth as measured by the payload.

    What is it different by 70% to? What else are you measuring it with?

  • All it does is add up the bandwidth in/out in bytes in the past second, and since the value updates every second, accumulating it every second should give you a reasonable value of the bandwidth as measured by the payload.

    What is it different by 70% to? What else are you measuring it with?

    This was a (max - min)/average difference from 7 game session with identical end game result. My test case are similar in all action. The 70% came from peerX, but peerO is much more consistent.

    game1: peerX=944kb;peerO=810kb
    game2: peerX=657kb; peerO=799kb
    game3: peerX=798kb; peerO=992kb
    game4: peerX=1314kb; peerO=1009kb
    game5: peerX=853kb; peerO=853kb
    game6: peerX=1204kb; peerO=1115kb
    game7: peerX=714kb; peerO=840kb[/code:2t00soo3]
    Setup: 
    DuelHost: Chrome
    PeerX: Chrome
    PeerO: Opera
    
    My thought is the every 1 second can miss some of the kb/s information, possibly the reason some values doesn't add up. Anyway, another related question, is the information of kb/s [u]exist for the whole one second[/u]? If it does, the math I did should produce a very small different in margin which I think around 10% should be the largest difference.
    
    Do you think different time spent in a session would affect the calculation largely? Example I spent 10minutes on game1 but 8minutes in game2 even though I act similarly on both game.
  • Problem Solved.

    It seems that time spent on game does affect the calculation, because of some deep-rooted peerlist checking event I did months ago that I forgot it exist, because it's not logged, silly me. Disabling that portion gave me quite consistent result especially for inbound (<1% margin). Outbound still fluctuate a bit but I guess that is due to some packet losses when tested on 3G connection, and the client retry to send the packet, which adds to the outbound total. So far results from steady home internet gives me the most reliable result, I can almost conclude that there are almost no packet losses on steady connection, this gives me confident to continue heavily on the project, MP plugin is great, kudos to Scirra!

  • I wouldn't expect the bandwidth use to be deterministic. Expect variations even for identical runs.

    Retransmissions happen at the OS layer and won't be counted by C2's stats. That just tells you how much it tried to send and how much it finally received, not counting whether one of those packets had to be retransmitted 10 times, or even if it got lost completely (it still will have counted the outbound bandwidth because it passed it to the OS network layer).

  • I wouldn't expect the bandwidth use to be deterministic. Expect variations even for identical runs.

    he test is done with single device (laptop) with just different browser, I haven't done any test between 2 different network, which I plan to use my 3G dongle and home internet (HSBB fibre optic), I think the variation is very small because of the connection is from the same network that it took the LAN advantage. Should I be expecting bigger variation if I use different network? I'm thinking yes.

    Now I just need another PC to test 2 different network.

    it still will have counted the outbound bandwidth because it passed it to the OS network layer.

    hh that's explain the result fluctuation for outbound. Thanks for the info!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)