How to measure latency / ping?

Godot Version

4

Question

How to measure latency / ping?
So the problem im dealing with right now is that its not measuring precisely. Pinging machines on local network takes as long as pinging machines many countries away (in other games).

For example, using the example MRP you run it and depending on your machine, in my case im getting around 17ms of latency between the packets. I tried this on faster computers and its less, then i tried to separate the client and server into separate apps, running on low spec machine server gives me high pings (80-100ms) on high end client, while running server on high end pc gives me around (5-8ms) pings on low end pc. All computers are in LAN.

You can see my progress here How to measure precise packet times? - Godot Forums

Also you can find the MPR over there cuz i cant upload it here

Looks like it’s just a delay between frames. If you disable vsync in the MRP the latenxy is 0ms-1ms on my machine.

On fast machines it will show low latency while on slow machines (that i have tested on) it still was around 8ms with disabled vsync. I tried that yesterday with varying results

P.s.
if you follow that godotforums link, i have just posted a sort of solution, where we use a separate thread to poll (server node) and get_packets (client node), thus achieving 0 -1 ms on slow machines.

I havent tested this over internet, just in local network. Not sure if its correct

Did you check what the FPS was on the slow machine with vsync disabled? I’m surprised it would be that slow on an otherwise blank project.

No i dint not measure, but would say that it was around 60fps.

Anyways the problem is slowed in that godotforums post ive linked in the OP post. Solution was to use a thread for polling and get_packets functions.

1 Like