MasterServer

From 333networks.com wiki
Jump to: navigation, search

A MasterServer is a special type of server that maintains a list of all servers (of a certain game) that are currently online. When you open the Multiplayer Games menu and select Internet Games (names vary for different games), in a few seconds a list of online servers will appear.


Basic Operation

When game players decide to play online, they select a server from the list and view different server properties such as the map name, players and game rules. Based on what a server offers, the player decides to join it. This process is very user-friendly, but in reality far more complex than people realize. What in fact happens is the following:

Example of the uBrowser server list
  1. Every game server sends a signal to the masterserver every minute.
  2. The masterserver keeps a list of all these servers, storing the IP and query port for several minutes.
  3. When the player opens the Multiplayer Games menu and selects Internet Games, the player requests a server list.
  4. The masterserver sends this list.
  5. The game client then performs a check on all servers in this list. This query is a request to each and every server address in the list that was received from the masterserver.
  6. Every server responds to this request with the server name, mapname, number of players and more.
  7. The player views the server properties and decides whether to join it.

Clients

Many Unreal Engine based games have editable masterserver settings that allow the player to specify a master server from which to select the server list. For example, in the UnrealTournament.ini configuration file (typically found in C:\UnrealTournament\System), the following lines can be found:

[UBrowserAll]
ListFactories[0]=UBrowser.UBrowserGSpyFact,MasterServerAddress=unreal.epicgames.com,MasterServerTCPPort=28900,Region=0,GameName=ut
ListFactories[1]=UBrowser.UBrowserGSpyFact,MasterServerAddress=master0.gamespy.com,MasterServerTCPPort=28900,Region=0,GameName=ut

These lines 'tell' Unreal Tournament where the masterserver can be found, what port and what game (e.g. unreal, ut, deusex). In our examples, we describe the process for Unreal Tournament. Other game configurations can be found at the Configuration page.

When a client opens a new connection, the masterserver responds with the secure/validate challenge:

\basic\secure\XDWAOR

The client, if legitimate, responds with its game name, location and 8 byte validation code:

\gamename\ut\location\0\validate\3JOdDFU5\final

When the challenge is not properly answered, the connection will be closed without further notice. All legitimate game clients automatically respond with the correct code, except for a few currently known games such as Deus Ex. Immediately after sending the correct response, the client requests the list of game server addresses.

\list\gamename\ut

The masterserver then sends a complete list of server addresses consisting of the IP and query port.

\ip\255.255.255.255:7778\ip\255.255.255.255:7778\...\final

When the list has been sent, the masterserver closes the connection. In-game, the server browser queries all servers in the list in order to display individual server statistics. The result is a list of game servers.


Servers

To be found by other clients, game servers send a heartbeat to the masterserver every once in a while. The time between heartbeats varies between twice per minute and once per few minutes. This heartbeat, as the name suggests, is just an uplink/beacon to let the masterserver know that the server is still up and running, waiting for connections from clients.

[Engine.GameEngine]
CacheSizeMegs=4
UseSound=True
ServerActors=IpDrv.UdpBeacon
ServerActors=IpServer.UdpServerQuery
ServerActors=IpServer.UdpServerUplink MasterServerAddress=unreal.epicgames.com MasterServerPort=27900
ServerActors=IpServer.UdpServerUplink MasterServerAddress=master0.gamespy.com MasterServerPort=27900
ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.telefragged.com MasterServerPort=27500
ServerActors=UWeb.WebServer
ServerPackages=SoldierSkins
ServerPackages=Botpack

In the above sample configuration, the IpServer.UdpServerUplink class handles the beacon and query to the default masterservers. At the time of writing, master0.gamespy.com ceased to exist. The last address, master.telefragged.com now redirects to GameRanger. The original IpServer package does not protect to several abusive queries. It is therefore recommended to use alternate packages such as SecureValidate if available for your game.

The MasterServer receives the UDP connection, and then processes it into the list that the UBrowser receives. The game server only sends one type of signal:

\heartbeat\7778\gamename\ut\

As one can see, this information contains only the query port of the server, as well as the game name (ut). There is no IP address involved, nor is there anything else about the contents of the game/server. The UDP packet contains the information about the sender, such as the IP address. Extract this from the socket to determine the original IP address and query port of the server.

After receiving the first heartbeat, the masterserver responds with a "secure\validate" challenge to test whether the uplink sender is an actual UT client. The challenge consists of a 6 byte string of random characters that consists of lowercase and uppercase characters, as well as numbers:

\basic\secure\l8jfVy

The UT server, if legitimate, responds with its heartbeat port, game name and 8 byte validation code:

\heartbeat\7778\gamename\ut\validate\XuXkWPKC\final\

This confirms that our UT server is in fact a real Unreal Tournament server and is then added to the list presented in the TCP section below. Further heartbeats are being sent throughout gameplay, every minute or so. The masterserver does not verify the UT server anymore, as long as it keeps sending heartbeats to demonstrate that it is still online.


Conclusion

Epic Games' UCC masterserver applet in action on 333networks (autumn 2008)

Simply said, a masterserver is a program that maintains a list of online servers and presents this list to clients who request the list of game addresses.


Different Software

There is no grand unified version of the masterserver. Epic Games wrote a UCC MasterServer applet that allowes people to host their own masterserver for LANs and local communities. This applet typically hosts a masterserver for only one game such as Unreal or Unreal Tournament. The masterserver currently in use for Unreal and Unreal Tournament (unreal.epicgames.com) is hosted by the UCC Masterserver applet.

The 333networks MasterServer provides a service similar to GameSpy, but is available as open-source software and offers support for multiple games. Additionally, the 333networks masterserver provides the ability for the same type of masterservers to synchronize with each other. The 333networks masterserver knows many versions; in 2014 a new version was released every few months, with fixed bugs, unexpected features and improved security and experience. Various communities run their own 333networks-based masterserver.

Steam provides an alternative masterserver for games powered by Steam [citation needed]. Content still required for Steam, GameRanger and GameSpy.