Example Projects
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

Download here

  • Make sure you download the version corresponding to your Unreal version
  • You may have to restart

Install Visual Studio prerequisites

See official guide

Download the Unreal Engine source code

See official guide

  • Join GitHub team
  • Clone UnrealEngine repo

Build the Unreal Engine editor

See official guide

  1. Install Visual Studio prerequisites
    • TODO: See Setting Up Visual Studio > C++ Tools
  2. .\Setup.bat
  3. .\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.
  4. Open UE5.sln
  5. Wait for Indexing folder UnrealEngine to finish
    • You can see this by clicking the messae tab in the bottom left
  6. Set Solution Configuration to Development Editor
  7. Set Solution Platform to Win64
  8. Right click UE5 target in right sidebar and click Build
    • Takes 10-40 minutes depending on your hardware
  9. Right click on UE5 in the sidebar and click Debug > Start New Instance
  10. 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

  1. Configure PIE networking configuration
  2. Run the project
  3. Check that you can see your players running around

Build Linux server

See official guide

  • 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:

Source/MyProejct/MyProject.Build.cs
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

Set game mode base

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


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:

  1. Navigate to Editor Settings > Play
  2. Set Multiplayer Options > Run Under One Process to false

Standalone client automatically goes to the wrong map

  1. Navigate to Editor Settings > Play
  2. Clear the field Server > Server Map Name Override

If Server Map Name Override is not empty but grayed out, you need to:

  1. Enable Multiplayer Options > Launch Separate Server
  2. Clear Server > Server Map Name Override
  3. Disable Multiplayer Options > Launch Separate Server