HTML and CSS Reference
In-Depth Information
Clearly, the Internet and HTML5 were designed with multiple clients in mind. According to a survey by Netcraft,
as of March 2012 there were more than 600 million active web sites, 1 most designed to serve multiple agents
simultaneously. The unique challenge with real-time multiplayer network programming is at the intersection of the
term's component parts: “real-time,” “multiplayer,” “network programming.” To illustrate, note how removing one of
these terms reduces the complexity substantially.
“Real-time” suggests that the game requires simultaneous, precise coordination among players (either for
cooperative or competitive goals). Players must have an accurate, up-to-date description of the shared game state at
all times. Providing this description quickly is challenging because of latency (for more information, see the section
“Latency”). For games designed to be played gradually (e.g., chess), or games in which only one person is actively
modifying the game state at any given time (e.g., poker), latency is not an issue. Implementing these games is actually
no different from creating a modern web site. (For more information on building a web platform that can push data
from the server to clients when latency is not an issue, check out ShareJS or DerbyJS, which itself is built on ShareJS).
Multiplayer games contain several human agents, who work together or against one another in the same game
instance. Note that simply having a global leaderboard in an otherwise single-player game does not make the game
multiplayer, because one player's high score does not affect the current game of another player. Also note that most social
network games, such as FarmVille , are not considered multiplayer in this context, because each player is operating within
his or her own sandbox, and sharing content between these sandboxes is limited and not real time. For these and other
single-player games, the clients and server can exchange data at their leisure, without time-sensitive synchronization
(for more information, see the section “Synchronization”).
Network programming in this context involves a constant stream of communication from each single client to all other
clients. This is in contrast to many web applications, in which most of the data flow from the server to each client, in sparse
intervals. If several people are taking turns on one keyboard or playing at the same computer with different joysticks, the
effects of all player actions can be known immediately, and this local multiplayer does not constitute a networked game.
Although this area of game programming is rather specific and presents a unique set of challenges, it also affords
an unparalleled level of engagement for your players. The next sections discuss the core challenges of real-time
multiplayer network programming.
The three main challenges in real-time multiplayer network programming are bandwidth, latency, and
synchronization. The following sections cover each of these in detail.
One of the challenges in real-time multiplayer network programming is bandwidth. Unlike many web applications,
networked games require a significant stream of data from each client to every other client. This means that the amount
of data each client must transmit to the others increases linearly with the number of players. To illustrate, suppose a
player action consumes 256B of data, and a player can make 60 actions a second. In a 2-player game, approximately
15KB will be received per player per second (256 × 60). However, in a 100-player game, approximately 150KB of data per
second will be received by each client, which is a significant amount of data for most home Internet connections. This
is why massively multiplayer online (MMO) games typically have shards (clones of the game that are isolated from one
another) and instances (areas of the game in which a small subset of the players are isolated from the rest of the shard).
By isolating smaller groups of players, the actions of these players do not need to be shared with the rest of the world in
real time. Also, much of the data do not need to be shared at all. For example, the real-time location of your character in
an instance does not need to be known by other players of your guild who aren't in the instance.
1 Julie Bort, “How Many Web Sites Are There?,”
there-2012-3 , March 8, 2012.
Search WWH ::

Custom Search