[SOLVED] How to detect running servers?

Hi monkeys! So, I have a question:

How do I detect running servers of my game? Like, in TF2, there’s a list of servers to choose. Do I manually ping to every port, or create a master server which has a list of all runiing servers… How do I do that?


Master server, yes.

So, basically, I create a master server, in which every client connects. Every server the community wants to create must be registered in this server. Then, the client request the list of available server.

Am I right?

That’s right but the client doesn’t really have to be connected, i’d make it connection less using udp or even REST (then you can use free webhostings :D)

I would maintain a List of Servers and keep track of their timestamps.
Every gameserver needs to contact the master server every minute, if the master server didn’t get that pulse after 90s, the server is considered down.

Don’t save too much params in your master server to reduce traffic and power. Update player counts and map names with every 90s pulse and pass that to your players.

Maybe you can even only return an IP List and the client querys every gameserver on their own (But that might be slow)

Thanks for the replies, @Darkchaos and @normen!

In fact, the master server is likely just a web server with some REST call that returns JSON for the clients. That’s how I’d do it.

If the client needs to know local ping times or something then it will have to contact those servers itself no matter what. (Ping time from master server to some random server doesn’t really mean anything to you if you are on a dial-up on Guam.)

Hear, hear!

You can also have a dynamic list of servers and implements a p2p system where every server can give a list of ther servers to the clients. So, you’ll need only one server to start and from that you’ll have a growing list of available servers. It’s a bit more work, but not that much and it will allow LAN (if you plan to distribute both the server and the client).
I am also working on an other system to detect near (physically or time-to-live-ly) clients, with a system where every client is a server and every message shared between computers are just hints. You know, just like kids when they play cowboys “i killed you/no i killed you first”. No big boss, only computers and people playing together is they agree to do so.
But this solution is something you must integrate when you start to developp the game, not later. The first approach with the dynamic list is less instrusive.

You still need an initial list of nodes where to connect to with a p2p system, so the list can be updated at all.

No, if you have a system that detect near servers you don’t need an initial list at all. You also can just add an empty field to add servers and an empty list, people will look for address in forums and websites (but nothing is hardcoded, so if the main server shutdown new users won’t have problems). Even the process of “looking for informations” could be automatized (an http request to google/yahoo/bing etc and parse the result and extract servers from there. So, if the main server shutdown it will be dereferenced etc)