1 / 25

Network and Multiplayer

Network and Multiplayer. Multiplayer Modes: Restricting the Domain. Real-Time not Turn-Based Sure its more difficult to implement Yes its more latency sensitive Considering only internet multi-user

karlelliott
Télécharger la présentation

Network and Multiplayer

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. Network and Multiplayer

  2. Multiplayer Modes:Restricting the Domain Real-Time not Turn-Based Sure its more difficult to implement Yes its more latency sensitive Considering only internet multi-user Internet uses shared pipes and has extremely highly variable latency, bandwidth, and reliability Shared keybord/screen, or bluetooth or USB hookups are out of our scope

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

  4. Protocols:Packets Packets Header = Protocol Manifest. Overhead. Data Payload Gotchas (No) “normal” Pointers or References Large Data, Variable Size Data Beware Classes/Objects (serialize? But carefully) Binary data limits portability: Word Size, Byte Alignment, Endian Order Unicode vs. ASCII Strings

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

  6. Protocol Stack: Open System Interconnect

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

  8. Protocol Stack:Network Layer Packet Routing Hops (check out traceroute) Routers, Hubs, Switches Packet fragments and reassembly as needed Internet Protocol (IP) Contains Source & Destination IP Address In practice, public vs. private internet IP# only gets to your firewall/router NAT is ubiquitous, making peer-to-peer and servers more difficult to write

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

  10. Protocol Stack:Network Layer: DNS Domain Name Service Converts text name to IP address Must contact one or more DNS servers to resolve Frequently attacked Local cache resolution possible Game Tips Store local game cache to use when DNS “out of order”. <-- DNS often out of order When not dead, DNS resolution often very slow, use cache for same day resolution.

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

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

  13. Protocol Stack:Transport Layer: UDP Non Guaranteed Delivery No Acknowledgment 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

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

  15. Protocol Stack:Session Layer:TCP 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()

  16. 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(s), peer(s) and DB server(s) if all serviced by same thread

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

  18. Protocol Stack:Presentation Layer: Buffering Packet Coalescence – kernels handle limited # of packets/sec regardless whether big or small Induced Latency – applications see buffering as More latency Dead Data – some data is obsoleted before it even gets transmitted. Large Packets – well, within reason

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

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

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

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

  23. Firewalls Packet Filter – implements include/exclude rules. Might just allow specific ports through Packet Shaping – prevent your Netflix from freezing my Emacs session. Proxies – an agent acting on another’s behalf

  24. Firewalls: Network Address Translation

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

More Related