1 / 27

Network and Multiplayer Modes: Event Timing, Turn-Based, Real-Time, and Difficult to Implement

This chapter explores different multiplayer modes in game development, including event timing, turn-based, and real-time modes. It also discusses the challenges of implementing multiplayer functionality and the sensitivity to latency.

aparadise
Download Presentation

Network and Multiplayer Modes: Event Timing, Turn-Based, Real-Time, and Difficult to Implement

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5.6Network and Multiplayer

  2. Multiplayer Modes:Event Timing Turn-Based Real-Time Difficult to implement Latency sensitive

  3. Multiplayer Modes:Shared I/O Input Devices Shared keyboard layout - yuck Multiple device mapping Display Full Screen Funneling - everyone stays togetherish Screen Swap – turn based Split Screen – common on consoles

  4. Multiplayer Modes:Connectivity Non Real-Time Email, database, etc. Direct Link Serial, USB, IrD, … (no hops) Virtual Circuit (phones) Dedicated or bandwidth-reserved network Packet Switched Internet Shared pipe == highly variable

  5. Protocols:Protocol Design Packet Length Acknowledgment Methodology Error Checking / Correcting Compression Encryption

  6. Protocols:Packets Packets Header = Protocol Manifest Payload Gotchas (No) Pointers Large Data, Variable Size Data ADTs Byte Alignment Endian Order Processor dependent Types and Sizes (int and long) Unicode vs. ASCII Strings

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

  8. Protocol Stack: Open System Interconnect

  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 (<50 local, 150 typical, 1500+ common) Table: Max Bandwidth Specifications

  10. Protocol Stack:Network Layer Packet Routing Hops (check out traceroute) Routers, Hubs, Switches Internet Protocol (IP) Contains Source & Destination IP Address In practice, public vs. private internet IP# gets to your firewall/router NAT is ubiquitous Peer-to-peer and servers harder to write

  11. Protocol Stack:Network Layer: IP Address Normal == Unicast Send to one particular IP# Static vs. DHCP Multicast Requires multicast capable router Broadcast Local Directed Loop Back Send to self AddrAny 0 = address before receiving an address

  12. 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 often out of order DNS resolution often very slow, use cache for same day resolution.

  13. Protocol Stack:Transport Layer Manage data delivery between endpoints Error recovery - retransmit Data “flow” - reorder TCP and UDP sit atop IP Contains Source and Destination Port Port + IP = Net Address Port Range = 0-64k Well known Ports 0-1k

  14. Protocol Stack:Transport Layer: TCP Guaranteed Correct In Order Delivery Acknowledgement system Ack, Nack, Auto Resend Checksum Out of Band Connection Required-kinda slow to setup Packet Window Packet Coalescence Keep Alive Streamed Data A byte sequence. User must serialize data

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

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

  17. 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()

  18. Protocol Stack:Session Layer: Socket Design Modes Blocking – requires dedicated thread, single connection Non-Blocking Standard Models Standard “select” - multiple net connections, e.g. X11, VE server, and DB server if all serviced by same thread

  19. Protocol Stack:Presentation Layer Prepares App Data for Transmission Compression Consider using “Pascal strings”. String Tables – JSON vs. XML, reduction to ints Float to Fixed Matrix to Quaternion Encryption Endean Order When used cross platform or cross language Serialize Pointers --> transmit via deep copy or proxy Variable Length Arrays

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

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

  22. Real-Time Communications:Connection Models Broadcast Mostly obsolete, except for player discovery on LANs Peer to Peer Good for 2 player games, beware NAT Client / Server 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

  24. Real-Time Communications:Asynchronous Environments Thread Priority Suspension Pooling Synchronization Critical Section & Mutex Communication Signal & Event Shared Memory pitfalls

  25. Firewalls Packet Filter Packet Shaping Proxies

  26. Firewalls: Network Address Translation

  27. Firewalls: NAT Traversal Specifics configured on router Determining WAN IP Hole punching

More Related