Chapter 5 6 Network and Multiplayer Multiplayer Modes

  • Slides: 34
Download presentation
Chapter 5. 6 Network and Multiplayer

Chapter 5. 6 Network and Multiplayer

Multiplayer Modes: Event Timing n Turn-Based n n n Easy to implement Any connection

Multiplayer Modes: Event Timing n Turn-Based n n n Easy to implement Any connection type Real-Time n n Difficult to implement Latency sensitive 2

Multiplayer Modes: Shared I/O n Input Devices n n n Shared keyboard layout Multiple

Multiplayer Modes: Shared I/O n Input Devices n n n Shared keyboard layout Multiple device mapping Display n Full Screen n Funneling Screen Swap Split Screen 3

Multiplayer Modes: Connectivity n Non Real-Time n n Direct Link n n Serial, USB,

Multiplayer Modes: Connectivity n Non Real-Time n n Direct Link n n Serial, USB, Ir. D, … (no hops) Circuit Switched (phones) n n Floppy disk net Email Database Dedicated line with consistent latency Packet Switched n n Internet Shared pipe 4

Protocols: Protocol Design n n n Packet Length Conveyance Acknowledgement Methodology Error Checking /

Protocols: Protocol Design n n n Packet Length Conveyance Acknowledgement Methodology Error Checking / Correcting Compression Encryption Packet Control 5

Protocols: Packets n n n Header = Protocol Manifest Payload Gottchas n n n

Protocols: Packets n n n Header = Protocol Manifest Payload Gottchas n n n n Pointers Large/Variable Size Arrays ADTs Integer Alignment Endian Order Processor dependant Intrinsic Types (int and long) Unicode vs. ASCII Strings 6

Protocols: Request for Comments n RFC web site n n http: //www. rfc-editor. org/

Protocols: Request for Comments n RFC web site n n http: //www. rfc-editor. org/ Protocol Specifications n n n Definitive Resource Public Criticism Future Protocols 7

Protocol Stack: Open System Interconnect 8

Protocol Stack: Open System Interconnect 8

Protocol Stack: Physical Layer n Bandwidth n n n Latency n n n Width

Protocol Stack: Physical Layer n Bandwidth n n n Latency n n n Width of data pipe Measured in bps = bits per second Travel time from point A to B Measured in Milliseconds The Medium n Fiber, Fire. Wire, Ir. D , CDMA & other cell Table: Max Bandwidth Specifications Speed (bps) Serial USB 1&2 ISDN DSL 20 K 12 M 480 M 128 k 1. 5 M down 896 K up Cable LAN 10/100/1 G Base. T Wireless 802. 11 a/b/g Power Line T 1 3 M down 256 K up 10 M 100 M 1 G b=11 M a, g=54 M 1. 5 M 9

Protocol Stack: Data Link Layer n n Serializes data to/from physical layer Network Interface

Protocol Stack: Data Link Layer n n Serializes data to/from physical layer Network Interface Card n n Ethernet MAC Address 10

Protocol Stack: Network Layer n Packet Routing n n n Hops Routers, Hubs, Switches

Protocol Stack: Network Layer n Packet Routing n n n Hops Routers, Hubs, Switches Internet Protocol (IP) n n Contains Source & Destination IP Address IPv 4 n n Widespread Infrastructure IPv 6 n Larger IP address 11

Protocol Stack: Network Layer: IP Address n Unicast n n n Multicast n n

Protocol Stack: Network Layer: IP Address n Unicast n n n Multicast n n n Local Directed Loop Back n n Requires multicast capable router Broadcast n n Static DHCP Send to self Addr. Any n 0 = address before receiving an address 12

Protocol Stack: Network Layer: DNS n Domain Name Service n n Converts text name

Protocol Stack: Network Layer: DNS n Domain Name Service n n Converts text name to IP address Must contact one or more DNS servers to resolve Local cache resolution possible Game Tips n n Store local game cache to use when DNS out of order. DNS resolution often slow, use cache for same day resolution. 13

Protocol Stack: Transport Layer n Manage data deliver between endpoints n n n TCP

Protocol Stack: Transport Layer n Manage data deliver between endpoints n n n TCP and UDP used with IP n n Error recovery Data flow Contains Source and Destination Port + IP = Net Address n n Port Range = 0 -64 k Well known Ports 0 -1 k 14

Protocol Stack: Transport Layer: TCP n Guaranteed Correct In Order Delivery n Acknowledgement system

Protocol Stack: Transport Layer: TCP n Guaranteed Correct In Order Delivery n Acknowledgement system n n Checksum Out of Band Connection Required n n Ack, Nack, Resend Packet Window Packet Coalescence Keep Alive Streamed Data n User must serialize data 15

Protocol Stack: Transport Layer: UDP n Non Guaranteed Delivery n n Not Connected n

Protocol Stack: Transport Layer: UDP n Non Guaranteed Delivery n n Not Connected n n No Acknowledgement system May arrive out of order Checksum Source not verified Hop Count Limit = TTL (time to live) Required for Broadcasting Datagram n Sent in packets exactly as user sends them 16

Protocol Stack: Session Layer n Manages Connections between Apps n n Connect Terminate Data

Protocol Stack: Session Layer n Manages Connections between Apps n n Connect Terminate Data Exchange Socket API live at this layer n n Cross platform Cross language 17

Protocol Stack: Session Layer: Sockets n Based on File I/O n n File Descriptors

Protocol Stack: Session Layer: Sockets n Based on File I/O n n File Descriptors Open/Close Read/Write Winsock n n Provides standard specification implementation plus more Extension to spec prefixed with “WSA” Requires call to WSAStartup() before use Cleanup with WSAShutdown() 18

Protocol Stack: Session Layer: Socket Design n Modes n n n Standard Models n

Protocol Stack: Session Layer: Socket Design n Modes n n n Standard Models n n n Blocking Non-Blocking Standard Select Extended Models n Windows n n n WSAEvent. Select I/O Completion Ports Unix n n Poll Kernel Queues 19

Protocol Stack: Presentation Layer n Prepares App Data for Transmission n Compression n n

Protocol Stack: Presentation Layer n Prepares App Data for Transmission n Compression n n n Encryption Endean Order n n Pascal Strings String Tables Float to Fixed Matrix to Quaternion When used cross platform or cross language Serialize n n Pointers Variable Length Arrays 20

Protocol Stack: Presentation Layer: Buffering n Packet Coalescence n Induced Latency n Dead Data

Protocol Stack: Presentation Layer: Buffering n Packet Coalescence n Induced Latency n Dead Data n Large Packets 21

Protocol Stack: Application Layer n n Handles Game Logic Update Models n n n

Protocol Stack: Application Layer n n Handles Game Logic Update Models n n n Input Reflection State Reflection Synchronization n Dead Reckoning AI Assist Arbitration 22

Real-Time Communications: Connection Models n Broadcast n n Peer to Peer n n Good

Real-Time Communications: Connection Models n Broadcast n n Peer to Peer n n Good for player discovery on LANs Good for 2 player games Client / Server n n Good for 2+ player games Dedicated lobby server great for player discovery 23

Real-Time Communications: Peer to Peer vs. Client/Server N = Number of players Broadcast Connections

Real-Time Communications: Peer to Peer vs. Client/Server N = Number of players Broadcast Connections Send Receive Peer/Peer Client/Server Client = 1 Server = N 0 Broadcast Peer/Peer Client/Server 1 N-1 Client = 1 Server = N 24

Real-Time Communications: Asynchronous Environments n Thread n n n Priority Suspension Pooling Critical Section

Real-Time Communications: Asynchronous Environments n Thread n n n Priority Suspension Pooling Critical Section & Mutex Signal & Event Data Sharing n n volatile keyword Interlocked Inc/Dec 25

Security: Encryption Goals n Authentication n Privacy n Integrity 26

Security: Encryption Goals n Authentication n Privacy n Integrity 26

Security: Encryption Methods n Keyed n n n Public Key Private Key Ciphers Message

Security: Encryption Methods n Keyed n n n Public Key Private Key Ciphers Message Digest Certificates IPSec 27

Security: Copy Protection n Disk Copy Protection n n Costly Mastering Invalid/Special Sector Read

Security: Copy Protection n Disk Copy Protection n n Costly Mastering Invalid/Special Sector Read Code Sheets Watermarking 28

Security: Execution Cryptography n n n n Code Obfuscation Strip Symbols Heap Hopper Stack

Security: Execution Cryptography n n n n Code Obfuscation Strip Symbols Heap Hopper Stack Overrun Execution No. Op Hacking Timer Hacking DLL Shims 29

Security: Firewalls n Packet Filter n Proxies n Circuit Gateways 30

Security: Firewalls n Packet Filter n Proxies n Circuit Gateways 30

Security: Firewalls: Network Address Translation 31

Security: Firewalls: Network Address Translation 31

Security: Firewalls: NAT Traversal n Port Forwarding n Port Triggering n DMZ n Determining

Security: Firewalls: NAT Traversal n Port Forwarding n Port Triggering n DMZ n Determining WAN IP 32

Summary: Topic Coverage n n n Multiplayer Modes Protocol Stack Real-Time Communications Security 33

Summary: Topic Coverage n n n Multiplayer Modes Protocol Stack Real-Time Communications Security 33

Summary: Further Study n n n Socket Programming Serial Communication Server Design Network Gear

Summary: Further Study n n n Socket Programming Serial Communication Server Design Network Gear & Infrastructure VOIP Tools of the Trade Unit & Public Beta Testing Middleware Databases Web Development Asynchronous Programming 34