Calculate messages per second.

Options
Hi,

I'm want track the messages per second of my game, but the only way that I have found is checking the analytic panel in account dashboard of your web site, so I'm trying to calculate it in run time, investigating in the documentation and the API I encounter with 'TrafficStats' and 'PhotonNetwork.networkingPeer.VitalStatsToString()' which return some important info, the thing is that I'm not sure what these info means, so maybe you guys can clarify me,

TotalCommandsInPackets
Calls of Send
Dispatch (return 2 parameters with this name)

so basically what I wanna do is check what of all these parameters are the messages that are outgoing and compare it in a interval of 1 second.

Or if you guys know another method to check the messages per second in run time will be great.

Regards.

Comments

  • Tobias
    Options
    As you're working with PUN, you could look up the PhotonStatsGui. It makes use of various values, available from the client and it can be used to display the messages/sec value on the client, too.

    TotalCommandsInPackets counts the (low level) commands in packages. Commands include ACKs, but they are not counted as messages.

    Calls of Send equals SendOutgoingCommandsCalls, which simply counts how often the method was called. It's a value that helps debugging: Without calls of SendOutgoingCommands, the client won't send anything, so if this doesn't go up, the game's logic fails to continuously integrate Photon in it's game loop.

    Dispatch shows DispatchIncomingCommandsCalls is a similar value but for the incoming messages. If this isn't called, the Peer will just queue incoming messages and not drive your (network) logic.

    With PUN, the latter two value are only of interest, should the client run into issues. Typically PUN manages the calls to send and dispatch for you.