1
\$\begingroup\$

I have made great strides in creating a custom built server browser for UDK. It registers servers with a master, and the client can download the list and populate the server browser.

However I'd like to tell users the ping of a server in the server browser. I know PlayerReplicationInfo has a server check native function, but that only works when the player is actually connected to a server.

I want to ping check a server without joining it, and then collect the data to show to the player?

Is this easy to implement? Hard to implement? Maybe it's a waste of time because of the time required to ping all the possible servers? If it's easy to implement how can I do it? Do I need to make a custom TCPLink class that counts the time it takes for a message to go back and forth?

\$\endgroup\$
1
\$\begingroup\$

I'm not used to UDK, by the way I'll try to answer your question at just a theoretical level. I'm trying to implement network games in a project of mine, and found out how to let client ping check servers without actually joining games. Also, this is an intuition from Halo:CE network code.

Let's suppose the central server browser has a list of servers, these info are ready to be sent to requesting clients. When a client wants to browse servers it actually only gets a list of IPs to check for: for every IP, the client sends a data packet to that IP (which is the address of a server currently running a game) with a data message to request server info, such as server name, game type, map name, no. of players. Also, client sends its timestamp attached to this packet.

When a server receives such packet, it sends back another packet with the requested info: server name, game type, map name, no. of players; then CLIENT's timestamp from previous client's packet is attached to the new packet.

When client receives server's response back, it can show in a browser window these info, plus round trip time (RTT) to that server, which is: RTT = current_timestamp - old_timestamp. You don't need to store old timestamp, because you're getting it back from the server itself.

All this can be done without having a client joining a game by using UDP connection protocol: you just have to set up a different port for "ping" information exchange, and set up some raw packet messages to be recognized both on server-side and client-side machines.

HCE works this way, I guess: client only asks central server for a list of IP, then every single IP is sent a packet to get information about current game running and ping value relative to the client. When refreshing servers list, clients ask server browser back for a new list of IPs to check for.

FYI servers can use two ports: a port client_port (this is no code, just a generic variable name) is used to sync the current game with connected clients; then another port server_port listens to incoming packets from clients which want to ask server "Who are you? What game are you running?" and answer these clients back.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.