Skip to main content
GameDev.net gamedev.net
🔒 Locked

Master Server Guidance Needed

Started by Major_N Feb 15, 2007 at 3:45 PM 5 replies 1k views
Original Post
Major_N
Major_N
Hello everyone, The project I am currently working on is my first networked attempt of this scale. Let me explain what I'm trying to do first: A multiplayer beat-em-up game that allows networked co-op. When the player chooses to host a game, a separate application loads in the background that is the server. All clients, including the host, then connect to that server. I'm using UDP, and am in a decent position concerning my updates and multi-player game play (as far as I can test through call back IP). I'd like to set up a mySQL database, hosted by me, that will allow players to register a hosted game and let potential clients retrieve the IP address through a connection to the database. I can also use this global server for NAT punch-through, and to store player profiles that will be displayed on our website. My questions/need assisstance with are: 1. Setting up the global server. Can anyone guide me in the right direction with this? I've read everything I can find on game servers and NAT punch through, but am just not sure where to start in this venture. I really want to make this game as easy as possible for players to get going in their game. 2. Once I get the global server set up, how exactly do I send the NAT punch through messages? I'm pretty sure I understand the concept behind it, but I can't find a good tutorial that really answers my questions. I'm still pretty green at networking, but I really enjoy it and want to become very good at it. Any help or a good point in the direction of where to find some help would be greatly appreciated. Thanks.
graveyard filla
graveyard filla
Do not allow your clients to connect directly to SQL (assuming this is what you mean); this is just asking for trouble. Storing a connection string locally gives your players full access to your database for whatever rights that user has. Even if you encrypt the connection string and decrypt it only server-side, people can easily hijack your connection to the DB and run wild in your SQL.

You should instead, have a server which is constantly running, through which clients connect to retrieve the information. Have that server talk to your SQL Server. Not only does this help with security concerns; it also helps with licensing issues. For example, IIRC, MySQL and it's API's are GPL. If your client connects directly to the database, your client must be GPL'd. This might not matter to you though.

Last, I would just like to mention: I would consider using SQL Server express as opposed to MySQL. SQL Server is a much higher quality database IMO and you get all the great tools that come with it for free.
FTA, my 2D futuristic action MMORPG
hplus0603
hplus0603
To get going, use a DNS name for your global lobby server.

The client first connects to lobby.yourgreatgame.net, port 52997 (or some other known port that you decide), and find people to match make with. Because the lobby server knows the public IP of each player, it's easy to make the hook-up automated.

The main pain on your side is making sure you (or someone you trust) register a domain name, and map that domain name to a known server that is always up. If you can't do that, then you can't provide a "painless" lobbying experience.
enum Bool { True, False, FileNotFound };
Major_N
Major_N
Thanks Graveyard and HPlus. Gave me some stuff to investigate.

HPlus, I have a follow up question. For the server, can I just use a standard hosting company? Or should I set up my own server from home? The actual game server is a separate application run by the hosting player, and I want the lobby to just be a matchmaking service, primarily for NAT punch.

Please correct me here if I'm wrong in my understanding of NAT punch through...
Once I have the public IP of the server and the client, I need to send them each a packet with the IP addresses and then each one sends a message to the other to establish their addresses on the accepted list of the NAT. My question from here, if my understanding is correct how do I send that packet from my server(especially if I use a hosting company)? This is my major stumbling block in my whole grasp of the concept

Thanks again
hplus0603
hplus0603
You can run the lobby on a "self-managed" server in a hosting company; those start at about $70/month and goes up from there. Check the Forum FAQ for some links. You can also host the lobby at home, if you have your server attached to the public network or set up a proper DMZ.

For NAT, see my NAT punching article and the references it links to.
enum Bool { True, False, FileNotFound };
graveyard filla
graveyard filla
Just want to add, unless you have huge volume, or restriction from your ISP, hosting from your home PC should be perfectly acceptable.

Really, doing simple match-making is low bandwith and low performance CPU/RAM wise. You would probably be fine on a standard cable connection with a 'average' desktop PC.

My recommendation would be to host from home at first, and if it proved to be unacceptable, use a hosting solution.
FTA, my 2D futuristic action MMORPG
Major_N
Major_N
Thanks guys for the help! I'm rockin' and rollin' now

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.