Getting Started with Multiplayer Game Development
Welcome to the wonderful world of multiplayer game development in Unreal Engine! I am really excited that you have selected me and my book as a guide to this sometimes scary technology; I promise that I’ll do my best to make this journey as easy and as entertaining as possible.
Throughout the book, you will learn how to create an Unreal Engine multiplayer game from scratch, handle client/server logic, manage AI opponents, test and profile the network, and take advantage of available cloud services. By the end, you will be proficient in creating a networked video game and have a deep knowledge of many of the pitfalls and how to avoid them.
In this chapter, you will get an overview of what a multiplayer game is, its origins, and the different types of multiplayer games that are available today. Additionally, you will explore how the technology used in multiplayer games has been applied in contexts outside of gaming.
In this chapter, I will discuss the following topics:
- Introducing multiplayer games
- Understanding multiplayer game categories
- Exploring gameplay twists
- Is multiplayer technology just for games?
As you may already know, the Unreal Engine Editor may be very demanding in terms of hardware prerequisites but don’t be scared. Luckily, this book is more focused on game programming than on real-time visual effects.
Here, let’s look at the hardware and software requirements, as well as some pre-requisite knowledge you will need to follow this book.
Before you get started, it is my duty to remind you that this book is meant for people who already have some knowledge about Unreal Engine development. As such, you should already be familiar with the following topics:
- The Epic Games Launcher and the Unreal Engine Editor
- Blueprint classes and Blueprint programming
- C++ programming with your IDE of choice
- A minimum level of understanding of C++ programming with Unreal Engine.
The following are some basic requirements officially recommended by Epic Games at the time of writing this book; if you have at least this hardware, you should be guaranteed a nice experience throughout the chapters:
- Windows OS:
- Operating System: Windows 10 64-bit version 1909 revision .1350 or higher, or versions 2004 and 20H2 revision .789 or higher
- Processor: Quad-core Intel or AMD, 2.5 GHz or faster
- Memory: 8 GB RAM
- Graphics Card: DirectX 11- or 12-compatible graphics card
- Operating System: Ubuntu 22.04
- Processor: Quad-core Intel or AMD, 2.5 GHz or faster
- Memory: 32 GB RAM
- Video Card: NVIDIA GeForce 960 GTX or higher with the latest NVIDIA binary drivers
- Video RAM: 8 GB or more
- Operating System: Latest macOS Ventura
- Processor: Quad-core Intel, 2.5 GHz or faster
- Memory: 8 GB RAM
- Video Card: Metal 1.2-compatible graphics card
In my case, I’ve been writing this book with the following hardware:
- Operating System: Windows 10 64-bit version
- Processor: Intel Core i9 9900K @3.60GHz
- Memory: 64 GB RAM
- Graphics Card: NVIDIA GeForce RTX 3090ti
- Operating System: Windows 10 64-bit version
- Processor: Intel Core i7 9750H @ 2.60GHz
- Memory: 16 GB RAM
- Graphics Card: NVIDIA GeForce RTX 2070
This book assumes you have the Epic Games Launcher and Unreal Engine 5 installed and fully working on your computer.
At the time of writing this book, the latest version of Unreal Engine is 5.1.1 but you will be able to follow along with any version more recent than 5.1.1.
Additionally, you’ll need an IDE supporting C++ and Unreal Engine. If you already have some past experience, chances are you have already installed Visual Studio 2019/2022 or JetBrains Rider; if you don’t, you will need to install one of them by the start of Chapter 4, Setting Up Your First Multiplayer Environment.
This book assumes you have Visual Studio 2019 or 2022 installed and fully functional; however, it’s totally fine to use JetBrains Rider.
Setting up Visual Studio for Unreal Engine development
Once you have Visual Studio installed, you’ll need the following extra components to make it properly work with Unreal Engine:
- C++ profiling tools
- C++ AddressSanitizer
- Windows 10 SDK
- Unreal Engine installer
To include these tools, follow these steps:
- Open Visual Studio Installer.
- Select Modify from your own Visual Studio installation, selecting the version you will be using, as shown in Figure 1.1:
Figure 1.1 – Visual Studio Installer
- Once the Modifying modal window opens, in the top bar, make sure you are in the Workloads section.
- Then, activate the Game development with C++ option by clicking the checkmark.
- Next, if it is closed, open Installation details | Game development with C++ | Optional from the right sidebar.
- Select C++ profiling tools, C++ AddressSanitizer, the latest Windows 10 SDK version available, and Unreal Engine installer, as shown in Figure 1.2.
Figure. 1.2 – Visual Studio with Unreal Engine installer activated
- Click the Install while downloading button (or the Download all, then install button) to start the installation process.
Once the download and installation process is finished, you will be ready to develop your own C++ games with Unreal Engine.
IDE support for Unreal Engine
Microsoft has recently introduced a new Unreal Engine integration extension for Visual Studio 2022 called IDE Support for Unreal Engine. This tool adds some new features such as Blueprint references, Blueprint assets, and CodeLens hints on top of Unreal Engine classes, functions, and properties.
To include this tool, follow these steps:
- Open the Workloads section if it has been closed.
- Activate the Game development with C++ option by clicking the checkmark.
- If it is closed, open Installation details | Game Development with C++ | Optional from the right sidebar.
- Select IDE support for Unreal Engine, as shown in Figure 1.3.
Figure 1.3 – Installing the IDE support
- Now install the tool.
Now that your IDE is properly configured, it’s time to gain some understanding of where multiplayer games come from. In the next section, you’ll learn a little bit of video game history.
Introducing multiplayer games
Multiplayer games are probably one of the most attractive forms of entertainment available today. There are several reasons why these types of games have become so popular and engaging over the years.
First, playing with other people adds elements of competition (or cooperation) that can be incredibly motivating and fun. Whether it’s a game such as the hyper-realistic Counter-Strike: Global Offensive (https://www.counter-strike.net/) or some crazy setting such as Rubber Bandits (https://www.rubberbandits.game/), there is something magical about playing in virtual environments that makes it exciting and enjoyable.
Having someone else to play with also means introducing a lot of opportunities for creative problem-solving and many possibilities for social interaction between people from different backgrounds and countries who may never have met otherwise!
But how did it all begin?
In the early 70s, the PLATO time-sharing system developed by the University of Illinois and Control Data Corporation enabled students at multiple locations to access online lessons. Soon after the introduction of PLATO IV, students began utilizing the newly introduced graphical capabilities to create multiplayer video games. By the end of the 70s, PLATO had introduced different games, spanning from dungeon crawlers to space battles to tank combat.
Over the decades, technology has massively improved and we are now able to play together around the globe in amazing immersive virtual worlds without (hopefully!) any lag or connection issues: it’s no wonder so many people are drawn toward these types of experiences!
What’s more, gamers have developed creative ways to communicate during gameplay, such as using online services including Skype and Discord, which deliver an even more immersive experience.
With the advent of real-time streaming platforms such as Twitch and YouTube, a new phase of multiplayer games has begun. Gamers can play and live broadcast at the same time, letting millions of people enjoy their experience.
Becoming a network programmer in video games
If you are reading this book, chances are you want to understand the basic principles of networking and apply your soon-to-be strong knowledge in multiplayer video game programming to the next big hit. As a multiplayer programmer, you will be able to create fun and interactive games for others to enjoy: this will be an incredibly rewarding experience!
But be aware – network video game programming can be quite challenging, with long work hours and potential stress. It is important to be aware of this before pursuing this type of career.
To avoid these kinds of pitfalls, it’s essential to have a solid understanding of how networks work in order to let players have an enjoyable and flawless experience.
Understanding a multiplayer game also means understanding how to troubleshoot computer issues and handle them whenever they pop up.
And rest assured...they will pop up sooner or later!
In the following section, you will learn about the major types of multiplayer games, as well as the distinctions that set them apart.
Understanding multiplayer game categories
There is a wide array of game categories available to choose from, ranging from first-person shooters to role-playing; often, a game incorporates more than one genre, giving the player exactly what they are looking for. Here you will find a non-exhaustive list of the most popular game types available nowadays, describing them from a multiplayer point of view.
First-person shooter (FPS) titles are probably some of the most exciting and immersive video games available on the market and involve, as the name suggests, playing from a first-person perspective using various types of weapons.
Players will experience virtual worlds through the eyes of the character with mechanics such as running, taking cover, aiming, shooting (and often reloading your weapon!); this means having fast reflexes or you’ll be out of business really quickly!
Third-person shooter (TPS) games are very similar to FPS games but players can battle each other from a third-person perspective. While FPS games tend to be more focused on shooting opponents and completing objectives, TPS games offer the player a wider view of the surrounding world, making them a good choice for more strategically oriented users.
One of the most popular features with both FPS and TPS games is the ability to change the skin of your character, allowing the creation of unique avatars that will stand out from the crowd.
Fortnite (https://www.fortnite.com/) by Epic Games (the developer of Unreal), is one of the most played TPS games, with millions of players around the world every day.
Real-time strategy (RTS) games combine elements of competition and strategy in a multiplayer experience. Usually, players must build an army and interact with other players online, often involving managing resources, forming pacts with other people (while trying to outsmart them!), and obviously, attacking them when it’s clear that there can be only one left standing!
One of the most successful and popular RTS games of all time is StarCraft (https://starcraft.com/), where players control one species and must battle the others for power and dominance.
Massively multiplayer online role-playing games
In a massively multiplayer online role-playing game (MMORPG), the classic role-playing game is augmented with networked features allowing thousands (or even millions) of players to interact in real time.
One of the most exciting things about MMORPGs is the ever-changing flow of the story as players will influence it with their own actions; they will buy equipment, hone their skills, and form alliances while looking for the next adventure.
World of Warcraft (https://worldofwarcraft.blizzard.com/) is undeniably one of the most popular and longest-running games in this genre.
Multi-user dungeon (MUD) games can be considered the progenitors of MMORPGs and are text-based adventures where each player takes the role of an adventurer in a virtual world. MUDs usually include elements of role-playing, strategy, and hack-and-slash games.
Although they may seem a bit old-fashioned, MUDs are still widely played thanks to their active communities, where players form strong relationships over the years.
Sometimes, MUDs are created by groups of fans of a fictional genre such as DiscWorldMUD (https://discworld.starturtle.net/), a game based on the DiscWorld saga created by Terry Pratchett.
Multiplayer online battle arena
Multiplayer online battle arena (MOBA) games are a strategy subgenre where two teams compete against each other: each player controls a character trying to defeat the opposing team, usually by destroying the enemy base. Arenas are predefined, letting teams plan their strategies in advance.
One of the most played MOBA games is League of Legends (https://www.leagueoflegends.com/), which has been around since 2009 and is still a favorite among players around the world.
The game examples I have provided here have obviously been developed by dozens (if not hundreds) of people, and creating these kinds of games is obviously outside the scope of this book. Additionally, some genres – such as MMORPGs – are some of the most complex and ambitious video games to make. With this in mind, you should exercise caution before attempting to create an intricate multiplayer game – first of all, ensuring that you possess the necessary skills and confidence to handle its vast scope.
Now that we have looked at the different multiplayer genres available, in the next section, you will discover how these genres can be enhanced with creative additions that can completely transform the way they are played.
Reviewing gameplay twists
Given all the aforementioned options available, it is simply a matter of personal preference which multiplayer game genre a player chooses. However, as a developer, you need to be aware of different types of gameplay and technologies to make your project work properly. In this section, I will present a couple of twists applied to regular gameplay.
In asymmetric multiplayer games, two or more teams of players compete in gameplay where the mechanics are different for each group. These games usually require players to set their strategy depending on their chosen side.
One of the best examples is Among Us (https://www.innersloth.com/games/among-us/), which is set on a spaceship where some player takes the role of an impostor whose aim is to let all other crewmates die in some “unexpected” accident before their true identity is revealed.
In multiplayer games, this has led to some hide-and-seek variants, where players try to avoid each other (or the main storyline), whether the game officially supports them or not.
An example of this kind of twist is Secret Neighbor (https://www.secretneighbor.com/), a multiplayer social game where a group of adventurous kids is trying to sneak into their mysterious neighbor’s home to uncover evidence that suggests he is keeping children captive.
An asynchronous multiplayer game will let players interact with each other without the need to be connected at the same time. These games are usually played in turns, where each player will make their move and will wait for the opponent to complete the next one.
And yes...online chess is an asynchronous game!
Now that you have a strong understanding of the main networked game genres, you may be wondering whether game engines’ multiplayer technologies are just for gaming. In the next section, I will provide some examples that demonstrate the opposite.
Is multiplayer technology just for games?
As you have read so far, multiplayer networking is an incredibly powerful tool for creating immersive and entertaining games. However, you may be wondering whether this technology is just about gaming.
The short answer is no.
The networking technology available in game engines such as Unreal Engine can be an incredibly useful tool beyond just gaming. Collaborating remotely in real time can have a huge impact on productivity and can be applied to almost any type of project, ranging from educational purposes to architecture, up to cinematography.
VP is a workflow that combines computer-generated imagery (CGI), motion capture, and real and virtual assets combined in a real-time visualization. VP enables content creators (usually filmmakers) to have more efficient and cost-effective productions.
One of the best examples of multiplayer technology used in a VP pipeline is virtual scouting, which is the process of exploring and evaluating potential shooting locations without leaving their own studios. This is usually leveraged by a mix of augmented reality (AR) and virtual reality (VR).
A good example of using Unreal Engine in VP can be found in The Mandalorian series for the streaming service Disney+.
Unreal Engine can be used in architecture to create real-time interactive visualizations of architectural projects. These simulations can be run on a multiplayer networking system providing online collaboration capabilities between architects. During the design process, architects can use Building Information Modeling (BIM) technology in a networked system to access the same model and make changes simultaneously, being more collaborative and efficient.
Real-time rendering software with multi-user capabilities helps designers and architects connect with stakeholders in every phase of the Architecture, Engineering, and Construction (AEC) life cycle, enabling faster, better communication.
Reflect (https://unity.com/products/unity-reflect), a service developed by Unity Technologies, is a good example, letting users experience virtual environments with a mix of 3D rendering, VR, and AR.
Unreal Engine’s multiplayer capabilities can be an amazing tool for educators and students, providing immersive and interactive learning experiences. Any teacher with some practical knowledge of the game engine can create a virtual classroom where students can interact with each other in real time.
Games such as Fortnite and its Fortnite Creative version (https://www.fortnite.com/creative) have been used lately as an educational tool in many schools, letting students develop problem-solving skills and engaging them in a fun way.
Unreal’s Collab Viewer template
The Unreal Engine Editor has a couple of excellent templates that can be immediately applied as a networked collaborative environment: Collab Viewer for Architecture and Collab Viewer for Automotive, Product Design and Manufacturing.
In Figure 1.4, you can see Collab Viewer for Architecture selected and ready to be generated:
Figure 1.4 – The Collab Viewer template selected in Unreal Editor
These project templates provide an amazing starting point for collaborative industrial and architectural projects; everything has already been set up (even a login panel to access the application), so all you have to do is add your own environment and export the application.
As a teacher, I have often used these Unreal Engine templates as a quick way to create multiplayer educational experiences such as virtual museums or for displaying students’ projects.
Figure 1.5 shows the application in action emulating three users on a single machine (don’t worry, we will get back to this very soon!).
Figure 1.5 – Collab Viewer in action
Knowing how to use Collab Viewer and its many features (VoIP, real-time annotations, VR mode, etc.) is beyond the scope of this book, but if you are interested in this topic, Epic Games has an exhaustive section in the Unreal Engine documentation: https://docs.unrealengine.com/5.1/en-US/collab-viewer-templates-in-unreal-engine/.
In this chapter, you have been introduced to the main categories of multiplayer games and why it is so important to have a solid understanding of networking in the present day. What’s more, you were provided with a brief overview of practical examples that extend the concept of something that is traditionally considered a game-only field.
In the next chapter, I will guide you through the basic principles of networking. Although you will encounter a substantial amount of information (which may seem somewhat theoretical), rest assured that it will all become clear as you progress to Chapter 3, Testing the Multiplayer System with a Project Prototype, where you will start creating your first multiplayer prototype.