So, I’ve been trying to get basic replay functionality working for the past couple of hours, but can’t seem to go forward with this issue.
I loosely followed the tutorial at A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums in order to implement some basic replay functionality. What I’ve got working is this:
- Basic actor replication, including movement, rotation & one multicast RPC, which works in multiplayer. (2 PIE windows)
- Start & stop recording of replays both via console commands ‘demorec’ & ‘demostop’ as well as cpp.
Now, here are the issues: If I use ‘demorec’, ‘demostop’, ‘demoplay’, the replay puts me into the standard spectator pawn and executes fine, for the most part. However, my multicast RPCs don’t seem to get replicated in the replay (though they work in multiplayer on both the host and the client). I tried messing around with them, setting them to server/client only, toggling reliable, etc. but to no success. This occurs in both the editor and the standalone version.
If I use the cpp version, I get something different. Starting & stopping the recording works fine, but when calling UGameInstance::PlayReplay(name), it puts the camera to the world origin & remains immovable (suggesting the spectator pawn/controller was not even initialized). Again, this occurs on both the editor and standalone. When doing this in the editor, it also shows no movement or any of the replicated actors being instantiated (when ejecting the camera and flying around).
This is the relevant C++ code:
void UDNHGameInstance::StartRecording(FString name)
{
StartRecordingReplay(name, TEXT("Testsy"));
}
void UDNHGameInstance::PlayDNHReplay(FString name)
{
PlayReplay(name);
}
void UDNHGameInstance::StopRecording()
{
StopRecordingReplay();
}
All of these are called from within the player pawn (important?) upon keypress (1 for start rec., 2 for stop rec., 3 for play). Again, PlayReplay does not work in this case. (why?)
TL;DR: So basically, there are two issues right now.
- UGameInstance::PlayReplay does not work for me (did I miss some additional config?; I did add the DemoNetDriver to the DefaultEngine.ini as suggested by the tutorial, but have made no other modifications)
- Multicast RPCs are not being called. I have read somewhere that this can be circumvented by adding a variable with RepNotify, but this can easily lead to dozens of variables that exist for the sole purpose of recording replay function calls. Surely this cannot be the only way to do it?
Any help would be greatly appreciated!