chapter 5.6 network and multiplayer sundeep myneni comp 7970

34
Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

Post on 21-Dec-2015

230 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

Chapter 5.6Network and Multiplayer

SUNDEEP MYNENI

COMP 7970

Page 2: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

2

Multiplayer Modes:Event Timing

Turn-Based Easy to implement Any connection type

Real-Time Difficult to implement Latency sensitiveShared I/O

Page 3: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

3

Multiplayer Modes:Shared I/O

Input Devices Shared keyboard layout Multiple device mapping

Display Full Screen

Funneling Screen Swap

Split Screen

Page 4: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

4

Multiplayer Modes:Connectivity Non Real-Time

Floppy disk net Email Database

Direct Link Serial, USB, IrD, … (no hops)

Circuit Switched (phones) Dedicated line with consistent latency

Packet Switched Internet Shared pipe

Page 5: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

5

Protocols:Protocol Design

Packet Length Conveyance Acknowledgement Methodology Error Checking / Correcting Compression Encryption Packet Control

Page 6: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

6

Protocols:Packets

Packets The logical transmission units of

protocol. It consists of two parts 1) Header :- Contains formats

elements of protocol. 2)Payload :- It is a Binary large Object

Page 7: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

7

Protocols: Request for Comments

RFC web site http://www.rfc-editor.org/

Protocol Specifications Definitive Resource Public Criticism Future Protocols

Page 8: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

8

Protocol Stack: Open System Interconnect

R outer

Sender R eceiver

Ne two rk

D a ta L in k

Physica l

Ne two rk

D a ta L in k

Physica l

App lica tio n

Pre se n ta tio n

Session

T ra nspo rt

Ne two rk

D a ta L in k

Physica l

App lica tio n

Pre se n ta tio n

Session

T ra nspo rt

Ne two rk

D a ta L in k

Physica l

G am e E vents

G am e P ac k et iz at ion

Connec t ion & Data E x c hange

Input UpdatesS tate Updates

S eria liz at ionB uffering

S oc k ets

TCPUDP

IP

E thernet (M A C)

W ired (C5, Cable)F iber O pt ic sW ire les s

Page 9: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

9

Protocol Stack:Physical Layer Bandwidth

Width of data pipe Measured in bps = bits per second

Latency Travel time from point A to B Measured in Milliseconds

The Medium Fiber, FireWire, IrD , CDMA & other cell

SerialUSB1&2

ISDN DSL CableLAN

10/100/1GBaseT

Wireless802.11a/b/g

Power Line

T1

Speed(bps)

20K12M

480M128k

1.5M down896K up

3M down256K up

10M100M

1G

b=11Ma,g=54M

14M 1.5M

Table: Max Bandwidth Specifications

Page 10: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

10

Protocol Stack:Data Link Layer

Serializes data to/from physical layer

Network Interface Card Ethernet MAC Address

Page 11: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

11

Protocol Stack:Network Layer Packet Routing

Hops Routers, Hubs, Switches Trace packets to Google. COM

Internet Protocol (IP) Contains Source & Destination IP Address IPv4

This address contains 4 bytes displayed in 8 bit decimals

255.000.255.000 IPv6

This address contains 16 bytes ,displayed in 16 bit hex. FFFF:FFFF:0000:0000:FFFF:FFFF:0000:0000

Page 12: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

12

Protocol Stack:Network Layer: IP Address Unicast

Static (User Assigned) DHCP (Dynamic Host Configuration Protocol)

Multicast Requires multicast capable router

Broadcast Local Directed

Loop Back Send to self

Address Any 0 = address before receiving an address

Page 13: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

13

Protocol Stack:Network Layer: DNS Domain Name Service

Converts text name to IP address Must contact one or more DNS servers to

resolve Local cache resolution possible

Game Tips Store local game cache to use when DNS out

of order. DNS resolution often slow, use cache for

same day resolution.

Page 14: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

14

Protocol Stack:Transport Layer Manage data deliver between

endpoints Error recovery Data flow

TCP and UDP used with IP Contains Source and Destination Port

Port + IP = Net Address Port Range = 0-64k Well known Ports 0-1k

Page 15: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

15

Protocol Stack:Transport Layer: TCP Guaranteed Correct In Order Delivery

Acknowledgement system Ack, Nack, Resend

Checksum Out of Band

Connection Required Packet Window Packet Coalescence Keep Alive

Streamed Data User must serialize data

Page 16: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

16

Protocol Stack:Transport Layer: UDP Non Guaranteed Delivery

No Acknowledgement system May arrive out of order Checksum

Not Connected Source not verified Hop Count Limit = TTL (time to live) Required for Broadcasting

Datagram Sent in packets exactly as user sends them

Page 17: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

17

Protocol Stack:Session Layer

Manages Connections between Apps Connect Terminate Data Exchange

Socket API live at this layer Cross platform Cross language

Page 18: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

18

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

File Descriptors Open/Close Read/Write

Winsock Provides standard specification

implementation plus more Extension to spec prefixed with “WSA” Requires call to WSAStartup() before use Cleanup with WSAShutdown()

Page 19: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

19

Protocol Stack:Session Layer: Socket Design Modes

Blocking Non-Blocking

Standard Models Standard Select

Extended Models Windows

WSAEventSelect I/O Completion Ports

Unix Poll Kernel Queues

Page 20: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

20

Protocol Stack:Presentation Layer Prepares App Data for Transmission

Compression Pascal Strings String Tables Float to Fixed Matrix to Quaternion

Encryption Endean Order

When used cross platform or cross language Serialize

Pointers Variable Length Arrays

Page 21: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

21

Protocol Stack:Presentation Layer: Buffering

Packet Coalescence

Induced Latency

Dead Data

Large Packets

Page 22: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

22

Protocol Stack:Application Layer Handles Game Logic Update Models

Input Reflection State Reflection

Synchronization Dead Reckoning AI Assist Arbitration

Page 23: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

23

Real-Time Communications:Connection Models Broadcast

Good for player discovery on LANs Peer to Peer

Good for 2 player games Client / Server

Good for 2+ player games Dedicated lobby server great for

player discovery

Page 24: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

24

Real-Time Communications:Peer to Peer vs. Client/Server

Broadcast Peer/Peer Client/Server

Connections 0Client = 1Server = N

N = Number of players

Broadcast Peer/Peer Client/Server

Send 1 N-1Client = 1 Server = N

Receive N-1 N-1Client = 1Server = N

1

1

N

x

x

P 1 P 2

P 1

P 2 P 3

P 1 P 4

P 2 P 3

P 1

P 2 P 5

P 3 P 4

2 p lay er s1 c o n n ec tio n

3 p lay er s3 c o n n ec tio n s

4 p lay er s6 c o n n ec tio n s

5 p lay er s1 0 c o n n ec tio n s

Page 25: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

25

Real-Time Communications:Asynchronous Environments

Thread Priority Suspension Pooling

Critical Section & Mutex Signal & Event Data Sharing

volatile keyword Interlocked Inc/Dec

Page 26: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

26

Security:Encryption Goals

Authentication

Privacy

Integrity

Page 27: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

27

Security:Encryption Methods

Keyed Public Key Private Key Ciphers :- Block Ciphers , Stream

Ciphers Message Digest Certificates IPSec

Page 28: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

28

Security:Copy Protection

Disk Copy Protection Costly Mastering Invalid/Special Sector Read

Code Sheets Watermarking

Page 29: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

29

Security:Execution Cryptography

Code Obfuscation Strip Symbols Heap Hopper Stack Overrun Execution NoOp Hacking Timer Hacking DLL Shims

Page 30: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

30

Security:Firewalls

Packet Filter

Proxies

Circuit Gateways

Page 31: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

31

Security:Firewalls: Network Address Translation

LAN Add re ss W AN Add re ss

1 92 .1 6 8 .1 .1 :2 0 0 2 4 .1 5 .1 .1 1 8 :2 0 0

1 92 .1 6 8 .1 .1 :2 0 1 2 4 .1 5 .1 .1 1 8 :2 0 1

1 92 .1 6 8 .1 .2 :1 9 9 2 4 .1 5 .1 .1 1 8 :1 9 9

1 92 .1 6 8 .1 .2 :2 0 0 2 4 .1 5 .1 .1 1 8 :4 0 0 0*

I S P

W AN I P2 4 .1 5 .1 .1 1 8

L AN I P1 9 2 .1 6 8 .1 .1

L AN I P1 9 2 .1 6 8 .1 .2

N A TR eq u es ted P o r ts2 0 02 0 1

R eq u es ted P o r ts1 9 92 0 0

R o u ter

Page 32: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

32

Security:Firewalls: NAT Traversal

Port Forwarding

Port Triggering

DMZ

Determining WAN IP

Page 33: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

33

Summary:Topic Coverage

Multiplayer Modes Protocols Protocol Stack Real-Time Communications Security

Page 34: Chapter 5.6 Network and Multiplayer SUNDEEP MYNENI COMP 7970

34

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