Book Image

Multiplayer Game Development with Unreal Engine 5

By : Marco Secchi
Book Image

Multiplayer Game Development with Unreal Engine 5

By: Marco Secchi

Overview of this book

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. By the end of this book, you’ll have the confidence to develop and manage multiplayer experiences using the Unreal Engine environment, taking your newfound programming skills in your upcoming projects.
Table of Contents (22 chapters)
1
Part 1:Introducing Multiplayer Games
5
Part 2:Networking and Multiplayer Games in Unreal Engine
10
Part 3:Improving Your Game
15
Part 4:Deploying Your Game Online

Adding the player classes

You are now ready to create some more main classes used by almost any UE game: those dedicated to managing the input from the player and showing the character in-game, along with its state.

The Player Controller is responsible for managing input from the player’s input devices (such as keyboard and mouse), and for sending commands to the player’s character so it will perform the corresponding actions. The Player Controller class is typically used to control a Pawn class or a Character class that represents the player in a game.

Finally, the Player State is a class that holds information about a player’s game state, such as experience points, score, and other relevant data. It exists on both the server and clients to ensure that all players have access to the same information.

Let’s create these three classes:

  1. Create a C++ class extending PlayerController and name it US_PlayerController.
  2. Create another C++ class...