Sign in to follow this  
Synex

Multiple server multiplayer

Recommended Posts

Ok, heres the situation. My game is built using a client/server architecture and i'm busy adding multiplayer capabilities to it. It'll run so that you can set up a server, and people can connect directly to it to play the game with you in a semi-persistant universe. Now, when you set up a game server, the game server contacts my web-server and adds a record to the mySql DB, therefore, when the client wants a list of available servers, it connects to the web based mySqlDB, downloads a list and then pings all the servers in the list and then allows the user to connect directly to the server they chose from the list. Do you think this is the best way of doing this, what alternate ways are available, and how do other games usually deal with this sort of problem? Take for example CounterStrike : Source - how do they produce the server-list? You hardly want to start pinging the entire 'net for CS servers... Any ideas?

Share this post


Link to post
Share on other sites
One suggestion: take the web server out of the picture. If you want to check the database, do it directly from the game's code. That way you don't have to wait for the web-server, and the system is in general less complicated (though there's more coding involved).

Another suggestion: Instead of the client pinging each server to find out if it's alive, maintain a list of all the servers somewhere and just ping them sequentially at intervals of X seconds/minutes. That way when a connection comes in, you already have fairly fresh reports on the status of most of the servers.

Last suggestion: Look into the design of how other systems have solved the same problem, for instance P2P networks that need a constant server list.

Edit: Re-reading your post, a P2P-ish structure for your game servers seems like a better and better idea. Instead of each server checking your webserver and adding an entry to the SQL database to show it's there, have each server occasionally talk to the other servers it knows and say "hey, are you still alive? What servers do you know about that I don't? What's your report on the status of these servers?". This makes it so there's no single point of failure (such as your web-server), but if there's maybe three or four larger servers that maintain a canonical list, it's very easy to make and propegate changes.

Share this post


Link to post
Share on other sites
OP's Idea seems pretty solid especially if you're already experience with mySQL why not?

Quote:
maintain a list of all the servers somewhere and just ping them sequentially at intervals of X seconds/minutes. That way when a connection comes in, you already have fairly fresh reports on the status of most of the servers.


Sure you'd know if they were alive, but the point of pinging them(atleast in multiplayer games) is to get the current latency and that would be different from place to place.

And about the single point of failure thing I view that as a good thing, only one thing to worry about and fix.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this