What a server should look like

Started by
2 comments, last by stormwarestudios 11 years, 3 months ago

Hi, I'd like to see a talk on what a server should look like if you want to make a game.

This is a topic that has probably been posted a thousand times, but there is no òne answer. There are virtually unlimited possible server implementations when you think of different combinations of hardware, OS, softwares and type of game.

In a single player game most games will use the game client as the host itself. A few single player games will seperate the host from the client.

When we step in to the realm of multiplayer we start asking "who will host this game"? If you play with friends on a LAN, you may have the guy with the best PC to host the game. In some LAN instances you may have a dedicated PC as server and players will join it.

When we start talking FPS games with 16+ players there will be hosts "on the net" that players meet on.

Then we have DOTA and StarCraft type games, where millions of users might be in a lobby waiting to be hooked up with a group of players.

I guess on the top we have MMO games, some games might require the server to handle thousands of players on the same map.

What I want to get out of this topic is an overview what type of server requirement will a game have. Let's forget about LAN games where a PC can host and focus on 16+ player type servers.

Here is a template:

Type of game: FPS / Strategy / MMO

What is needed between the packages you send and the packages you receive?

Required connectivity: Bandwidth / Simultanious connections

Required Hardware: PC / Xeon CPUs / Rack / Special purpose HW / Tesla GPUs

Required OS: WinXP / Win7 / Win Server / Linux

Required Softwares: SQL / Network / Host applications, threads etc
Advertisement

The FAQ has some pretty good pointers already.

enum Bool { True, False, FileNotFound };

What I want to get out of this topic is an overview what type of server requirement will a game have.

[/quote]

To quote yourself, "there is no one answer", and there never will be.

There are no set answers to the components of your template, but I can maybe suggest ways to determine them. It's easy to answer "it depends" for each category, so I will try to offer something a little more insightful. smile.png

Type of game might have influence over the packet communication protocol you develop; if the game is realtime, your packet design might be aggressively optimized to minimize bandwidth usage. Conversely, a low-traffic game can be more loosey-goosey with packet design optimization.

Typically, clients will be requesting permission for things, whereas the server will be either responding to permission-requests, or simply updating the state of something as it sees fit. For example, a request from a player to move his avatar comes from a client; the server will respond with either (a) yes, or (b) no; in the case of (a) he will likely also update other clients with the new position of your avatar.

Required connectivity is sort of unclear. More bandwidth is better, obviously, but (briefly) your server will need to be able to sustain, at a base minimum, a per-second send-speed at a rate R dictated by the largest packet byte size S, multiplied by the largest number of hosted clients C, multiplied by a minimum operations-per-second threshold T. For example, where S=100, C=16, T=30, then R=46kB/s.

Required hardware is a mixed bag. Given the required S*C*T from above, the CPU shouldn't choke for particularly complex operations, or hang while managing something else in the OS (for example, a database, or an antivirus program). More importantly, your application should try to take advantage of hardware offerings (multiple processors, or CPU-specific features du jour) , where applicable.

Required OS is determined by what your developers are familiar with targeting, what your technology development stack is compatible with, and what you want to pay for. An environment like Cygwin provides many UNIX-like functionalities on Windows hosts, and likewise environments like WINE offer Windows-like environments on Linux. .NET development is (arguably) more accessible on a Windows host, and languages like C, C++, Java, and PHP are everywhere. Servers should strive to utilize system resources as minimally as possible, hence servers which run in a console (i.e. GUI-less, or headless) could be considered a commonplace design. And in situations where a game-server attempts to be online at all times, it might be installed as a service on the host, available upon startup in the situation where the server must be (or is) rebooted.

Required software depends on the technologies employed in your game server, but minimally you need a communications layer (HTTP, WebSockets, plain-old TCP socket server, UDP server, or something in between like ENet), a database (MySQL, MS-SQL, PostgreSQL, SQLite, Oracle, CouchDB, or a higher-level language-specific data-access library which offers something like ORM) if persistent storage is a concern, and possibly configuration file serialization library (for XML, JSON, INI, or whatever your game server uses).

I hope I've offered food for thought. Looking forward to further discussion.

This topic is closed to new replies.

Advertisement