Strange DemoReplay Issues

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.

  1. 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)
  2. 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!

This has successfully been resolved using the workaround outlined here: Multicast not called in replays - Programming & Scripting - Unreal Engine Forums

Note that this may make it impossible to make a real-time multiplayer game (which is fine for my situation), since the actor will now always access the DemoNetDriver, which is solely for replays as I understand.

It would be great to get some clarification from a dev though, as to why DemoNet behaves the way it does under certain circumstances.

I’m having the same issue with multicast not being recorded and working during replays. Any luck figuring it out?

Did you ever figure out what was happening when called play replay through C++? Right now the same thing is happening to me, the game just hitches and then a couple seconds later the pawn is at the origin and I can’t do anything.

At the time the question was posted this appeared to be a bug in the active UE4 version, but recently (at least since 4.22, possibly earlier) this issue has been resolved for me entirely. If you’re using a recent version but are still experiencing this issue, I suggest double checking your code. If all else fails, probably submit a bug report.

Okay thanks for responding. I was able to get the replay system to work in a basic Third Person template project. I think part of the problem in my other project could be that the replay controller class is null, but idk yet. That project isn’t set up for replication yet so who knows.