   Starcraft-like server design
  HelloI want to know how a starcraft battle.net-like server program could be designed.I guess all users connects to the server using TCP/IP and when a game actually starts they switch over to peer to peer and UDP? (If everyone is behind symmetric NAT a relay server is required as well?)on battle.net it is possible to write message to anyone online so I guess the connection to the server stays alive until the user quits battle.net? And I guess this also can help to keep track of players losing their connections to the internet?I have no idea about number of users but for example.. is it realistic to have a server program maitaining 1000000 users everyone with its own TCP/IP connection using berkeley sockets? are there any alternatives?Thanks in advance   
Quote:Original post by ProblemBabyI have no idea about number of users but for example.. is it realistic to have a server program maitaining 1000000 users everyone with its own TCP/IP connection using berkeley sockets? are there any alternatives?Most servers nowadays use completion ports. This means IOCP in windows and Epoll in linux. You'd probably see performance problems with BSD sockets.Also your idea of users using TCP until the game begins then switching to P2P is a sane idea. It doesn't necessarily have to use UDP. I'd actually presume that you'd want to use TCP just because you don't need UDP at all. Lock-step simulations as described in the 1000 archers article kind of assume all the packets are reliable.If your game wasn't as CPU intensive and you just wanted a few games at a time (like 250 games of <8 players) I'd suggest running the game as rooms on a single server. It's an easier starting point probably since P2P can be odd.Also I hope you're joking with "1000000" users on a server. That's not going to happen... ever. Unless you hope 99.5% of users are in rooms and not connected to the master server. If your server went down then came on it would be looking at hundreds of thousands of connections. I think the techniques for achieving that scalability aren't well known so I won't guess. If you distributed that across a few fiber lines and servers you might be getting somewhere.[Edited by - Sirisian on May 26, 2010 9:32:32 PM];  Thanks for your reply! Quote:Also I hope you're joking with "1000000" users on a serverIf I want every user to be connected to the master server (network of servers) to be able to send private messages to any user at any time or to find out stats of other players for example. How many connections per server computer is realistic now a days?Thanks;You *can* have 1,000,000 users on a server. You "just" need enough RAM, and you can't send a message too often to each server (say, one small message every 10 seconds).Realistically, though, modern game systems use a multi-tier approach, where users connect to front-end nodes. Those nodes are either game zone servers in their own right, or they dispatch to game zone servers where subsets of users share state and interact. Finally, there is some kind of connecting fabric that makes it possible for user A to send a message to user B, even if they're not otherwise interacting. This may need some registry, for example, showing which users are online and where they're at. Typically, such a registry is implemented on yet another kind of server node (or even federated/sharded -- one node for usernames starting with A, another for B, ...)