Download presentation
Presentation is loading. Please wait.
1
Game Networking CSE 191A: Seminar on Video Game Programming Lecture 9: Networking UCSD, Spring, 2003 Instructor: Steve Rotenberg Guest Lecturer: Mark Rotenberg
2
Maslow’s Hierarchy of Needs Self Actualization Esteem Social Safety Physiological Offline Games Online Communities Simple Online Games
3
Network Topology ServerClient Peer (Host) Peer Client-Server TopologyPeer-to-Peer Topology
4
Networking Evils Security Cheating Latency (up to 100-300ms round-trip) Bandwidth (64-128 kbps each direction) Packet Loss (2% with 10% bursts) Jitter
5
Lock-Step Simulations Really easy to implement Fully synchronize everything Initial states Inputs Time steps Simulation must be deterministic Some turn-based games use this at a slower sampling rate (Age of Empires) Not suitable for fast Internet games
6
Simulation with Lag Compensation Server-side movement Peer/Client-side movement with Host/Server verification Varying frame rates and latencies Position history with server-side time warping (Half-Life) Interpolation - sliding and skipping Extrapolation – problematic with physics Syncing orientation, position, inputs
7
Networking Protocols TCP (Transport Control Protocol) Reliable, connection based protocol Ideal for matchmaking and lobbies but not real- time game play UDP (Unix Datagram Protocol) Unreliable, unordered datagram oriented Good for time-sensitive data but not
8
Networking Protocols, cont’d Roll-your-own Protocol Probably based on UDP Prioritize and retransmit as necessary Coalesce or reconstitute packets as necessary Compression Encryption Piggyback Acknowledgements Heartbeats / Pings / Keep Alive / Network Probes
9
Game-Specific Protocols Positions, Inputs, Orientations Spawning and Removing Game Events Match Configurations State Transitions Complaints, Connection Status Heartbeats (pings) Voice / Chat
10
Game Data Most common transmission modes Reliable Piggyback ACKs where possible Unreliable Should be numbered, may arrive out of order Other modes Most recent only Fastest / Reliable fastest May transmit multiple times without waiting for ACKs
11
Network Security Encryption and Digesting RSA Diffie-Hellman MD5 DES, triple-DES, AES IPSec References http://www.rsasecurity.com/rsalabs/faq/ http://www.rsasecurity.com/rsalabs/faq/ “Applied Cryptography,” Schneier
12
Network Address Translation Peer 1 sees: Peer 2 at 219.3.16.49 : 1000 Peer 3 at 219.3.16.49 : 49155 Peer 2 sees: Peer 1 at 198.214.72.29 : 1000 Peer 3 at 10.0.0.3 : 1000 Peer 3 sees: Peer 1 at 198.214.72.29 : 1000 Peer 2 at 10.0.0.2 : 1000 Internet NAT Peer 2Peer 3 Peer 1 10.0.0.2 : 1000 10.0.0.3 : 1000 198.214.72.29 : 1000 219.3.16.49 : 1000 219.3.16.49 : 49155
13
General Programming Suggestions Always assume networking Separate cause from effect Event-based networking code Multiple levels of state machines Message passing from network layer to game code Monitor everything WAN simulation hardware/software Lots of asserts and debug messages Lots of unit tests Lots of product testing
14
Matchmaking and Community Matchmaking Competitions, Ladders, Leader Boards Friends, Invitations Feedback – both good and bad Content Sharing
15
Online Strategies – Sony vs. Microsoft PS2 Strategy 5 networking stacks to choose from!? No built-in support for voice, security, authentication Various middleware vendors Publishers or users provide servers Xbox Strategy Very well designed networking stack and APIs Connect only through Microsoft’s servers Every packet, machine, user, hard drive, DVD, user can be authenticated Gamertags work across multiple titles Consistent billing interface Strict User Interface Guidelines
16
Deployment Issues Patching Maintenance Who pays for bandwidth? Billing Scalability Monitoring Usage and Statistics Handling Cheaters Detecting Piracy Who “owns” users? “Policing” the Community
17
Massively Multiplayer Online Games Huge Development Costs Virtual Economies Community Server Scalability Keeping content new and interesting
18
Future Considerations IPv6 Handhelds and Cell phones Cross-Title Integration Server-side “Mods” Peer-to-Peer MMOGs? Sony “Cell” Processor
19
Questions? Contact me at mark [at] rockstarsandiego.com.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.