






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Rajesh Krishna Balan 1 , Maria Ebling 2 , Paul Castro 2 , and Archan Misra^2 (^1) Carnegie Mellon University, 5000 Forbes Avenue, Pittsburgh, PA 15213, USA (^2) IBM Research Watson, 19 Skyline Drive, Hawthorne, NY 10532, USA
Abstract. Building a distributed middleware infrastructure that provides the low latency required for massively multiplayer games while still maintaining consis- tency is non-trivial. Previous attempts have used static partitioning or client-based peer-to-peer techniques that do not scale well to a large number of players, per- form poorly under dynamic workloads or hotspots, and impose significant pro- gramming burdens on game developers. We show that it is possible to build a scalable distributed system, called Matrix, that is easily usable by game develop- ers. We show experimentally that Matrix provides good performance, especially when hotspots occur.
Online gaming is a rapidly growing market segment estimated to reach 100 million players and a USD $5 billion market value by 2008 [9]. A popular form of multi- player gaming is the rapidly growing [24] class of massively multiplayer online games (MMOG) such as Everquest [19] and Final Fantasy XI [20], where hundreds or even thousands of players from across the world interact in a real-time shared virtual world. To support these virtual worlds, most MMOGs currently use a centralized server model, with players connecting to a single game server that handles the entire game world. However, each server can handle at most 30,000 clients [7] whereas games like Final Fantasy XI claim to have at least one million registered players [21]. To handle more players, some MMOGs [7] use multiple servers that are statically assigned differ- ent parts of the game world even though this approach is known to be unresponsive to unexpected workload variations or dynamic localized hotspots in the game. To overcome this limitation, static partitioning schemes either significantly over- provision the number of servers used for the game and/or impose artificial limits on the number of players that can be in any part of the map. Unfortunately, overprovisioning incurs extra costs and artificial limits may detract from the gaming experience. It would be better instead, to use a distributed system that can handle arbitrary game loads by dy- namically and automatically adjusting the number of servers used by the game in a scal- able and efficient manner. This system could either be used on its own or in combination with static partitioning schemes (as a mechanism to handle unexpected load changes). Building this dynamic distributed system for MMOGs, however, is a non-trivial problem. To preserve the interactive feel of a MMOG, the client response latency must be low [3]. But, maintaining complete consistency between distributed nodes requires
G. Alonso (Ed.): Middleware 2005, LNCS 3790, pp. 392–402, 2005. ©c IFIP International Federation for Information Processing 2005
Matrix: Adaptive Middleware for Distributed Multiplayer Games 393
increasingly larger amounts of time as the amount of traffic and number of nodes in the system increases (due to increased player activity). However, a lack of consistency could lead to an unsatisfactory experience for the game player. The challenge lies in satisfying these conflicting latency and consistency goals, especially for a system with a large number of nodes and a high volume (O(Gbps)) of network traffic. The key insight that allows us to overcome this problem is the observation that MMOGs are an example of a nearly decomposable system [18]. Such a system is one in which the number of interactions among subsystems, in some geometric space, is of a lower order of magnitude than the number of interactions within an individual subsystem. For MMOGs, this behaviour typically manifests itself through a “radius” or “zone of visibility” associated with each game player. It is usually sufficient to update players with only those events that occur in their zone of visibility. For example, if a tank is destroyed in a battlefield game, it is enough to only send this information to other tanks that can see the victim, rather than to all the tanks in the game. Using this insight, we built a scalable low-latency distributed middleware infras- tructure, called Matrix , that provides pockets of locally-consistent state. This weaker form of consistency allows Matrix to provide low latency responses, while still giving adequate consistency to game clients even when the number of nodes in the system increases. Matrix also provides low latency mechanisms to handle infrequent global interactions. Another key Matrix design goal was ease of use. We achieved this by pro- viding a clean and clear layering that hides the consistency maintainence details within an easy-to-use API (not shown due to space constraints). This API allows Matrix to be used with only minimal changes to existing MMOGs. The layering also allows Ma- trix to support the distributed operation of various MMOGs without actually needing to understand the game logic. Finally, unlike static partitioning techniques, Matrix can dynamically add and remove servers as necessary to handle transient hot-spots and dy- namic loads caused by players joining and leaving the game. We validated both Matrix’s system-level performance as well as its effectiveness at satisfying real game players. In particular, we show that Matrix’s overhead is reason- able and also that it outperforms a statically partitioned system when unexpected load patterns occur. Due to space constraints, we present a summary of these results. In Section 2, we describe Matrix’s design criteria while Section 3 presents the de- sign and implementation of Matrix. Section 4 presents a summary of the evaluation while Section 5 presents related work.
In this section, we describe the two key design criteria (and their corresponding im- plications) used to build the Matrix middleware. In particular, Matrix was specifically designed to allow MMOG game developers to focus mainly on their game’s core logic and delegate the task of scalably distributing their games to Matrix.
2.1 Attractive and Easy for Game Developers
The first key criteria was to make Matrix attractive for game developers to use. Most game companies usually focus on core game-specific technologies, such as 3D graphics
Matrix: Adaptive Middleware for Distributed Multiplayer Games 395
dynamically change its server usage based on the current game load. We describe how we achieve this in Section 3.2.
In this section, we describe Matrix’s design and implementation, focusing primarily on the overall architecture and major technology components.
3.1 Providing Localized Consistency
To build an easy to use localized consistency mechanism, we observed that all games have some notion of geometric space that allows distances between game objects to be computed using a game-specific distance metric. If Matrix was aware of an individual game’s spatial coordinates and its radius of visibility (the range over which local con- sistency is typically required), it could confine the propagation of any game state update to an easily computable region, without having to maintain game-specific relationship trees or other data structures. Matrix uses this insight to require game developers to merely forward all game packets, appropriately tagged with the spatial coordinates (in the game world) of the packet’s origin and destination, to the local Matrix server. Ma- trix uses these spatial tags, together with the game’s radius of visibility, to route these packets to the other game servers that manage objects within this radius of visibility (and thus need to maintain consistency). Matrix assigns unique portions of the MMOG’s spatial map to different servers. Each server is only responsible for clients located within its assigned partition. For- mally, Matrix partitions the overall space Z of an MMOG into N non-overlapping par- titions, { P 1 , P 2 ,... , PN }, and assigns each partition Pi to a distinct server S (^) i. To handle load spikes, the number of servers N , and the specific partition managed by any server S (^) i can change dynamically. Because games have a non-zero radius of visibility, changes in the MMOG state at any point, σ i , handled by server S (^) i , that is within the radius of visibility of a client located on server S (^) j , must be consistently applied at both servers S (^) i and S (^) j. In general,
(a) Overlap Region between 3 Matrix Servers (b) Matrix Architecture
Fig. 1. Matrix Components
396 R. Krishna Balan et al.
given a spatial partition and a radius of visibility R , every point σ in Z has a set of servers associated with it, called the consistency set of σ or C (σ). This set contains all the servers whose partitions overlap the circle (or sphere) of radius R centered at σ and therefore need to be aware of any update or activity in σ. If d ( x , y ) represents the distance-metric between points x and y ,
C (σ ∈ Pi ) = { S (^) j | j = i ∧ ∃σ′^ ∈ P (^) j s. t. d (σ, σ′) ≤ R } (1) From Equation 1, we observe that if R is infinite, all updates must be globally prop- agated, making localized consistency impossible. However, if R is small compared to the size of partition Pi , most of the interior points of Pi will have empty consistency sets. Only the relatively small number of periphery points, whose C (σ) = 0 / (i.e, whose radius of visibility extends into adjoining partitions) will require consistency to be maintained between servers. Games usually have limited player visibility radii and Matrix effi- ciently utilize this sparseness by forming groups, called “overlap regions”, of all points that have identical non-empty consistency sets (shown in Figure 1a). Intuitively, an overlap region denotes a portion of the map, such that an update at any point in that overlap region requires all the servers in that overlap region to be informed of the update. Overlap regions allow Matrix servers to quickly determine the consistency set for any game packet they receive by merely doing a table lookup (of the set of overlap regions). Matrix assumes that most players in a game have the same radius of visibility. The Matrix API does allow game servers to specify different visibility radii for exceptions, and internally creates distinct sets of overlap regions, each for a different R. We decided to use overlap regions instead of other geometric data structures, like spanners [4], to determine the consistency set of any object because overlap regions do not require costly (in terms of latency) hop-by-hop lookups and they work well even when the map space changes dynamically (which happens during splits and reclamations).
3.2 Matrix Architecture
Figure 1b shows the Matrix architecture, that satisfies the design criteria in Section 2. A MMOG is deployed using Matrix with the MMOG developers providing game clients and game servers and the Matrix infrastructure providing Matrix servers and a Matrix coordinator (MC). The architectural components interact as follows:
3.2.1 Game Clients The clients are used by game players to play the MMOG. Each client interacts with a game server and provides it with updates on the player’s activity and receives updates on nearby activity. Game clients must be able to switch servers dynamically because the MMOG may be on multiple servers, each handling a unique portion of the MMOG world. The client is informed of these switches by its current game server and is unaware of Matrix.
3.2.2 Game Servers The game server is the software that stores the state of the game world and coordinates the activity of the players in the game. In most commercial games, they are also the only point of contact between game clients and the game world to protect against cheating
398 R. Krishna Balan et al.
started game servers also need to obtain the static state of the game, like the map tex- tures, that can be hundreds of megabytes in size. However, because this state is static, it can be pre-cached on all new servers, requiring only pointers to the cached state to be sent. The Matrix server that performed the split will be the parent of the newly created Matrix server. When a Matrix server detects that its game server is underutilized (again, through explicit load notifications or via system performance measurements), it first checks if it has any children. If it does and if their load levels are low enough, the parent Matrix server will reclaim the partition and game state held by the child. All the game clients on the child’s game server will be transfered to the parent’s game server, after which the child Matrix server and game server will be removed from the game and returned to the resource pool. Matrix uses simple heuristics (not described) to prevent oscillations and ensure stability in the splitting / reclamation process.
3.2.4 Matrix Coordinator (MC) The MC creates the overlap tables used by Matrix servers to route spatially tagged packets. When a new Matrix server is used for the game, it informs the MC of the current map range and radius of visibility. The MC then computes the overlap regions for all the Matrix servers in the game using geometric algorithms to calculate bounding boxes between spatial regions; a particularly easy computation, using well known axis- aligned bounding box computation algorithms, if the map partitions are rectangular in shape. The MC will then inform each Matrix server of their overlap regions along with the set, C (σ), of Matrix servers that should be informed about an event in that region. The MC recomputes and redistributes overlap regions every time a new Matrix server is used or whenever an existing Matrix server is reclaimed (the MC is informed of the new map ranges whenever reclamations occur). We used a central MC to minimize the latency of the packet forwarding process. In the common case where players are only interacting with nearby objects, each Matrix server can do an instant O(1) lookup to determine the consistency set for any game packet using the overlap regions provided by the MC. Even in uncommon cases involv- ing non-proximal interactions, the Matrix server can consult the MC to determine the consistency set for that particular interaction. Matrix could use alternate lookup meth- ods (such as DHTs [22]), but that would result in increased latency (e.g., DHT schemes usually need O ( log ( N )) lookups for N Matrix servers). Although a centralized approach can lead to performance bottlenecks, the MC is only used when the MMOG world par- titioning changes due to splits or reclamations (which should occur infrequently for a stable game). This centralized approach can scale to large server populations as the MC is not used in the latency-critical packet forwarding process (except for the rare non-proximal interactions). The MC can also be made reliable using well understood replication techniques.
Due to space constraints, we present just one detailed result showing that Matrix can handle dense hotspots automatically. The detailed evaluation results will appear in a longer version of this paper.
Matrix: Adaptive Middleware for Distributed Multiplayer Games 399
This Figure shows Matrix responding to a 600 client hotspot. The left graph shows how the total number of clients were shared among the various servers. Note that a server is overloaded when it has 300+ clients. The right graph shows the receive queue length of the various servers. Matrix used up to four server to handle the load caused by the hotspots. However, Matrix reclaimed those extra servers as shown by the reclamation points on the left graph when the load eased. The second reclamation took longer as the child server took longer to become underloaded (< 150 clients).
Fig. 2. Hotspot caused by 600 clients
4.1 Behaviour Under Load and Hotspots
Matrix was designed to gracefully react to unexpected heavy loads and dense hotspots. We tested this by subjecting Matrix to loads far higher than what a static partitioning scheme could handle. Figure 2 shows an experiment in which a hotspot of 600 clients (for a real shoot- ing game called Bzflag [16]), far higher than a static partitioning could handle (results not shown), was introduced at around the 10 second mark for about 75 seconds, after which the entire hotspot gradually disappeared (indicated by 200 clients disappearing at fixed intervals). The hotspot was reintroduced at a different position in the world at 170 seconds, for about 50 seconds, and then gradually removed. Matrix relieved the initial spike in the receive queue caused by 600 clients joining (shown at time=10 in Figure 2) by spawning server 2 (at time=10) and giving it half the map. However, this did not ease the load as the hotspot was on the map portion retained by server 1. Hence, server 1 spawned another server, server 3, (at time=10) and split its current map with it (servers 1 and 3 have 1/4 of the map each with server 2 having the rest). Server 3’s map range contained the hotspot and a large number of clients were switched to it easing server 1’s load. However, server 3 now experienced a load spike (at time=60). This process continues recursively until the load on all the servers is acceptable. As clients leave the game, servers become underloaded and Matrix reacts by consolidating the load onto a smaller number of servers. For example, after 200 clients left the game (at time=75), server 3 became underloaded and reclaimed its “child” server (server 4). Matrix was similarly able to handle the subsequent appearance and disappearance of another hotspot (introduced at t=170) located at a different part of the map. This result clearly demonstrates that Matrix, unlike static partitioning schemes, is able to deploy additional servers to react quickly and effectively to sudden load changes.
Matrix: Adaptive Middleware for Distributed Multiplayer Games 401
systems, together with careful static partitioning, to efficiently and effectively handle hotspots and load fluctuations. The notion of radius of visibility has been used extensively in the field of computer graphics where only objects in the immediate field of view are rendered. However, we are applying this technique to the domain of multiplayer games. The use of localized consistency has also been used in previous systems to achieve lower latency updates at the expense of complete correctness. These include distributed shared memory sys- tems [2,13], databases [1,6], and network protocols [10]. However, unlike these pre- vious systems, multiplayer games are nearly decomposable. This allows Matrix to use localized consistency to reduce latency without sacrificing any correctness. Finally, there have been a number of algorithms to split virtual worlds among dif- ferent servers. These include algorithms optimized for reducing inter-server communi- cations [14,15] and for preserving locality [8]. Our work complements these solutions and Matrix can use these algorithms to perform more optimal splits.
In this paper, we have shown that it is possible to build, using localized consistency and on-demand mechanisms, an easy to use distributed middleware architecture that is able to satisfy the latency and scalability requirements of MMOGs. We have implemented Matrix and used its simple API to allow three games (BzFlag, Quake2 and Daimonin) to use Matrix. The Matrix design is specially attractive because of its layered approach; by completely shielding the game from the actual mechanisms used to implement con- sistency, reliability and map partitioning, Matrix allows a game developer to use it with almost no modifications to the game client, and relatively simple modifications to the server code.
402 R. Krishna Balan et al.