Cover....1
Title Page....2
Copyright and Credits....3
Dedications....4
Contributors....5
Table of Contents....8
Preface....16
Part 1: Introducing Multiplayer Games....22
Chapter 1: Getting Started with Multiplayer Game Development....24
Technical requirements....24
Pre-requisite knowledge....25
Hardware requirements....25
Software requirements....26
Introducing multiplayer games....29
Becoming a network programmer in video games....30
Understanding multiplayer game categories....31
First-person shooters....31
Third-person shooters....31
Real-time strategy....31
Massively multiplayer online role-playing games....32
Multi-user dungeons....32
Multiplayer online battle arena....32
Reviewing gameplay twists....33
Asymmetrical gameplay....33
Hide-and-seek gameplay....33
Asynchronous gameplay....34
Is multiplayer technology just for games?....34
Cinematography....34
Architecture....35
Education....35
Unreal’s Collab Viewer template....35
Summary....37
Chapter 2: Understanding Networking Basics....38
Technical requirements....38
What is computer networking?....38
Types of computer networks....39
Local Area Networks....40
Wide Area Networks....41
Virtual Private Networks....42
Introducing network protocols....42
Packet switching....43
TCP/IP suite....44
Understanding network issues....46
Security....47
Packet loss....47
Latency....47
Introducing the Unreal Engine multiplayer system....47
Network modes and server types....48
The replication system....48
Network role....49
Pawns and PlayerControllers....49
Relevance and priority....49
Remote Procedure Calls....50
Summary....50
Credits....50
Chapter 3: Testing the Multiplayer System with a Project Prototype....52
Technical requirements....52
Creating a multiplayer game prototype....53
Setting up the project from a template....53
Adding Quixel Megascans....54
Modifying the Player Controller....58
Testing a multiplayer game locally....59
Playing as a Listen Server....59
Updating over the network....61
Adding additional character spawn points....62
Updating properties over the network....64
Creating the pickup Blueprint....64
Adding pickup variants....67
Adding a points counter to the character....69
Executing functions over the network....72
Spawning Actors....72
Skinning characters....76
Testing the game....79
Summary....80
Part 2: Networking and Multiplayer Games in Unreal Engine....82
Chapter 4: Setting Up Your First Multiplayer Environment....84
Technical requirements....84
Introducing Unreal Shadows – Legacy of the Lichlord....85
Explaining the project brief....85
Starting the project....86
Understanding C++ in Unreal Engine....87
Blueprints and C++....88
Understanding C++ classes....88
Anatomy of a UE C++ header....90
The Unreal Engine Reflection System....91
Memory management and garbage collection....92
Starting your Unreal multiplayer project....92
Creating your project file....93
Creating the project game instance....94
Creating the Game Mode and the Game State....98
Adding the player classes....99
Compiling your source code....100
Creating the Character Blueprint Class....101
Adding the Player classes to the Game Mode....101
Summary....103
Chapter 5: Managing Actors in a Multiplayer Environment....104
Technical requirements....104
Setting up the character....105
Adding basic settings to the character....105
Adding interaction to the character....110
Importing the Enhanced Input Module....118
Adding user interaction to the character....118
Testing the character’s movement....124
Controlling the connection of an Actor....124
Understanding Actor relevancy....126
Understanding relevancy....126
Testing relevancy....127
Testing the relevancy settings....132
Introducing authority....135
Controlling authority with the Role and Remote Role properties of an Actor....135
Autonomous and simulated proxy....136
Summary....136
Chapter 6: Replicating Properties Over the Network....138
Technical requirements....139
Adding character stats....139
Creating the stats structure....139
Creating a stats data table....141
Reading the data table from the character....144
Adding the data table to the character....146
Understanding property replication....147
Enabling property replication....147
Referencing Actors and components over the network....148
Handling character level-ups....149
Planning ahead....150
Declaring PlayerState properties and functions....150
Implementing the PlayerState logic....152
Adding coin pickups to the level....154
Adding a HUD to the game....157
Creating the Widget Blueprint....157
Adding code logic to the Widget Blueprint....158
Adding the HUD to the character....163
Testing the game....164
Summary....165
Chapter 7: Using Remote Procedure Calls (RPCs)....166
Technical requirements....166
Understanding what an RPC is....167
Reliability of an RPC....168
Validating RPCs....168
Executing RPCs over the network....169
Calling a function on the server....170
Implementing a door system....172
Creating the Interactable interface....172
Implementing the interact action....174
Creating the door Blueprint....177
Testing the interact action....180
Summary....181
Part 3: Improving Your Game....182
Chapter 8: Introducing AI into a Multiplayer Environment....184
Technical requirements....184
Setting up the AI system....185
Creating an AI opponent....186
Adding the navigation module....187
Creating the minion class....187
Implementing the minions’ behaviors....189
Adding opponents to the level....195
Creating a spawner class....196
Testing the spawner....198
Summary....200
Chapter 9: Extending AI Behaviors....202
Technical requirements....202
Making AI opponents more challenging....203
Making some noise....203
Enabling the hearing sense....204
Testing the hearing sense....206
Implementing an alert system....207
Declaring the Game Mode functions....207
Making the AI send alert messages....208
Adding health to the AI....210
Adding a weapon system to the character....212
Creating a dagger projectile....212
Implementing the weapon component....215
Attaching the WeaponProjectile component to the character....219
Adding an input system for the weapon....220
Testing the weapon system....223
Creating AI variations....224
Creating an AI sentinel....225
Creating an AI miniboss....228
Updating the minion spawner....230
Summary....232
Chapter 10: Enhancing the Player Experience....234
Technical requirements....235
Animating the character....235
Creating the animation assets....235
Adding the Animation System to the character....243
Adding the throw animation....245
Adding NPC Actors....247
Creating the NPC character....248
Testing the NPC Actor....252
Making further improvements to the game....253
Let’s make some noise!....253
I need a key!....254
Improve your arsenal, my hero!....254
You are not a machine gun....254
No time to waste....255
Tables, tables everywhere!....255
Need some help?....255
Summary....256
Chapter 11: Debugging a Multiplayer Game....258
Technical requirements....259
Introducing network debugging....259
Explaining game debugging....260
Introducing multiplayer options....260
Logging in a networked environment....262
Filtering the LogNet category....264
Creating a custom log category....265
Emulating a networked environment....267
Enabling network emulation....267
Testing the game with network emulation....271
Using the Network Profiler....273
Recording a profiling session....274
Analyzing a profiling session....275
Improving performance and bandwidth utilization....281
Turning on replication only when necessary....281
Avoiding invoking RPCs that are not required or essential....281
Distinguishing between reliable and unreliable RPCs....281
Validating data....282
Remembering that the GameMode exists only on the server....282
Using a naming convention for RPCs....282
Summary....283
Part 4: Deploying Your Game Online....284
Chapter 12: Managing Multiplayer Sessions....286
Technical requirements....286
Understanding game sessions....287
Introducing the Online Subsystem....287
Understanding session commands....288
Understanding connection errors....289
Preparing a project game session....290
Creating a session....291
Adding the visual elements....292
Implementing the Visual Scripting logic....295
Joining a session....298
Creating the SessionItemRenderer widget....298
Creating the FindSessions widget....303
Creating the Main Menu widget....314
Summary....315
Chapter 13: Handling Data During a Session....316
Technical requirements....317
Creating the main menu level....317
Creating the Pawn....317
Creating the GameMode....319
Creating the level....320
Testing the session system....321
Handling data during a session....322
Updating the US_GameInstance class....323
Adding the CharacterSkins data....323
Updating the US_MainMenuPawn class....326
Updating the BP_MainMenuPawn Blueprint....328
Updating the US_Character class....329
Updating the BP_Character Blueprint....332
Making further improvements....334
Leaving and destroying sessions....334
Handling player death....334
Selecting the player skin....334
Summary....335
Chapter 14: Deploying Multiplayer Games....336
Technical requirements....336
Going online for real....336
Compiling the Unreal Engine....338
Downloading the Unreal Engine source project....338
Compiling from the source code....341
Setting up a dedicated server....350
Creating the project....350
Building the project solution....351
Building the dedicated server....354
Testing the project....357
Summary....359
Chapter 15: Adding Epic Online Services (EOS)....360
Technical requirements....360
Introducing EOS....361
Accessing the Developer Portal....362
Accessing the Epic Games Developer Portal....362
Creating a Product....364
Configuring the Product services....366
Getting started with the EOS SDK....375
Downloading the EOS SDK....375
Integrating the system into your game....377
Summary....379
Index....380
Other Books You May Enjoy....391
If you’re fascinated by the immersive gaming experiences that enable multiple users to engage in collaborative or competitive gameplay, this Unreal Engine 5 game development book is for you.
In this book, you’ll learn the foundational principles behind multiplayer games. Starting with a sample project, you’ll learn how to set up a networked system and make it work. Once the prototype of the project is functional, you’ll start adding game logic, including obstacles and AI opponents, to heighten the challenges and engagement, offering a captivating experience for players. Next, you’ll learn how to debug and optimize the project, before finally deploying the game build and integrating it with cloud services such as the Epic Online Services system.