Multiplayer Game Programming: Architecting Networked Games,

Book description

The Practical Guide to Building Reliable Networked Multiplayer Games

Networked multiplayer games are a multibillion dollar business: some games now attract tens of millions of players. In this practical, code-rich guide, Joshua Glazer and Sanjay Madhav guide you through every aspect of engineering them. Drawing on their immense experience as both game developers and instructors, the authors lead you through building a robust multiplayer architecture, and creating every engine-level system. You’ll learn through in-depth working code examples for two complete games: an action game and a real time strategy (RTS) game.

First, Madhav and Glazer review the essentials of networking and network programming from the standpoint of game developers. Next, they walk through managing game data transmission, updating game objects across the network, and organizing the devices that join your game. You’ll learn how to ensure reliable performance despite the Internet’s inherent inconsistencies, and how to design game code for maximum security and scalability. The authors conclude by addressing two increasingly crucial issues: incorporating gamer services and hosting your games in the cloud.

This guide’s content has been extensively tested through the authors’ multiplayer game programming courses at USC. It is equally valuable both to students and to working game programmers moving into networked games.

Coverage includes

  • How games have evolved to meet the challenges of networked environments
  • Using Internet communication protocols and standards in game development
  • Working with Berkeley Socket, the most widely used networking construct in multiplayer gaming
  • Formatting game data for efficient Internet transmission
  • Synchronizing states so all players share the same world
  • Organizing networking topologies for large-scale games
  • Overcoming latency and jitter problems that cause delays or lost data
  • Scaling games without compromising performance
  • Combating security vulnerabilities and software cheats
  • Leveraging the networking functionality of the popular Unreal 4 and Unity game engines
  • Integrating gamer services such as matchmaking, achievements, and leaderboards
  • Running game servers in the cloud

About the Website C++ source code for all examples is available at github.com/MultiplayerBook. Instructors will also find a full set of PowerPoint slides and a sample syllabus.

Table of contents

  1. About This E-Book
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Contents
  6. Preface
    1. Who Should Read This Book?
    2. Conventions Used in This Book
    3. Why C++?
    4. Why JavaScript?
    5. Companion Website
  7. Acknowledgments
    1. Acknowledgments from Joshua Glazer
    2. Acknowledgments from Sanjay Madhav
  8. About the Authors
  9. Chapter 1. Overview of Networked Games
    1. A Brief History of Multiplayer Games
      1. Local Multiplayer Games
      2. Early Networked Multiplayer Games
      3. Multi-User Dungeons
      4. Local Area Network Games
      5. Online Games
      6. Massively Multiplayer Online Games
      7. Mobile Networked Games
    2. Starsiege: Tribes
      1. Platform Packet Module
      2. Connection Manager
      3. Stream Manager
      4. Event Manager
      5. Ghost Manager
      6. Move Manager
      7. Other Systems
    3. Age of Empires
      1. Turn Timers
      2. Synchronization
    4. Summary
    5. Review Questions
    6. Additional Readings
  10. Chapter 2. The Internet
    1. Origins: Packet Switching
    2. The TCP/IP Layer Cake
    3. The Physical Layer
    4. The Link Layer
      1. Ethernet/802.3
    5. The Network Layer
      1. IPv4
      2. IPv6
    6. The Transport Layer
      1. UDP
      2. TCP
    7. The Application Layer
      1. DHCP
      2. DNS
    8. NAT
      1. NAT Traversal
    9. Summary
    10. Review Questions
    11. Additional Readings
  11. Chapter 3. Berkeley Sockets
    1. Creating Sockets
    2. API Operating System Differences
    3. Socket Address
      1. Type Safety
      2. Initializing sockaddr from a String
      3. Binding a Socket
    4. UDP Sockets
      1. Type-Safe UDP Sockets
    5. TCP Sockets
      1. Sending and Receiving via Connected Sockets
      2. Type-Safe TCP Sockets
    6. Blocking and Non-Blocking I/O
      1. Multithreading
      2. Non-Blocking I/O
      3. Select
    7. Additional Socket Options
    8. Summary
    9. Review Questions
    10. Additional Readings
  12. Chapter 4. Object Serialization
    1. The Need for Serialization
    2. Streams
      1. Memory Streams
      2. Endian Compatibility
      3. Bit Streams
    3. Referenced Data
      1. Inlining or Embedding
      2. Linking
    4. Compression
      1. Sparse Array Compression
      2. Entropy Encoding
      3. Fixed Point
      4. Geometry Compression
    5. Maintainability
      1. Abstracting Serialization Direction
      2. Data-Driven Serialization
    6. Summary
    7. Review Questions
    8. Additional Readings
  13. Chapter 5. Object Replication
    1. The State of the World
    2. Replicating an Object
      1. Object Creation Registry
      2. Multiple Objects per Packet
    3. Naïve World State Replication
    4. Changes in World State
      1. Partial Object State Replication
    5. RPCs as Serialized Objects
    6. Custom Solutions
    7. Summary
    8. Review Questions
    9. Additional Readings
  14. Chapter 6. Network Topologies and Sample Games
    1. Network Topologies
      1. Client-Server
      2. Peer-to-Peer
    2. Implementing Client-Server
      1. Separating Server and Client Code
      2. Network Manager and Welcoming New Clients
      3. Input Sharing and Client Proxies
    3. Implementing Peer-to-Peer
      1. Welcoming New Peers and Game Start
      2. Command Sharing and Lockstep Turns
      3. Maintaining Synchronization
    4. Summary
    5. Review Questions
    6. Additional Reading
  15. Chapter 7. Latency, Jitter, and Reliability
    1. Latency
      1. Non-Network Latency
      2. Network Latency
    2. Jitter
    3. Packet Loss
    4. Reliability: TCP or UDP?
    5. Packet Delivery Notification
      1. Tagging Outgoing Packets
      2. Receiving Packets and Sending Acknowledgments
      3. Receiving Acknowledgments and Delivering Status
    6. Object Replication Reliability
      1. Optimizing from In-Flight Packets
    7. Simulating Real-World Conditions
    8. Summary
    9. Review Questions
    10. Additional Readings
  16. Chapter 8. Improved Latency Handling
    1. The Dumb Terminal Client
    2. Client Side Interpolation
    3. Client Side Prediction
      1. Dead Reckoning
      2. Client Move Prediction and Replay
      3. Hiding Latency through Tricks and Optimism
    4. Server Side Rewind
    5. Summary
    6. Review Questions
    7. Additional Readings
  17. Chapter 9. Scalability
    1. Object Scope and Relevancy
      1. Static Zones
      2. Using the View Frustum
      3. Other Visibility Techniques
      4. Relevancy When Not Visible
    2. Server Partitioning
    3. Instancing
    4. Prioritization and Frequency
    5. Summary
    6. Review Questions
    7. Additional Readings
  18. Chapter 10. Security
    1. Packet Sniffing
      1. Man-in-the-Middle Attack
      2. Packet Sniffing on a Host Machine
    2. Input Validation
    3. Software Cheat Detection
      1. Valve Anti-Cheat
      2. Warden
    4. Securing the Server
      1. Distributed Denial-of-Service Attack
      2. Bad Data
      3. Timing Attacks
      4. Intrusions
    5. Summary
    6. Review Questions
    7. Additional Readings
  19. Chapter 11. Real-World Engines
    1. Unreal Engine 4
      1. Sockets and Basic Networking
      2. Game Objects and Topology
      3. Actor Replication
      4. Remote Procedure Calls
    2. Unity
      1. Transport Layer API
      2. Game Objects and Topology
      3. Spawning Objects and Replication
      4. Remote Procedure Calls
      5. Matchmaking
    3. Summary
    4. Review Questions
    5. Additional Readings
  20. Chapter 12. Gamer Services
    1. Choosing a Gamer Service
    2. Basic Setup
      1. Initialization, Running, and Shutdown
      2. User IDs and Names
    3. Lobbies and Matchmaking
    4. Networking
    5. Player Statistics
    6. Player Achievements
    7. Leaderboards
    8. Other Services
    9. Summary
    10. Review Questions
    11. Additional Readings
  21. Chapter 13. Cloud Hosting Dedicated Servers
    1. To Host or Not To Host
    2. Tools of the Trade
      1. REST
      2. JSON
      3. Node.JS
    3. Overview and Terminology
      1. Server Game Instance
      2. Game Server Process
      3. Game Server Machine
      4. Hardware
    4. Local Server Process Manager
      1. Process Monitoring
    5. Virtual Machine Manager
      1. Virtual Machine Monitoring
    6. Summary
    7. Review Questions
    8. Additional Readings
  22. Appendix A. A Modern C++ Primer
    1. C++11
      1. auto
      2. nullptr
    2. References
      1. Const References
      2. Const Member Functions
    3. Templates
      1. Template Specialization
      2. Static Assertions and Type Traits
    4. Smart Pointers
      1. Shared Pointers
      2. Unique Pointer
      3. Weak Pointer
      4. Caveats
    5. STL Containers
      1. array
      2. vector
      3. list
      4. forward_list
      5. map
      6. set
      7. unordered_map
    6. Iterators
      1. Range-Based For Loop
      2. Other Uses of Iterators
    7. Additional Readings
  23. Index
  24. Code Snippets

Product information

  • Title: Multiplayer Game Programming: Architecting Networked Games,
  • Author(s): Josh Glazer, Sanjay Madhav
  • Release date: December 2015
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780134034355