Download Networking Multiplayer Games - Lecture Notes | EECS 494 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!
Networking Multiplayer Games
EECS 494 Fall 2005
Sugih Jamin [email protected]
Multiplayer Games
Why multiplayer games?
- humans are better at most strategy than current AIs
- humans are less predictable
- can play with people, communicate in natural language
- add social aspect to computer games
- provides larger environments to play in, with more characters
- make money as a professional game player
MMOG
Most MMOGs are MMORPGs:
- server(s) keep persistent states, players can drop in anytime
- traditionally emphasize social interaction (less combat, but changing)
- in the beginning: MUD/MOO (1978, text-based)
- first commercial titles: Meridian 59 (c. 1996) and others, together had ≤ 30 , 000 players
MMORPGs
- Ultima Online (Origin Sys- tems/EA, gold Sept. 27, 97): o isometric view o took 3 years to developed o > 100 , 000 players in 1998 240,000 players in 2001, 225,000 in Apr. 2003
- Everquest (Verant/Sony, gold Mar. 16, 1999): o first non-wireframe 3D entry, o 300,000 players in 2000, 430,000 in 2002 o total revenue: $4 mil/month (BW, 11/9/01)
An Analysis of MMOG Subscription Growth
by Bruce S. Woodcock
http://www.mmogchart.com/
Networking in Games
Differentiate between in-game networking and backend infrastructure
Backend infrastructure (see Yahn Bernier’s talk at GDC rtsp://media.cmpnet.com/gamasutra/bernier.rm):
- lobby where gamers meet
- authentication and CD key checking
- accounting and billing
- ranking and ladder
- reputation and black list
- buddy lists, clans, and tournaments
- mods and patches management
- virtual economy
- beware of DDoS
Issues: scalability, adapting to failure, security
Peer-to-Peer
Peer-to-peer with O(N 2 ) unicast connections:
- each player is connected directly to all other players
- each player simulates the whole world
- advantages: reduced latency, no single point of failure
- disadvantages: easier to cheat, not scalable: each client must send and receive N -1 messages
- used in Age of Empire
Player
Player
Player
Player
Player
Player
Player
Player
Client-server
Two flavors:
- ad-hoc servers: death match
- dedicated servers: MMORG
Two types of clients:
- clients simulate world, server has authoritative state: allows for client-side dead reckoning (QuakeIII/Half-Life).
- clients for I/O, all simulations at server: useful for thin clients, e.g. cell phones, and persistent-world MMOG.
MMOG Server Architecture 1
The world replicated at each server (shard); each shard contains an independent world; players go to specific shard:
Shard
Player
Player
Player
Player
Player
Player
Shard
Player
Player
Player
Player Player
Most MMORPG
MMOG Server Architecture 2
The world replicated at each server (mirror); all the worlds are synchronized; players see everyone across all mirrors:
Mirror
Player
Player
Player
Player
Player
Player
Mirror
Player
Player
Player
Player Player
High-speed Connection
Mirrors must be kept consistent
Distributed Computing Model
Usually your game company will have its preferred computing model and would provide high-level libraries to implement the model
Distributed objects:
- characters and environment maintained as objects
- player inputs are applied to ob- jects (at server)
- changes to objects propagated to all players at end of game loop
- object update usually imple- mented as one or more library calls
Initialization Overall GameControl Game SessionControl
Local PlayerInput
Send & ReceiveObject Updates
Main Logic:- update objects
- game AI- physics
- collision
Render sceneto buffer
Copy buffer todisplay
Time sync
Distributed Computing Model
Message passing:
- player inputs (either button pushes or higher-level move- ments) are sent to other players (or server)
- all players update their own game state
- or server updates the global game state and send it out to all players
Initialization Overall GameControl Game SessionControl
Local PlayerInput Receive RemotePlayer(s) Input Main Logic:- update states
- game AI- physics
- collision
Local Input^ Send
Render sceneto buffer
Copy buffer todisplay
Time sync
TCP vs. UDP
IP routes packet from source to destination, max IP packet size is 64 KB, may be fragmented
What TCP (Transmission Control Protocol) gives you:
- reliable delivery
- retransmission and reordering
- congestion control
What UDP (User Datagram Protocol) gives you:
- unreliable delivery
- no retransmission, packets not ACKnowleged, no reordering
- no congestion control
- so, more or less, plain IP service
Which Protocol to Use?
Game requirements:
- late packets may not be useful anymore
- lost information can sometimes be interpolated
- but loss statistics may be useful
Use UDP in game:
- can prioritize data
- can perform reliability if needed
- can filter out redundant data
- use soft-state
- send absolute values, not deltas
- or if deltas are used, send “baseline” data periodically
- must do congestion control if sending large amount of data