Author Topic: Elegant practice for Ping values for servers listed in the lobby server list  (Read 2374 times)

EdLan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Hi @all

Currently I want to add in my server list (where the clients get from a centralized lobby server) an individual ping value which shows the ping value between client to another remote host.

Imagine following scenario:

- One centralized lobby server which is located for example in the USA
- One player which starts a game server to initiate a multiplayer game. This host will announce itself to the lobby server mentioned before. This player is located for example in Europe.
- Another player, which is also located in Europe goes trough the server list lobby and wants to pick a server with a low latency time.

In this situation it's very likely, that the two players which are both located in Europe will have a low ping latency.

But how do I get this ping value without connecting each server from the lobby server list separately with a TNManager.Connect(abc),  TNManager.ping and then last but not least disconnect with TNManager.Disconnect()?

Isn't there a more elegant way? I was considering a sum of the ping value from player A to the lobby server and summarize it with the ping value of player B to the lobby server. But this solution would definitely not reflect the "real world" situation when we look at the scenario mentioned before, because the latency between both players located in Europe would probably be much smaller when they would connect directly compared to the sum of both ping values (ping from player A to lobby server summarized with player B to the lobby server...

Has anyone a nice solution for that without connecting to each game host separately?

Cheers, EdLan

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
That's a tricky one. If you want an accurate ping, then you need to have the player ping the actual server, meaning you need custom logic on the server to receive and respond to ping requests. How you do it is up to you, but I recommend having a UDP listener on the server that will receive and respond to ping packets, and time the delay between the time the packet is sent out, and when the response comes back.