Docsity

Quake: Multiplayer Games Architecture and Real-time Interactions, Papers of Electrical and Electronics Engineering

Partial preview of the text

Download Quake: Multiplayer Games Architecture and Real-time Interactions and more Papers Electrical and Electronics Engineering in PDF only on Docsity!

A Distributed Multiplayer Game Server System

Eric Cronin Burton Filstrup Anthony Kurc

Electrical Engineering and Computer Science Department

University of Michigan

Ann Arbor, MI 48109-

f ecronin,bfilstru,tkurc g @eecs.umich.edu

May 4, 2001

of state rather than overall packet latency. CRIMP is a custom-built, application-specific multicast proto- col that provides the infrastructure requirements of our architecture in a low latency manner. Two bootstrapping services will be included in the final system, although they have not yet been imple- mented. The first is a master server that allows users to locate candidate game servers. The second is a server selection service named qm-find that can be used to locate the closest game server to a particular client. The most significant result of this project is a fully operational, distributed Quake system, com- plete with a working synchronization mechanism and a functional multicast protocol. In addition, we have established the infrastructure to test and evalu- ate our system under different network conditions. The experimental evaluation of trailing state syn- chronization is in its early phases, and our prelim- inary results do not adequately explore the mecha- nism’s potential to respond to different network con- ditions. In future work, we would like to concen- trate on understanding the effects of different con- figurations on trailing state synchronization’s perfor- mance.

1.2 Quake

We chose Quake as our proof-of-concept game be- cause it is very sensitive to latency and provides a virtual world environment. Quake is a commercial game that was not designed for a distributed archi- tecture. As such, Quake forces us to address the needs of a real game, as opposed to a game that fits neatly into our architecture. Another reason for using Quake is that it is one of the few commercial games for which the source code has been released. In this section, we introduce Quake and describe the features of Quake that are relevant to our report.

We outline Quake’s architecture, including its mas- ter server. We describe Quake’s interest management techniques and then delve into details about the mes- saging protocols.

1.2.1 Introduction

Quake is a 3-D first player shooter, by id Soft- ware, the creators of a revolutionary and spectac- ularly successful line of games including Wolfen- stein 3D, Doom, Quake and Quake III. Besides 3- D graphics, their major innovation was the online multiplayer game. College students found that they could put the newly installed dorm LAN’s to use by engaging in mortal combat with their neighbors. Multiplayer Quake is a simple game. Your avatar has a gun and so does everyone else. You’re going to die in the next minute or so, but before that happens, your goal is to finish off as many of your opponents as possible. All interactions take place in real-time, and more than a 100 ms lay can be a crippling hand- icap. John Carmack, the mastermind behind Quake, re- leased the source code in 1999. Two open source projects arose to improve Quake, QuakeForge and QuakeWorld. The two subsequently merged their sources into Quakeforge, which has developed sev- eral new versions of the original game. Develop- ment in Quakeforge is sporadic, with a handful of people doing most of the work. Their major contri- butions have been porting Quake to new platforms, supporting more sound and graphics hardware, and enhancing the graphics. Quakeforge has also built in some simple cheat detection algorithm and a denial- of-service attack prevention mechanism. A significant amount of information about Quake has been compiled by the Quake Documentation Project. Two pieces of this project describe the net- work code: The Unofficial Quake Specification and The Unofficial DEM Format Description. For the

most part, these documents focus on the details of the message formats. Neither is a comprehensive look at the networking issues in Quake. Other Quake resources can be found at the Quake Developer’s Pages. The purpose of this document is to give a high- level overview of the technologies Quake uses to en- able multiplayer games. The first section describes the Quake Client-Server architecture. Next, three op- timizations are discussed: dead reckoning, area of in- terest filtering and packet compression. The Quake- forge modifications to prevent cheating and denial- of-service attacks are discussed. Finally, the last sec- tion presents the network protocols.

1.2.2 Architecture

Quake uses a centralized Client-Server architecture. In this architecture, the server is responsible for computing all game state and distributing updates about that game state to the client. The client. The client acts as a viewport into the server’s state and passes primitive commands such as button presses and movement commands to the server. Because this architecture allows most of the game state computa- tion to be performed on the server, there is no consis- tency problem. However, the gameplay is very sen- sitive to latencies between the client and the server, as users must wait at least a round trip time for key presses to be reflected in reality. The server is responsible for receiving input com- mands from client, updating the game state, and sending out updates to the clients. The control loop for this procedure is discussed in more detail in Ap- pendix A. The server’s biggest job is keeping track of entities. An entity is almost any dynamic object: avatars, monsters, rockets and backpacks. The server must decide when a player is hit, use physics models to calculate the position of free-falling objects, turn key presses into jumps and weapon fires, etc. The

server also informs clients of world state: gravity, lighting and map information. Aside from its role in gameplay, the server is a session manager that starts and ends games, accepts client connections and per- forms numerous other administrative tasks. The client sends simple avatar control commands (movements, tilts, buttons) to the server. It uses its cache of the game state plus any updates from the server to render a 3-D representation of the vir- tual world. The graphics rendering is performed on the client, as is fine-grained collision detection. The client has been the main area of interest in the game developer community because it is where all the ’cool graphics’ are done. However, from an ar- chitectural or networking point of view, the Quake client is relatively simple compared to the server.

1.2.3 Master Server

Quake supports a master server that keeps track of active game servers on the Internet. Although the master server is not packaged with Quake, GameSpy provides a full-featured master server service. For a Quake server to be listed in GameSpy’s database, the administrator must manually add GameSpy’s IP address to the master server list. The server then pe- riodically sends heartbeats containing the number of connected client to the master server. The server also informs the master server when it is shutting down.

1.2.4 Area of Interest Filtering

One of the advantages of having a server architecture is that the server can dynamically filter information before sending it to the clients. The Quake server only sends a client information for entities that are within that player’s potential field of sight. Simi- larly, sounds are filtered to those that are within that player’s earshot. Calculating an entity’s potential field of sight is

A number of other non-gameplay messages can ei- ther be generated automatically by the client or by the user. These include instructions to spawn a new entity, kill an unruly player, pause the game, down- load a new map, change user information, etc.

1.2.7 Server to Client Messages

There’s a are a large number of server to client messages. The ones that are directly involved in the gameplay and require low latency describe the state of each client in the game. Key elements of a client’s state include that client’s position, orienta- tion, health, weapons, and ammo. Client state infor- mation is computed as a delta off a client’s baseline state. All server-to-client messages are sent unreli- ably.

complex game state. Quake’s game state must quickly and accurately reflect a number of permanent changes such as rocket fires, rocket impacts, damage and death. For racing games [15] and simple games like MiMaze [8], consistency requirements are much simpler. Two game states need only agree on posi- tional information, which is refreshed rapidly, can be transiently incorrect and can be dead reckoned. Bandwidth requirements for a multiplayer game can be significant. The Quake clients send out tiny command packets, and the Quake server performs delta updates and interest management to reduce state update sizes. Still, as you will see from our results, an eight-player game consumes 50 Kbps on the client side link, making modem play difficult. Even worse, the server consumes 400 Kbps, which means it must have good connectivity. If possible, we would like our architecture to reduce bandwidth requirements, particularly on the client-side links. The fourth goal is to use an architecture that allows game companies to retain administrative control over servers. Administrative control can allow the game company to:

 Create persistent virtual worlds. The game company’s servers can securely store player profiles and maintain centralized worlds that are always ”on”. For example, Everquest [5].

 Reduce cheating. If a secure server manages game state, opportunities for cheating may be reduced [1].

 Facilitate server and client maintenance. The game company can easily distribute bug fixes, and can allow the game to evolve after its re- lease date.

 Eliminate piracy. Players can be forced to log in to verify their identity. [2]

 Enable player tracking. Everquest charges users based on the amount of time they spend playing.

The drawback of administrative control is that the game company is forced to run its own servers. Par- ticularly for small companies, the cost of operating servers may be prohibitive.

2.3 Assumptions

For the following discussion, we assume that the gaming company operates a private low-latency net- work where mirrors are gateways to that network. This assumption makes the real-time multiplayer game problem tractable; the Internet cannot provide low latencies, nor can it handle gaming traffic that lacks congestion control mechanisms. A side benefit of this assumption is that we can choose to enable IP-Multicast within the private network, whereas IP Multicast is not available on the Internet. Without IP-Multicast, our architecture would require an end- host multicast protocol such as BTP [9], HyperCast [13] or NARADA [20]. Unfortunately, these end- host multicast protocols fail to provide the low la- tency requirements needed by our architecture.

2.4 Client-Server vs Peer-to-Peer Architecture

In this section, we will briefly describe the key fea- tures of the Client-Server and P2P architectures and compare them along the axes described in the pre- vious section, namely: latency, consistency, band- width, and administrative control. Most commercial games use a Client-Server ar- chitecture, where a single copy of the game state is computed at the server. This architecture is used in Quake [16], Starcraft [3]. The Client-Server ar- chitecture as used in Quake is depicted in Figure

cmd

cmd

cmd

Figure 2.1: Peer-To-Peer Architecture

2.2. Clients input key presses from the user and send them to the server. We refer to these client-to- server messages as commands. The server collects commands from all of the clients, computes the new game state, and sends state updates to the clients. Fi- nally, the clients render the new state. Notice that this is a thin client architecture, where clients are only responsible for inputting commands and render- ing game state. In the peer-to-peer (P2P) architecture, there is no central repository of the game state. Instead, each client maintains its own copy of the game state based on messages from all the other clients (see Figure 2.1). A P2P architecture has been used in a few sim- ple games, including Xpilot [19] and MiMaze [8]. It is also used in complex, scalable battlefield simula- tors such as STOW-E. In MiMaze, clients multicast their game positions to every other client. Each client computes its own copy of the game state based on messages from other clients and renders that game state.

The primary advantage of the P2P architecture is reduced message latency. In the Client-Server archi-

cmd cmd

cmd

updates

Figure 2.2: Client-Server Architecture

tecture, messages travel from clients to a potentially distant server, then the resulting game state updates propagate back from the server to the clients. In the P2P architecture, messages travel directly from one client to another through the multicast tree. Be- cause no widespread multicast service that we know of is provided on the Internet, in practice, latency- sensitive P2P messages need to be sent using unicast, which scales poorly with the number of clients. In the Client-Server architecture, game state con- sistency is not a problem. There is only one copy of the game state, and that copy is maintained by a single authoritative server. In the P2P architecture, there are multiple copies of the game state. If mes- sages are lost or arrive at different times, inconsis- tencies can arise. Although synchronization mech- anisms such as our novel trailing state synchroniza- tion can resolve these inconsistencies, these mecha- nisms tend to increase the system’s complexity and may require disorienting rollbacks.

chronization mechanism. In our mirrored version of Quake, clients send commands to their closest mirror. The mirror closest to the sender is referred to as the ingress mirror. The ingress mirror multicasts incoming commands to the other mirrors, which we term egress mirrors. The egress mirror calculates its own copy of the game state and sends state updates to its directly connected clients. The client then renders this updated game state. Comparing bandwidth consumption among the three architectures becomes more complicated when assuming a high-speed network with each client sending messages to the nearest gateway. A detailed analysis of the bandwidth requirements of each ar- chitecture is presented in Section ?? The Mirrored- Server architecture uses more bandwidth on the pri- vate network where bandwidth is plentiful than it does on the public network. Also, the traffic con- centration seen in the Client-Server architecture is shared by the mirrors in the Mirrored-Server archi- tecture. Overall, the bandwidth consumption of all three architectures is comparable. The Mirrored-Server architecture appears to be a reasonable alternative to the Client-Server architec- ture. Some of the larger gaming companies have already distributed game server clusters across the world. Both Blizzard [3] and Verant [5] have a num- ber of geographically distributed clusters. To our knowledge, no game state is shared between these clusters.

2.6 Experiments and Results

The experiments in this section are designed to inves- tigate the bandwidth requirements of the three archi- tectures. We begin by developing a model to predict bandwidth usage based on the number of players in a game. Then, we collect some bandwidth statistics

to populate the model. Our findings confirm that the architectures use similar amounts of bandwidth. The measurements are also used to evaluate the effective- ness of Quake’s interest management techniques, but the results are inconclusive. We also include plans for future experiments in this section. The bandwidth requirements of Quake can be de- scribed using a simple model. Clients always gen- erate commands at a rate a, regardless of the archi- tecture. The command streams increase to a rate b upon being forwarded to the multicast channel due to added timestamps and multicast headers. In both the Client-Server and Mirrored-Server architectures, the server sends state updates to each client at a rate c + n(d + e). For the Mirrored-Server architecture, we assume 8 clients per server, m = n 8. Variable definitions are listed in Table 2.6. First we calculate the asymptotic bandwidth re- quirements of the architectures as the number of clients increases. In Quake, interest management techniques remove only about 70% of the informa- tion about clients that are not in the area of interest, so they do not affect the asymptotic results. We fur- ther simplify the model by assuming that all mes- sages are unicast. The asymptotic input and output rates of the clients, servers and mirrors are listed in Table 2.6. For the Mirrored-Server architecture, the server rates are for messages between the client and mirrors and the mirror rates are for messages between mirrors. Notice that all of the approaches use (n) (n^2 ) bandwidth on the public and private networks and bandwidth at the client. However, the Mirrored-Server architecture uses only (n) band- width at the mirrors, while the Client-Server archi- tecture uses (n^2 ) bandwidth at the server. To determine the values of a; b; c; d; e and we set up a simple series of experiments. We ran a total of five experiments with n = 1 ; 2 ; 3 ; 4 ; and 5 clients. For each experiment, the clients connected to a sin- gle mirror and played a two-minute game, 60 sec-

a Command rate on the Client-Server connection b Command rate on the mirror-mirror connection c Rate of state updates with zero clients d Rate of information that is always included about each client e Rate of information about clients in proximity to the receiving client Describes the effectiveness of the interest management techniques n Number of clients in the game m Number of mirrors

Table 2.1: Variable Definitions

Client-Server Peer-to-Peer Mirrored-Server Client Output Rate a bn a Server Input Rate an a Client Input Rate c + (d + e)n bn c + (d + e)n Server Output Rate cn + (d + e)n^2 c + (d + e)n Mirror Output Rate bn Mirror Input Rate bn Private Network Rate an + cn + (d + e)n^2 bn^2 bn^2 Public Network Rate an + cn + (d + e)n^2 bn^2 an + cn + (d + e)n^2 Total Client a + c + (d + e)n bn a + c + (d + e)n Total Mirror/Server an + cn + (d + e)n^2 bn + c + (d + e)n

Table 2.2: Asymptotic Input and Output Rates

Client-Server Peer-to-Peer Mirrored-Server Private Network Rate 5 : 36 n^2 + 6 : 84 n 10 : 6 n^2 10 : 6 n^2 Public Network Rate 5 : 36 n^2 + 6 : 84 n 10 : 6 n^2 5 : 36 n^2 + 6 : 84 n Total Client 5 : 36 n + 6 : 84 10 : 6 n 5 : 36 n + 6 : 84 Total Mirror/Server 5 : 36 n^2 + 6 : 84 n 53 : 5 n + 9 : 28 , (^) mn = 8

Table 2.4: Bandwidth Consumption

0

200

400

600

800

1000

1200

1400

0 2 4 6 8 10 12 14

Bandwidth (Kbps)

Clients

Mirrored-ServerClient-Server

Figure 2.4: Predicted Client-Server and Mirrored- Server Bandwidth Requirements

interest management mechanism. Also, better instru- mentation could be installed to eliminate the error due to rough estimations of the coefficients c; d and e. We reserve this for future work. Latency is the most important experimentally veri- fiable difference between the architectures presented in this section. Unfortunately, coming up with mean- ingful latency comparisons involves choosing a real- istic network topology. At one extreme, a star topol- ogy centered at the server will result in identical la- tency for both the Client-Server and P2P architec- ture (see Figure 2.5a.). At the other extreme a topol- ogy where the server is located in an infinitely dis- tant or congested part of the network, as in Figure

Clients in Clients State Updates (%) 1 N/A 2 66. 3 13. 4 28. 5 16.

Table 2.5: Values

2.5b., will result in the P2P architecture being in- finitely faster than the Client-Server architecture. For the Mirrored-Server architecture, the best and worst cases are less clear. The topology in Figure 2.5c. will result in much better average end-to-end latency for the Mirrored-Server and P2P architectures, because a centralized server would have to be placed far away from half of the clients. The topology-dependent study evaluation is reserved for future work.

2.7 Conclusions

Each of the three architectures sports a different set of advantages and disadvantages. No single architec- ture is suited to all classes of multiplayer games. The Client-Server architecture has poor latency and good consistency characteristics, so it is a good match for any non-real-time game. The P2P architecture has good latency but poor administrative control char-

a. Star b. Remote Server c. Bi-nodal

Figure 2.5: Different topology types

acteristics, making it ideal for small scale, latency- sensitive games. The Mirrored-Server architecture achieves low latency and administrative control; we feel it is a great solution for next-generation real-time persistent-world games.

Chapter 3

Consistency Protocols and Synchronization

Mechanisms

3.1 Introduction

The Mirrored-Server and P2P architectures involve computing multiple copies of the game state. Lost or delayed messages can cause inconsistencies be- tween game states. A consistency protocol is needed to deliver messages to their destinations, and a syn- chronization mechanism must be used to detect and resolve inconsistencies. Although the Mirrored- Server and P2P architectures pose identical con- sistency problems, we will focus on the Mirrored- Server architecture because it is the chosen architec- ture for our Quake system.

This chapter begins with some key definitions and an overview of our consistency goals. Next, we launch into a description of two consistency proto- cols. The last half of the chapter concerns our syn- chronization mechanism, trailing state synchroniza- tion (TSS). We set the stage with a discussion of pre- viously proposed synchronization mechanisms and how our approach differs from those mechanisms. TSS is described in detail, with some analysis of op- timal configurations. The results in this section sup- port our claim that TSS is an efficient, low-latency, consistent synchronization protocol that is appropri- ate for multiplayer games.

3.2 Definitions

We make a distinction between the consistency pro- tocol and the synchronization mechanism. The con- sistency protocol is responsible for delivering mes- sages to the destination mirror and incorporating those messages into the game state. A key piece of the consistency protocol is the synchronization mechanism , which detects and resolves inconsisten- cies. The consistency protocol gives a high-level specification of the messaging protocols, while the synchronization mechanism deals with the details of maintaining consistent state. Commands are simple messages that convey input from a client to a server. In Quake, commands con- tain key presses and orientation information. Quake servers calculate the game state directly from com- mands. If instead we think of the Quake server as a simulator, then it is responding to events by chang- ing the game state. We have simplified the Quake gameplay so that the following events are sufficient to initiate all game state changes.  Move event: An avatar moves to a new position.  Fire event: An avatar fires a rocket.  Impact event: The rocket impacts and detonates

 Damage event: An avatar takes damage and possibly dies.

 Spawn event: An avatar is reborn in a random part of the map.

The clients generate move, fire and spawn events, while the mirrors generate impact and damage dur- ing the game state computation. A key observation is that different events have dif- ferent consistency and latency requirements. Real- time events have strict timeliness and lax consistency requirements. At the other end of the spectrum, con- sistent events have lax timeliness and strict consis- tency requirements. The most challenging events are consistent real-time events , which have strict timeli- ness and strict consistency requirements. Real-time events are those events that players must be informed of in real-time in order to react reflexively. The best example of a real-time event is the move event. Any delay in the reaction time of one’s own avatar movement inhibits the effective- ness of player reflexes. Delays in the perceived mo- tion of other avatars force the player to anticipate their motion. Because shooting another player re- quires significant hand-eye coordination, players are extremely sensitive to the timeliness of move events. If possible, real-time event latency must be less than 100 ms. Although human reflexes can act on the order of 100 ms, players cannot easily detect short- lived inaccuracies in avatar position. Therefore, real- time events can occasionally be lost or delayed with- out ill effect. All events that take more than 100 ms to react to are termed consistent events. Damage events, die events, and spawn events can all be placed into this category. Unlike real-time events, these events affect the game state in permanent and noticeable ways. Therefore, consistent events must be consis- tently processed across all clients. For example, all

clients must agree that an avatar took a hit and died. Here, consistency is far more important than timeli- ness, so we might be willing to wait 500 ms before the avatar keeled over. Unfortunately, there are some events that have tight real-time constraints and require a high degree of consistency. Fire events and impact events are two examples. Clearly, all clients must agree on whether or not a rocket hit an avatar or whether that avatar dodged, allowing the rocket to whiz by. Assume that we treated this event like the consistent events, where there could be a 500 ms delay after the event oc- curred before the event is reflected in the game state. Then all weapon impacts would occur after they have struck their targets. This means that rockets would continue along their trajectory for a fraction of a sec- ond, possibly passing through their target before det- onating. This behavior is unacceptable, so we must treat consistent real-time events differently.

3.3 Consistency Protocols

3.3.1 Consistency Protocol Goals

The goals of the consistency protocol follow directly from the event class definitions. Real-time events must appear in the game state with the lowest possi- ble latency and consistent events must be consistent between game states. The mechanisms to accom- plish this should be as efficient as possible, both in bandwidth and computational load. For example, if real-time event servicing can be made more efficient than consistent real-time event servicing, the same mechanism should not be used for both.

3.3.2 Distributing Game State Computa-

tions

So far, we have not explicitly examined the issue of where the game state calculation should occur.