Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5.6 Network and Multiplayer edited by Jeffery.

Similar presentations


Presentation on theme: "Chapter 5.6 Network and Multiplayer edited by Jeffery."— Presentation transcript:

1 Chapter 5.6 Network and Multiplayer edited by Jeffery

2 2 Multiplayer Modes: Event Timing Turn-Based Easy to implement Any connection type Real-Time Difficult to implement Latency sensitive Internet adds Lots o’ Latency

3 3 Multiplayer Modes: Shared I/O, Single Engine Input Devices Shared keyboard layout Multiple devices (e.g. trackballs) Display Full Screen, varying modes Split Screen For this class: network instead!

4 4 Protocols: Protocol Design Packet Format and Length Acknowledgement Methodology Error Checking / Correcting Compression Encryption Packet Control

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

6 6 Protocol Stack: Open System Interconnect

7 7 Protocol Stack: Physical Layer Bandwidth Capacity 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, … SerialDSLCable LAN 10/100/1G BaseT Wireless 802.11 b/g/n T1 Speed (bps) 20K 1.5M down 896K up 3M down 256K up 10M 100M 1G b=11M g=54M n=70-150M 1.5M Table: Max Bandwidth Specifications

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

9 9 Protocol Stack: Network Layer Packet Routing Hops Routers, Hubs, Switches Internet Protocol (IP) Contains Source & Destination IP Address IPv4 Widespread Infrastructure IPv6 Larger IP address

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

11 11 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.

12 12 Protocol Stack: Transport Layer Manage data delivery, src to dest 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

13 13 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

14 14 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

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

16 16 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()

17 17 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

18 18 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

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

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

21 21 Real-Time Communications: Connection Models Broadcast Good for player discovery on LANs Peer to Peer Good for 2 player games Made difficult by NAT Client / Server Good for 2+ player games Dedicated lobby server for player discovery

22 22 Real-Time Communications: Peer to Peer vs. Client/Server BroadcastPeer/PeerClient/Server Connections0 Client = 1 Server = N N = Number of players BroadcastPeer/PeerClient/Server Send1N-1 Client = 1 Server = N ReceiveN-1 Client = 1 Server = N

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

24 24 Security: Encryption Goals Authentication Privacy Integrity

25 25 Security: Firewalls Packet Filter Proxies Circuit Gateways

26 26 Security: Firewalls: Network Address Translation

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

28 28 Summary: Topic Coverage Multiplayer Modes Protocols Protocol Stack Real-Time Communications Security

29 29 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


Download ppt "Chapter 5.6 Network and Multiplayer edited by Jeffery."

Similar presentations


Ads by Google