This tutorial walks you through setting up the Bloodstain Replay system in a multiplayer environment.
Prerequisite: Before proceeding, we recommend that you first complete the Quick Start guide. This tutorial is based on the Third-Person Template in Unreal Engine.
Step 1: Change Player Controller Inheritance
First, you must modify the inheritance structure of your project’s Player Controller to enable the plugin’s network features.
-
Check Your GameMode: Open your project’s default GameMode (e.g.,
BP_ThirdPersonGameMode
) and identify which class is set as the Player Controller Class. -
Add Module Dependency (C++ Projects Only)
Before modifying code, you must add the
BloodStainSystem
module to the dependency list in your project’s.Build.cs
file (e.g.,YourProject.Build.cs
). This allows the compiler to locate theAGhostPlayerController
class.Note: After modifying the
.Build.cs
file, if the changes are applied correctly, you should be able to include the header file without a full path. If not, it is recommended that you right-click the.uproject
file, select “Generate Visual Studio project files,” and then Rebuild the project in Visual Studio.Important: If your classes are inherited across multiple modules (e.g., A -> B -> C), you must add the
BloodStainSystem
dependency to the.Build.cs
file of every module in the inheritance chain. -
Change the Parent Class:
Now, open the Player Controller you identified and change its parent class. The key is to alter the existing inheritance structure from (
... -> APlayerController
) to (... -> AGhostPlayerController -> APlayerController
).In other words, instead of having your Player Controller inherit directly from
APlayerController
, modify it to inherit from the plugin’sAGhostPlayerController
.
Step 2: Optimize Network Settings
For stable multiplayer performance, we strongly recommend configuring a few key options.
-
Set Up Variable Replication: In your character Blueprint (e.g.,
BP_ThirdPersonCharacter
), select theBloodStainActor
variable created during the Quick Start guide. In the Details panel, change its Replication option toReplicated
. This ensures that information about which bloodstain the player is interacting with is passed from the server to clients, allowing you to synchronize UI logic. -
Configure Data Quantization:
Reducing the size of data sent over the network is crucial. In the
Bloodstain Subsystem
’s file save options, setting the Quantization Option to a lower value can significantly reduce network load. For more details, please refer to the Configuring Options section.Known Limitations: The system’s replay data transfer is based on Unreal Engine’s RPC (Remote Procedure Call) system. While this method is stable, it can have speed limitations when transferring large amounts of data at once. Therefore, recording and transmitting numerous replays simultaneously may lead to performance degradation. Please consider this system load during your project planning.
Results
After completing the setup, you can see the system working correctly in a multiplayer environment, as shown below.
Advanced Tutorial: Applying to the Lyra Starter Game
This section provides an example of how to integrate the system into Epic Games’ Lyra Starter Game (based on Lyra version 5.6).
-
Character and Plugin Setup
First, find
B_hero_shooter
, the primary character class used in the Lyra Starter Game.Next, connect the Blueprint nodes as you did in the basic template example. It is also recommended to set the Quantization option to
Low
inB_LyraGameMode
or a similar GameMode class. -
Modify Player Controller Inheritance
Search for
LyraPlayerController
, the controller used in Lyra.By tracing its inheritance, you’ll find that
AModularPlayerController
inherits fromAPlayerController
. You must change this parent class toAGhostPlayerController
. To do so, add theBloodStainSystem
dependency to the.Build.cs
files of all modules in the inheritance chain (ModularGameplayActors.cs, CommonGame.cs, and LyraGame.cs).If the dependencies are added correctly, you should be able to include the header file without a full path.
Now, change the parent class of
AModularPlayerController
toAGhostPlayerController
. -
Final Result and Important Note
The setup is now complete. You can now see multiple players viewing a Ghost together in a multiplayer session.
Note: You will encounter an error if you try to apply the
DefaultGhost
Material. This is because the SkeletalMeshAsset used in Lyra Game uses Nanite, which does not support translucent materials. To use our material or any other translucent material, you must first disable the Nanite setting for the mesh.