December 5, 2018
Replication Graph overview and proper replication methods
For these kinds of games, we need a different approach, and we built the Replication Graph Plugin to provide it. The Replication Graph scales well to large multiplayer games because it mitigates server CPU issues by reducing redundant work and caching data instead of constantly recalculating it. It accomplishes this by treating actors differently, depending on what they do in the game and what relationships they have to other actors, as well as by storing data for use by multiple actors, multiple clients, and even across multiple frames.
The Replication Graph plugin makes it possible to customize network replication in order to build large-scale multiplayer games that would not be viable with traditional replication strategies.
How Replication Graph Works
The Replication Graph contains a series of Replication Graph Nodes that build lists for actors to replicate to each client on demand. These nodes are persistent objects and can store data across multiple frames and share results between client connections. Rather than evaluating each actor for each connection on each frame, the nodes are able to operate on a smaller set of data. This persistent, shared data enables the Replication Graph system to rapidly produce replication lists for clients and is able to scale well to large multiplayer games.
The system provides a more consistent data structure for connections and actors so that you can pull out relevant data and quickly move it to the next stage of the pipeline.
With the Replication Graph Plugin, you can determine what actors should replicate to what connections. This entails customizing when and how you open actor channels, when to replicate an actor on those channels, and when to close those channels. By extension, this allows you to increase productivity and trim redundancies.
Replication Graph Nodes
The general layout of Fortnite's Replication Graph.
Replication Graph Nodes are broken up to handle different tasks, and can be written with specific knowledge of how your game works. One of them may keep lists that track player states, another may keep track of always-relevant replications, and so on. Separating these tasks into different Nodes organizes what needs to be replicated in an efficient manner and removes overhead. For example, the "Grid Spatialization 2D" node divides the world into grid cells and keeps lists of actors that are visible from each cell. This prevents clients from having to distance-check each actor, since they can simply look up the grid cell they currently occupy and copy its list of visible actors. By registering actors with the appropriate nodes, you can ensure that each actor is evaluated for replication in the way that makes the most sense for its role in your game.
Conclusion
When you're building a game where you have 100 connected clients (or more) enveloped in a world full of thousands of actors, the Replication Graph system opens up a lot more optimizations than ever before so that you can produce a large-scale multiplayer game that performs smoothly online.
The Plugin is in an Early Access state at the moment, since minor API changes may be coming in the future. The system is only intended for advanced users working on large-scale games. However, the code is stable and it has undergone heavy testing and live usage as part of Fortnite Battle Royale. If you'd like to work with it directly, you can click here for instructions on how to enable it in your project, or check out the ShooterGame sample (available in the Epic Games Launcher), which comes with a Replication Graph similar to the one used in Fortnite.
To read more, have a look at Epic's Replication Graph documentation, or watch the livestream below.