Picture the scene: You’ve written a multiplayer game that actually works: people can start servers, other people can connect, it’s all good. The only problem is server discovery - to connect to a given server, the client needs to know it’s IP. This is annoying.
Happily this problem is easy to solve: You have one machine that everyone knows the IP of that keeps track of all the servers - the metaserver. When a server is started, it registers itself with the metaserver. Clients can connect to the metaserver and download a list of active servers.
The downsides of this approach are:
- The metaserver needs to be constantly available and either on a static IP or have a DNS entry. This stuff costs money.
- Scalability. Your game gets released on Steam and you underestimate the strain that is placed on the metaserver by the additional demand (witness the Defcon launch). Your new users get pissed off and your metaserver explodes, killing your family.
So what to do if you need metaserver functionality that scales, is always available, is free, and probably won’t kill anyone?
I would suggest taking advantage of Google Base. This is a service that allows anyone to upload data, tag it with arbitrary attributes, and have it indexed and made searchable by Google. There’s even a Java API.
The game servers could upload their details to Google base, and clients search the uploaded details. All the hard bits are done for you by Google.
The only problem that I can see so far (apart from the need for server owners to have a google login - hardly onerous) is that of latency between entering details into Google Base and them showing up in search results. The FAQ advise that items can take up to 24 hours to appear, but do not mention the latency for changes to the attributes for already-submitted items, or for changes to the submitted data. I’ve submitted a question to get a feel for typical latencies, but had no reply so far.
At any rate, The possible scenarios in worst to best case order:
All changes take 24 hours to take effect - would still be useful for dedicated servers with long uptimes, but not so much for transient servers running on a client machine. Volatile data about servers (active status, currently connected players, etc ) would have to be gotten directly from the server.
Submitted data changes quickly - Volatile data can be put in the submitted data item, reducing load on the servers.
Attributes change quickly - Bandwidth usage is reduced as volatile data can be moved to attributes.
Everything happens instantly - utopia
Additional benefits besides the cost and quality of service:
- Search capability : Ever wanted to search the Steam server browser for that server name you can’t quite remember? Now you can. There’s also cool stuff like geographical searching.
- IP changes : Every item in google base gets a fixed URL, so you can move the server’s IP without worrying about losing all your regular players
- Now that everyone needs to have a Google login anyway, you can use their Jabber servers for instant messaging
In a similar vein, high score servers can also be replaced. Just have each user submit their high-scoring game recording to Google Base, tagged with the score and perhaps some kind of game-specific hash for quick verification. A simple ordered search will give you the list of candidates to verify.
I await a reply to the latency query with interest…
Any thoughts? Is this ripping the piss out of Google just a little too much?