Third-Person Template (Unreal Engine)
🚧 This documentation page is a work in progress 🚧
This guide will walk you through creating and deploying a multiplayer game with Unreal Engine.
This guide was written using Unreal Engine 5.1.1. This process is similar if using Unreal Engine 4. If you’re using a different version of Unreal Engine and need help, don’t hesitate to reach out.
Overview
Unreal Engine provides fantastic multiplayer capabilities out of the box. We’ll be using Unreal’s built-in networking to build a server-authoritative multiplayer game on top of Rivet.
Running an Unreal game on Rivet requires building a standalone client and a dedicated server.
How does Rivet compare to Epic Online Services and Steam Sockets?
Rivet is intended to help run authoritative multiplayer servers. We do not support peer-to-peer networking yet.
Read more about authoritative vs peer-to-peer networking.
If you want high-performance networking, mobile games, large lobbies, or to prevent cheating, peer-to-peer networking is not a good choice.
Step 1: Prepare Unreal Engine
Download the Unreal Engine cross-compilation toolchain
- Make sure you download the version corresponding to your Unreal version
- You may have to restart
Install Visual Studio prerequisites
Download the Unreal Engine source code
- Join GitHub team
- Clone UnrealEngine repo
Build the Unreal Engine editor
- Install Visual Studio prerequisites
- TODO: See Setting Up Visual Studio > C++ Tools
.\Setup.bat
.\GenerateProjectFiles.bat
- You’ll see a warning:
Some Platforms were skipped due to invalid SDK setup:
- Make sure that
Linux
is not listed here. If so, then step 1 was not done correctly.
- You’ll see a warning:
- Open UE5.sln
- Wait for Indexing folder UnrealEngine to finish
- You can see this by clicking the messae tab in the bottom left
- Set Solution Configuration to Development Editor
- Set Solution Platform to Win64
- Right click UE5 target in right sidebar and click Build
- Takes 10-40 minutes depending on your hardware
- Right click on UE5 in the sidebar and click Debug > Start New Instance
- Unreal Engine is built to at
UnrealEngine\Engine\Binaries\Win64\UnrealEditor
- Create a shortcut somewhere for quick access in the future
Step 2: Setup the Unreal Engine project
We’ll be using the third-person template from Unreal Engine since all of the components come with networking out of the box. These steps also apply to any other networked Unreal Engine game.
If you’re following this guide on an existing project, ensure that your project is version controlled.
Create third person template (or bring your project)
Use the C++ version. While Rivet also works with Blueprints, we haven’t put together a guide for that yet.
Test locally
- Configure PIE networking configuration
- Run the project
- Check that you can see your players running around
Build Linux server
- You may need to restart Unreal after building the client and server to show new targets
- May need to run Tools > Refresh Visual Studio Project after building client and server
Step 3: Setup Rivet project
Install Rivet CLI
Initiate project
Step 4: Integrate with Rivet
Add project dependencies
Update Source/MyProject/MyProject.Build.cs to add "Http"
, "Json"
and "JsonUtilities"
to PublicDependencyModuleNames
. For example:
using UnrealBuildTool;
public class MyProject : ModuleRules
{
public MyProject(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "Json", "JsonUtilities" });
}
}
Copy Rivet module
Add token to config
Build connection UI
- Create menu scene
- Set menu scene game mode to GameModeBase
Build connection code
Test locally
Configure testing
- Level Editor > Play
Step 5: Publish
Write server Dockerfile
Build server
Build client
Deploy
More information
Ways of running your game
Useful commands
Commands can be ran by pressing `
.
Actor roles & authority when running on Rivet
TODO
Open Level URL format
TODO
Unreal Engine dedicated server ports
TODO
Testing multiple devices on LAN
TODO
Using Test on Device
TODO
Helpful resources
Server mechanics
Multiplayer overview
- Multiplayer replication overview
- eXi Network Compendium
- Networking overview
- Multiplayer programming quickstart
Troubleshooting
Port 7777 already taken for development
netstat -aon | findstr "7777"
taskkill /F /PID MY_PID_HERE
Empty level/no lighting when running with 2+ clients in PIE
This issue can be mitigated by running separate processes when testing your game:
- Navigate to Editor Settings > Play
- Set Multiplayer Options > Run Under One Process to false
Standalone client automatically goes to the wrong map
- Navigate to Editor Settings > Play
- Clear the field Server > Server Map Name Override
If Server Map Name Override is not empty but grayed out, you need to:
- Enable Multiplayer Options > Launch Separate Server
- Clear Server > Server Map Name Override
- Disable Multiplayer Options > Launch Separate Server