This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

calculating ping time for a game

0

hi,

i need to graph the packet delay for a game called league of legends, the game uses udp and a port range between 5000-5500. im pretty sure that the delay time is calculated from the udp stream, see explanation in the link at the end. inside the game you can see what they call ping time in ms, but how they measure that im not sure.

from a 2000packets capture midgame ive already calculated the following times(script at the end):

between first and next client packet
between first and next server packet
between client packet and next server packet

but all these come up with less then 10ms, normal ping time for the game is 20ms. do you think they calculate ping time on the server side and send the ping data back with the game data?

this is why i belive that ping time is calculcated from the UDP packets: i used the HSFC traffic shaper class to make sure ping is calculated from the UDP packets the game uses for data traffic. other ports/protocols are used as well. for that i created two classes: 1:20 and 1:30, 1:20 holds the lol packets and a scp stream if started. 1:30 is the catch all for the rest.

if scp isnt running league of legends (lol) ping is fine, if http(1:30) is downloading in parrallel with ~200kb/s as expected lol ping is fine - now if there were some other data connection that does not fall beween in the games udp port range ping would spike because of the http download. now with a running scp download ping goes up to at least 100ms, normally its 20ms.

traffic shaper / python code to calculate packet times: http://pastebin.ca/2467393

tcpdump file: http://www.file-upload.net/download-8186822/lol.pcap.html

asked 16 Oct '13, 15:43

newusergreek's gravatar image

newusergreek
11225
accept rate: 0%

edited 17 Oct '13, 00:39


3 Answers:

2

do you think they calculate ping time on the server side and send the ping data back with the game data?

Leage of Legends seems to use an 'in protocol' ping command (and protocol). So you need to understand the protocol to be able to calculate the same 'ping time' that the game client shows. This includes:

  • identifying the ping request command in the protocol
  • identifying the ping response command in the protocol
  • calculating the delta time with or without time stamps in the protocol (if available)

Fortunately there is a dissector for the Leage of Legends protocol.

http://code.google.com/p/packet-lol/

Unfortunately, that dissector is not part of the official Wireshark code base. So, if you want to dissect the protocol, you need to add that code to the Wireshark code and compile your own version.

Please contact the original author of that dissector (see link above) for any further information how to build it, how to use it and what version of Wireshark it is compatible with. Maybe they can also provide a binary version of Wireshark that includes the dissector.

Regards
Kurt

answered 16 Oct '13, 16:35

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 16 Oct '13, 17:10

this is why i belive that ping time is calculcated from the UDP packets:

yes it is, with the internal ping command/protocol (see my answer). Your way to calculate the response time will create wrong results, because:

See the following command/response sequence of the Leage of Legends protocol (UDP frames in and out).

cmd1,cmd2,resp1,cmd3,cmd4,resp2

cmdx is: client -> game server UDP outgoing respx is: game server -> client UDP incoming

What you calculate is: delta(cmd2,resp1) and delta(cmd4,resp2)

However, resp1 is totally unrelated to cmd1 and resp2 is unrelated to cmd4.

You cannot use just the UDP packets for the calculation, as Leage of Legends has its own protocol on top of UDP with commands, responses and internal time stamps.

So, as I said in my answer you need to understand the Leage of Legends protocol to be able to calculate the correct 'delta'.

(17 Oct '13, 01:38) Kurt Knochner ♦

yes, i knew that i didnt knew which response came in to what packet. i just guessed.

(18 Oct '13, 11:41) newusergreek

0

I would guess you're measuring round-trip times, and the in-game UDP measurements are one-way measurements. Typically, this is how financial market data latencies are measured (using one way) since UDP is unidirectional.

answered 16 Oct '13, 19:25

hansangb's gravatar image

hansangb
7912619
accept rate: 12%

0

Hi, I don't know what you need this for or what your intentions are, but there is a very simple way to do this using a program called Bot of Legends.

This program injects itself into League of Legends so it is able to grab things like ping fairly easily (among other things you're probably not interested in). As an example here is a script for avg ping (it's in lua): https://privatepaste.com/e75dfe18a3

answered 26 Nov '13, 05:07

NewGuy's gravatar image

NewGuy
1
accept rate: 0%