Title: Technical Issues: Networking
1Technical IssuesNetworking
2Technical IssuesNetworking
- More and more gaming environments are supporting
networked multiplayer play. - Computer based games have supported network games
for many years. - Consoles are now also supporting network play.
- Not to mention the recent developments in gaming
on mobile and wireless devices (cell phones,
etc.). - Most new games released these days make use of
networking in some way. - Support and user communities.
- Delivery of patches, updates, and upgrades.
- Multiplayer gaming experiences.
3Networking Requirementsfor Video Games
- Consistency and synchronization
- All game players should see the game world in the
same state at the same time. - Low latency
- Delays between players should be low.
- This helps promote consistency.
- Scalability
- The game should be able to support a large number
of players without difficulties. - The game should also be able to scale in real
time as players enter and leave the game.
4Networking Requirementsfor Video Games
- Performance
- Sufficient network resources (e.g. bandwidth)
should be available to ensure the game runs
smoothly. - Reliability
- If part of the game goes down, the rest should
continue to function without major service
disruptions. - Security
- It should be easy to keep track of players and
prevent them from breaking game rules, cheating,
or abusing other players.
5Networked Game StructureThe Peer-to-Peer Model
Peer
Peer
. . .
Peer
Peer
Peer
6Networked Game StructureThe Peer-to-Peer Model
- Each player plays the game with the same program
as every other player. - Each such program is a peer.
- Each peer accepts player input, carries out game
processing, and provides feedback. - Each peer must communicate directly with all
other peers involved in the game to maintain
synchronization and game consistency. - All peers are equivalent in functionality and
standing in the networked game.
7Networked Game StructureThe Peer-to-Peer Model
- Advantages
- Conceptually very simple.
- All players have equal standing in the game,
providing some element of fairness. - Disadvantages
- Each players system must have sufficient
resources to support the game or everyone can
suffer. - Each player must know about all other players in
the game, with network resources consumed for
each pair of players in the game. (Using
multicasting or broadcasting will reduce this
problem, but will increase complexity in the
game.) - Consistency and synchronization may be difficult
to maintain, especially with many players.
8Networked Game StructureThe Peer-to-Peer Model
Screen shot from Doom. One of the first
multiplayer games, Doom used the peer-to-peer
model.
9Networked Game StructureThe Integrated Server
Model
Client/Server
Client
Client
Client
Client
. . .
10Networked Game StructureThe Integrated Server
Model
- The networked game is composed of two different
kinds of programs. - Multiple clients.
- A single integrated client/server.
- Clients are the player interfaces to the game,
taking their input and providing audio, visual,
and tactile feedback where appropriate. - The integrated client/server acts as a client to
one player, but has additional responsibilities. - Coordinates and synchronizes all player
activities. - Hosts any non player characters.
- Carries out the majority of processing involved
in serving the game out to players.
11Networked Game StructureThe Integrated Server
Model
- Advantages
- Players no longer need to know about every other
player in the game. - Total communication volume decreases.
- Consistency and synchronization is easier, as the
server is in sole control over the game. - Disadvantages
- Will the integrated server have the resources to
adequately handle all the players? - Will the player playing at the integrated server
have an unfair advantage in terms of reduced
latency and preferential server access? - How well will this scale?
- What if the server goes down?
12Networked Game StructureThe Integrated Server
Model
Screen shot from Starcraft. Starcraft supported
many network play options, including an
integrated client/server mode, as well as
Battle.net.
13Networked Game StructureThe Dedicated Server
Model
Client
Client
. . .
Server
Client
Client
Client
14Networked Game StructureThe Dedicated Server
Model
- In this model, the game is again split into two
different kinds of programs - Multiple clients.
- A single dedicated server.
- Clients serve the same purpose as in the previous
model, interfacing players to the game they are
playing. - The server in this case, however, is a separate
program without any client functionality. - Its sole purpose is to coordinate and synchronize
the game, and to serve it out to the players
clients.
15Networked Game StructureThe Dedicated Server
Model
- Advantages
- With separated functionality, there is no single
client with a clear unfair advantage. - If a dedicated machine is unavailable, the server
can be run on the same machine as one of the
clients, falling back to essentially an
integrated model. - Disadvantages
- Will clients closer to the server still have an
advantage over clients farther away? - Will the dedicated server have the resources to
support all of the clients? - How well will this scale?
- What if the server goes down?
16Networked Game StructureThe Dedicated Server
Model
Screen shot from Quake II. The Quake series of
games pushed the dedicated server model, and
provided dedicated servers for many different
platforms.
17Networked Game StructureThe Flat Server Model
Client
Client
Client
Client
Server
Server
Server
Client
Client
Client
Client
Server
Client
Client
Client
18Networked Game StructureThe Flat Server Model
- In this model, there are multiple dedicated
servers for scalability to support a much larger
number of players. - Each server must know about every other server in
use. - The servers must communicate with one another to
ensure consistency and synchronization between
all game players. - Each player uses a client to connect with a
dedicated server to access the game.
19Networked Game StructureThe Flat Server Model
- Advantages
- More scalable than single server approaches.
- More reliable, as there are multiple servers.
- Conceptually easy to manage servers.
- Disadvantages
- As number of servers grow, so does communication
overhead (unless multicasting or broadcasting is
used). - Consistency maintenance and synchronization are
more difficult now than before, especially with
more clients.
20Networked Game StructureThe Hierarchical Server
Model
Client
Client
Server
Client
Client
Server
Server
Client
Server
Client
Client
Client
Server
Client
Client
Client
21Networked Game StructureThe Hierarchical Server
Model
- In this model, additional servers are added
solely for the purpose of managing and
coordinating other servers. - This creates a hierarchy of servers, in a
tree-like configuration. - The server at the root of the tree has ultimate
responsibility over the entire game, but ensures
scalability by delegating many of its tasks to
lower level servers.
22Networked Game StructureThe Hierarchical Server
Model
- Advantages
- More scalable than flat server model.
- Reduced communications overhead.
- Disadvantages
- As the number of levels in the hierarchy grows,
latency between the various parts of the game
grows as well. - Consistency maintenance and synchronization are
even more difficult now than in the flat server
model, due to this increased latency. - What if the root server goes down?
23Networked Game StructureThe Grid Computing Model
Client
Client
Server
Server
Server
Client
Client
Server
Server
Client
Server
Client
Client
Client
Server
Server
Server
Client
Client
Client
24Networked Game StructureThe Grid Computing Model
- In this model, all of the servers act as a single
powerful parallel computer. - To the clients, the servers seem as if they are a
single logical computer. - Software on the servers automatically
redistributes player load to make use of free
resources and to reduce client latency. - All servers in the grid may be in the same
location, or they can be geographically
distributed around the world.
25Networked Game StructureThe Grid Computing Model
- Advantages
- Can scale to support a large number of players
adding servers to the grid is transparent. - Very reliable if a server is lost, player load
is shifted automatically to a new server. - Consistency and synchronization is handled
automatically by the grid software. - Disadvantages
- Very complex grid software required, although
standard software is emerging. - Very costly to provide.
26Networked Game StructureThe Grid Computing Model
The Butterfly Grid, shown to the left, isbeing
developed byButterfly.net to provide a
massively multiplayer environment for
videogames. It will use IBM technologies based
onLinux to support a variety of games on
various platforms, including Sonys
Playstation 2, and others.
27Game World Structuring
- Once you decide how to structure your game, you
must decide how to spread your game world over
the servers used to support your game. - Will each server be independent, or will they
work together to support a single massive game
world? - This is an important decision, and can have a
large impact on your game.
28Game World StructuringMultiple Worlds
- Each game server supports its own independent
game world. - The world, levels, characters, and game rules can
differ from server to server. - This is the easiest approach, as there is little
consistency management needed. - Players also like this approach, as they can find
a server providing a game world more to their
needs and style of game play. - Ultimately, however, this approach limits the
number of players in a single game at a time.
29Game World StructuringMultiple Worlds
Screen shot from Counter Strike. There are many
Counter Strike servers around the world, each
providing their own independent game.
30Game World StructuringThe Divided Single World
- A single world is supported across all servers,
but each server provides its own independent part
of the world. - Geographic region (planet, country, island, part
of a dungeon, etc.) - Level of game play.
- Chapter of an unfolding story.
- Players move between servers as they play.
- Each server still supports a limited number of
players in its region at a time. - By allowing players to move from server to
server, they have the illusion of a much larger
game world with many more players.
31Game World StructuringThe Divided Single World
Screen shot from Everquest. Everquest features
many different regions and zones across multiple
servers to support a very large world.
32Game World StructuringThe Single World
- In this approach, a single massive game world in
its entirety is supported by many servers at the
same time. - There are no independent servers they all
interact to support the same game world. - All players exist in the same world at the same
time, allowing for vastly different multiplayer
experiences. - Providing scalability to support this and
maintain consistency at the same time is quite
difficult.
33Game World StructuringThe Single World
Concept art for VibeForce. VibeForce is a MMORPG
for the PC, Playstation 2, and wireless devices
that will make use of the Butterfly Grid to
support a single massive game world.
34Locating Networked Games
- The first step to playing a networked game is to
locate one to participate in. - There are a variety of different techniques used.
- The choice of technique is very important to the
success of a game. - If it is too hard, users will find it difficult
to play. - Mechanisms that simplify the procedure are more
expensive, and can incur continuing costs
throughout the life time of a game.
35Locating Networked GamesDirect Connections
- The oldest and simplest approach of locating a
networked game requires a direct physical
connection between the two gaming systems. - PC systems required a serial connection.
- Consoles use a variety of techniques the Xbox
uses a crossover Ethernet connection. - With a direct connection, location is quite
simple the other game system can be found at the
other end of the connection. - While simple, it ultimately limits the number of
players possible, and restricts the location of
players to within a few metres of each other.
36Locating Networked GamesDirect Connections
Screen shot from Mech Assault. It supports
direct connection play to another Xbox with the
system link cable.
37Locating Networked GamesFixed Addresses
- In this approach, a game peer or server to
contact is listening on a fixed address for new
game players. - A specific phone number for a dial-up connection
using a modem. - A network address and port number for Internet
based games. - It is up to the player to know this address in
advance to connect into the game. - No location is actually required, as the game
simply contacts the fixed address directly to
join.
38Locating Networked GamesFixed Addresses
Screen shot of Quake II. The address book in
Quake II allowed players to record fixed
addresses to contact their favourite servers.
39Locating Networked GamesBroadcasting
- In this approach, game clients or peers broadcast
data onto the network to search for servers or
other peers. - When a server or peer receives a broadcast
message, it responds to notify the sender of
their address to join the game. - This approach is quite simple to implement (using
UDP, for example), but is typically restricted to
finding networked games on the same network. - Broadcast messages are usually not propagated
across routers and other network gear.
40Locating Networked GamesBroadcasting
Screen shot from Unreal Tournament 2003. It
allows you to browse through servers on the local
network using a broadcast mechanism.
41Locating Networked GamesLocation Services
- Location services run at fixed network addresses
known to the game itself. - When a new game server is started, it registers
its address and game information with the
location service. - When the player wishes to join a multiplayer
game, the game contacts the location service to
help track down a game meeting the players needs
and requirements. - When the player has selected a game to join, the
appropriate server is contacted according to its
registration information and play can begin as
usual.
42Locating Networked GamesLocation Services
- Location services can be hosted by the game
producer or by a third party. - Location services can provide many features to
game players - They can choose games based on server location,
game rules, levels, characters, and a variety of
other criteria. - They do not necessarily need to know any of the
other players to join a game. - Other features include the ability to run private
games, as well as other community services. - Because of their ease of use, these services are
becoming more common, despite their costs.
43Locating Networked GamesLocation Services
Screen shot from Xbox Live. Many features allow
easy multiplayer experiences on this console.
You can play with friends or complete
strangers. You can even have the system perform
an optimatch to link you up with players of
similar skill and ability automatically.
44Networked Communication
- Once a networked game is located and joined, the
game can proceed. - There are still, however, many communications
issues that must be resolved. - What to communicate.
- When to communicate.
- Where to communicate.
- How to communicate.
- These issues can have a great impact on the
success of a networked game.
45Networked CommunicationRules to Follow
- The following general guidelines should apply to
almost any networked game - Only send what is needed.
- Only send when it is needed.
- Only send to where it is needed.
- Following these rules is a good step towards
meeting the requirements of networked games
discussed earlier.
46Networked CommunicationWhat is Needed?
- The state of a game is essentially the complete
set of attributes describing all elements of a
game at a given point in time. - Remember that we want all players to see the game
world in the same state at the same time. - To do this, all changes in state must be sent to
all parts of the networked game. - Keep in mind that we want to minimize the amount
of communication, so we need to determine what to
send and what not to send.
47Networked CommunicationWhat is Needed?
- All changes in state that affect game play and
the outcome of the game must be sent. - Character movement and actions, object placement,
level condition, and so on. - Changes in backgrounds, ambience, atmosphere, and
so on should not be sent. - This can be a large amount of information!
- These can be handled in the individual peers and
clients independently if they do not affect game
play. - If desired, periodically synchronize random
number keys controlling these events for some
consistency.
48Networked CommunicationWhen is it Needed?
- Only communicate to indicate changes in the state
of the game. - When there is essentially nothing happening in a
game, there should be no network traffic being
generated! - Instead of communicating every change as it
happens individually, it might be more efficient
to collect them for a short period of time and
send several state changes at once. - Do not wait too long, however, or the games
state will become inconsistent across players. - You will need to experiment and tune this.
49Networked CommunicationWhere is it Needed?
- Not every change in game state needs to be sent
to every player in the game. - Only send changes in state to players that will
be affected by them! - For example, a player does not need to be
notified of character movement across the level
if the player cannot see or hear it once they
are in range, it becomes important. - Making these decisions can increase game
complexity, but it can provide large benefits to
network efficiency.
50Networked CommunicationHow to Communicate?
- Assuming that network play involves communication
over the Internet, the choice of transports to
use is limited. - There are two main choices
- TCP Transmission Control Protocol, a
connection-oriented Internet protocol. - UDP User Datagram Protocol, a connectionless
Internet protocol. - There are other protocols to use, but they can be
more complex and lack widespread support. - DiffServ, RSVP, and so on.
51Networked CommunicationHow to Communicate?
- About TCP
- More overhead, in establishing a connection, and
in maintaining connection resources. - Provides reliable, in order delivery of data in a
stream of bytes. - Also provides flow and congestion control to
regulate transmission rate of data. - About UDP
- No connection, so there is less overhead.
- Data can be lost or delivered out of order.
- Data is delivered with explicit boundaries
between messages. - UDP may have problems crossing through firewalls,
however, so this must be kept in mind.
52Networked CommunicationHow to Communicate?
- Ultimately, you must assess the needs and
requirements of your game and make your decisions
accordingly. - If reliability is important and no loss of data
can be tolerated, TCP may be better. (You can
still build reliability on top of UDP, however,
if you need to.) - If loss of data can be tolerated, UDP might be
more efficient in the end. - If you want to support massive numbers of
players, UDP might be necessary to avoid
connection overhead and connection restrictions.
53Other Networking IssuesPersistence
- Will the game world continue to exist and
function once a player leaves it? - If so, the game world is persistent.
- Persistence introduces several interesting
issues - What happens to player characters, their items,
and so on when the player leaves? - How does time pass in the persistent world?
- How does the game story unfold when certain
players are not always around? - How can the game action be split into reasonable
pieces that coexists with this persistence?
54Other Networking IssuesPersistence
- Keep in mind that persistence works better for
some games and game genres than others. - It is well suited to role-playing games.
- It can work well with action and adventure games,
if they are designed properly. - It can be difficult to work well with strategy
and sports games. (Who will take the players
place when they are gone, or will their side or
team be defeated again and again in their
absence?) - Persistence must be worked into a game early as
early in the design process as possible.
55Other Networking IssuesPersistence
Screen shot from Everquest. Games such as
Everquest provide a persistent world, even when
you are not around to participate in it.
56Other Networking IssuesSecurity in Games
- Traditional network security measures are
starting to appear in networked games for a
variety of purposes. - Authenticating game peers and clients to prevent
cheating. - Authenticating players for access control and
accounting purposes. - Authenticating and authorizing players to access
special game content. - Authenticating and authorizing administrators to
adjust game settings. - Preventing people from tampering with or
disrupting networked games. - Preventing players from abusing each other.
57Other Networking IssuesSecurity in Games
Screen shot from Shadowbane. Hackers once used
various exploits to wipe out new players
gathering in safe-holds, gain God-like powers,
and banish anentire city of people to under
water.
58Other Networking IssuesSecurity in Games
Screen shots from Dark Age of Camelot. In an
August 2003 security breach,hackers spawned
multiple high level creatures, shown above, that
wreakedhavoc and caused a lot of trouble on game
servers.
59Other Networking IssuesSecurity in Games
- How do we accomplish this?
- Password systems.
- Cryptographic mechanisms, for public key and
private key encryption. - Secure communication protocols such as SSL
(Secure Sockets Layer), TLS (Transport Layer
Security), and IPSec. - What are the costs?
- Increased complexity in game code.
- Increased processing requirements.
- Increased network requirements, as more data
must be exchanged to support security.
60Other Networking IssuesGoing Mobile
- Many companies are investigating mobile devices
as gaming platforms. - The traditional game developers.
- Manufacturers of cell phones and PDAs, as well as
service providers. - This would allow gamers to play at any time, with
anyone, anywhere. - This raises several interesting possibilities,
particularly for persistent games.
61Other Networking IssuesGoing Mobile
Nokia hopes that its N-Gage mobile gaming device
will lead to a whole newgeneration of networked
games. (That and a decent market share
whencompeting against Nintendos hand helds!)
62Other Networking IssuesGoing Mobile
- This kind of platform raises several interesting
and challenging networking issues. - Network and device capabilities.
- Packet and data loss.
- Interference.
- Disconnection of players.
- Relocation of players, both between network
segments and possibly devices as well.