Title: Game Networking 1
1Game Networking 1
2History of multiplayer gaming
- Tennis For Two
- William Higinbotham, a nuclear power plant
technician, 1958 - Players had to control the ball through the use
of knob and a push button - An analogue computer that was attached to a
modified oscilloscope
3Spacewar
- Steve Russell, Martin Graetz and Wayne Wiitanen,
MIT in 1961 - PDP-1
- Missiles and fuel
- Players had to shoot each others, while avoiding
to crash with stars. - The ships were controlled by four switches, that
turned the ship's direction, its speed, firing
rate and hyperspace.
4Atari
- Formed by Nolan Bushnell in 1972
- Developed pong in early 1970s
- Gauntlet in early 1980s
5Hosted games
- Dow Jones (The Source)
- Compuserv (H R Block)
- Used idle computer cycles
- Cost between 5 and 22.50 per hour
- Client server architectures
- Telnet client
- Puzzles, spells traps
6Doom
- 1993
- First multi-player 3D networked game
- Up to 4 players, co-op or deathmatch
- Used IPX (non routable protocol) on a LAN
- Peer to peer
- Each peer updates all others 35 times a second
- When updates received from all peers, the game
advances a tick
7Problems with Doom
- All packets received by all nodes on the network
- Hosts had to process the packet, even though they
were not playing the game! - Led to lots of companies banning Doom
- More users than OS/2 and WinNT combined!
8Architectures
- Peer-to peer
- No central node controlling game state
- Works well on LANS, does not scale
- Client server
- One server
- Clients communicate with each other through the
server - Peer-to peer, client server hybrid
- Some data communicated between peers eg voice chat
9Evolution of online games
- Quake/QuakeWorld (1996)
- Didn't need tunnelling to communicate over the
internet - Used IP instead of IPX
- Persistent servers
- Client server prediction (dead reckoning)
- Push latency control on the client (the amount of
dead reckoning to use) - Development of clans
- Commercial competitions cyberathletes
10Dead Reckoning
- Dead reckoning uses prediction to move objects
about even when their positions are not precisely
known, reducing the appearance of lag - Each client maintains precise state for some
objects (e.g. local player) - Each client receives periodic updates of the
position of everyone else, along with velocity
information, and maybe acceleration - On each frame, the non-local objects are updated
by extrapolating their most recent position using
the available information - With a client-server model, each player runs
their own version of the game, while the server
maintains absolute authority
11Fixing Extrapolation Errors
- What do you do when using dead reckoning, and a
new position arrives for another player? - The position that just came in will not agree
with the place you have the object, due to
extrapolation errors - Two options
- Jump to the correct position
- Interpolate the two positions over some period
- Path followed will never be exact, but will match
reasonably well
Target Path
Your Guess
Extrapolations from new data
Actual
New Data
12(No Transcript)
13Massively multiplayer Games
- 1995 Ultima Online (50 players)
- Microsoft releases
- Ashrons call
- Everquest (500,000 subscribers 1993)
- World of Warcraft
- 2004
14(No Transcript)
15Currently...
- All online gaming happens over IP networks The
Internet and intranets - MMORPG
- FPS
- RTS
- http//beej.us/guide/bgnet/ for a guide!!
164 Primary concerns
- Latency How long does it take for state to be
transmitted - Reliability How often is data lost or corrupted
- Bandwidth How much data can be transmitted in a
given time - Security How is the game-play protected from
tampering
17Reducing Latency
- Frame rate latency
- Increase the frame rate (faster graphics, faster
AI, faster physics) - Network protocol latency
- Send less stuff (less stuff to copy and shift
around) - Switch to a protocol with lower latency
- But may have impact on reliability and security
- Transmission latency
- Send less stuff less time between when the
first bit and the last bit arrive - Upgrade your physical network (from dial-up to
DSL, for instance)
18Working With Latency
- If you cant get rid of latency, you can try to
hide it - Any technique will introduce errors in some form
- you cannot provide immediate, accurate
information - Option 1 Sacrifice accurate information, and
show approximate positions - Ignore the lag and show a given player old
information about the other players - Try to improve upon this by guessing where the
other players are. But if your guess is wrong,
incorrect information is shown - Option 2 Sacrifice game-play
- Deliberately introduce lag into the local
players experience, so that you have enough time
to deal with the network
19The Internet is short for
20What is a network?
- From dictionary.com
- An openwork fabric or structure in which cords,
threads, or wires cross at regular intervals. - Something resembling an openwork fabric or
structure in form or concept, especially - A system of lines or channels that cross or
interconnect a network of railroads. - A complex, interconnected group or system an
espionage network. - An extended group of people with similar
interests or concerns who interact and remain in
informal contact for mutual assistance or support.
21IP
- Layered protocols
- Packet switched network
- Hierarchical routing
- Best effort
- Edges core nodes
- IP Address 32 bit number
- Tells you the exact node you are dealing with
- Tells you where on the network that node is
- Usually written as 4 octets or dotted quads
22(No Transcript)
23TCP
- Uses IP
- Creates bi-directional paths
- Reliable, ordered transfer of bytes
- Explicit acknowledgement of packets received
- Can detect if losses have occurred and resend
- TCP can keep retransmitting for seconds in the
case of packet loss - Not suitable for real time messaging (FPS)
- Uses a 16 bit port number (sender receiver)
- Allows multiplexing of messages, multiple peer
process
24UDP
- Connectionless
- Unreliable (packets can get lost)
- No flow control (packets can arrive out of order)
- Uses a 16 bit port number (sender receiver)
- Allows multiplexing of messages, multiple peer
process
25Port numbers
- Well known port numbers
- 25 SMTP
- 80 HTTP
26DNS
- Domain Name Service
- Uses UDP
- Converts a 32 bit IP address to a friendly name
and visa versa - You can use
- NSLOOKUP on the command line
27DHCP
- Uses UDP
- You send a broadcast message looking for an IP
address - DHCP servers respond with offers
- You send a message back to DHCP server with an
acceptance
28Protocols
- Standard messages that get passed between nodes
on the internet - Usually standardised in an RFC
29What do protocols look like?
- Binary
- Fixed-length fields, like C-structures
- Type-length-value (TLV)
- Text
- ftp PUT foo
- GET index.html HTTP/1.1
- Content-Length 100
30HTTP Protocol
RFCs 1945 2068 2616
Parameters
Request
Web Browser
Response
Query
E.g. A user fills in a form, which gets submitted
to a web server Port Numbers (16 bit numbers)
identify the service
Results
Web Server
Database (Optional)
http//www.ietf.org/rfc/rfc1945.txt?number1945
31SMTP Protocol
RFCs 821 974 1869 2821
- Simple Mail Transfer Protocol
- Protocol for sending Email
- Originally designed for a secure network
Mail Client
Mail Server
Mail Server
Mail Server
Issues? Security Non-repudiation
http//www.ietf.org/rfc/rfc0821.txt?number821
32Protocol Stacks
33Which to use?From http//www.gamedev.net/communi
ty/forums/showfaq.asp?forum_id15
- Turn-based
- TCP
- RTS games
- TCP
- For role playing games
- UDP, whereas
- Slower RPGs and MUDs
- TCP.
- Action-based games like first-person shooters or
racers - Absolutely use UDP.
34Sockets
- A software interface to the internet
- Create on and you can read and write data to/from
nodes on the internet - Supported on Windows
- Version 1.0 1992
- Version 1.1 1993
- Version 2.0 1995
- Sockets for IP v6 2001
- Can be TCP, UDP
- Can be blocking, non-blocking or asynchronous