(warning, long post)
Actually, that does make sense. However, isn't this just introducing another step in the system by adding in a webserver that hosts the webpage? I guess the good thing would be that you can limit your bandwidth to our own game-server and instead route everybody to the web-server.
At first I was thinking of a completely PHP based system, but I couldn't figure out how to keep track of disconnected servers without using big database purges, which could make the whole system slow, and we'd be getting calls from our web host
Currently I changed my mind a little bit from the original post, now I am thinking of never sending a big list to clients at all, so the bandwidth should be no issue anymore. Instead I give the option to query for a server (for example by name, location, etc.), or simply by quick-matching (no query options, just find one). That way I can just a short list of max 5 possible servers or so. The only thing I would need then is more CPU to process all the queries on the master server side, but that is quite easy to scale up if needed, you just buy more CPU's..
As a side-note for people who are interested in this subject, I've found out a bunch more things (some may be obvious, but they weren't to me!
)
- NAT's (network address translation, something that routers do for you so you can have multiple computers on the same external IP address) are a problem, but there are ways around them. UPNP is a way to communicate with your router through udp, and with this you can request certain ports to be opened up. There are several pages with info on this, one of them on codeproject.
- STUN servers are another way to get through a NAT. What a NAT does is basically remember what local IPaddress sent a message through what port. Then if traffic comes in on that same port, the NAT will forward that message to the local machine it remembered. So the problem is that if computer A randomly tries to connect to computer B through a NAT (on B's side), the NAT will get a message with a port that it hasn't recognized before, and therefore doesn't know where to send it. It basically just drops the message. However, if computer B was recently sending data through that port, and now computer A tries to connect, there is a chance (depending on the type of NAT) that the NAT still remembers that traffic on that port needs to go to B, and lets the message through. So how do you get B and A to send messages at the same time to each-other? This is where the STUN server comes in. The STUN server is a separate server with an IP that is known to both A and B. So if B is connected to the STUN server, and A tells the STUN server that it wants to connect to B, then the STUN server will start sending messages to B, after which A will start sending message to B as well, with the hope that the NAT still remembered where the messages went, and in that way will get through the NAT. Again, this depends on the type of NAT through.
- Because there is a master server that keeps track of all the games being played, this server can act as a STUN server in case one of the clients does not have a UPNP compatible router, and in this way a NAT punch-through can be attempted by blasting packets at each-other and hoping that the NAT's have still remembered the routing to the local machine. We'd need to have our master server sit on a static IP for this though, but we were planning this anyway.
- With UPNP and a STUN setup, you still won't get through all NAT's, but you will get through most home-routers. Hey you're not supposed to play games at work anyway
Side note 2: We're NOT trying to make an MMO if this is what you're thinking. We're just trying to make a game that is playable online, much like the quake setup where you can see a list of servers and join one.
Cheers,
Nick