Using Network Emulation

An Overview for Using Network Emulation in Unreal.

Choose your operating system:

Windows

macOS

Linux

Testing multiplayer on a single machine requires you to run multiple instances of your game, with one acting as a server and the others acting as clients. Normally, this creates an environment with ideal conditions for your replicated data. Your replicated data will be passed through the appropriate systems, similar to a real networked environment, but there will be no lag or packet loss, which means you won't get an accurate idea of how it will behave when deployed to end-users. Similarly, LAN-based tests will not experience these conditions.

Network Emulation simulates lag and packet loss for servers and clients. This is crucial in identifying issues that may arise in networking environments. To use Network Emulation, Project Settings > Level Editor > Play > Multiplayer Options, then set Enable Network Emulation set to enabled. This will enable the Network Emulation settings.

image_0.png

Settings Reference

The Network Emulation settings are configurable in both the editor, config files, and through the console. These settings provide you with multiple ways to use them in different contexts, such as testing high latency, packet loss, or jitter.

Setting

Description

PktLag

Delays the sending of a packet by the amount of time specified in milliseconds

PktLagVariance

Provides some randomness to the amount of time a packet is delayed, +/- the amount specified in milliseconds

PktLoss

Specifies a percentage chance of an outbound packet being discarded to simulate packet loss

PktDup

Specifies a percentage chance to send a duplicate packet

PktOrder

Sends packets out of order when enabled (1 = enabled, 0 = disabled)

There are three ways to configure these settings: from the Command Line, from executing in Play from the Console, and the Engine.INI file.

Command-line arguments

From the Command Line, specify the setting using:

=

Console

From within the Console use:

Net =

Default Engine.Ini

To set these values from your DefaultEngine.ini file, add the following section and assign each variable a value you want to be tested.

[PacketSimulationSettings]

PktLag=0

PktLagVariance=0

PktLoss=0

PktOrder=0

PktDup=0

Recommendations for Use

Multiplayer games running with perfect connectivity will not experience many bugs that only occur during poor connectivity. To ensure that you catch these bugs, you should perform local and LAN-based tests with extremely harsh conditions. For example:

  • 500 round trip ping.

  • 10% packet loss or higher.

Epic Games uses conditions like these to test cooperative and competitive gameplay. This makes it possible to catch numerous bugs and exploits that would otherwise go overlooked, and strongly incentivizes optimizing network performance.

This page was written for a previous version of Unreal Engine and has not been updated for the current Unreal Engine 5.0 release.