I’m trying to implement an Instant Replay killcam and I’m close to getting it work. But I’ve run into a problem. The recording part of the Replay system works, but when I try to play the InMemory replay back, it crashes. I’m following the model in the DemoNetDriver and Stream documentation and creating two DemoNetDrivers, one for recording and one for playback, but I think this is the problem. It’s when the Player Controller spawned for the second driver tries to replicate, the assertion fails because the map already contains the RPC.
Here’s the log output:
[2017.02.27-06.30.47:016][ 70]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: UDemoNetConnection, Name: DemoNetConnection_1, Driver: KillcamWatchDriver DemoNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL, Channels: 1, Time: 2017.02.27-06.30.47
[2017.02.27-06.30.47:016][ 70]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: UDemoNetConnection, Name: DemoNetConnection_1, Driver: KillcamWatchDriver DemoNetDriver_1, IsServer: NO, PC: NULL, Owner: NULL
[2017.02.27-06.30.48:446][ 70]LogDemo: Fast forward took -0.06 seconds.
[2017.02.27-06.30.48:446][ 70]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 35.81, Realtime: 42.30. DemoNetDriver_0
[2017.02.27-06.30.48:446][ 70]LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 35.81, Realtime: 42.30. IpNetDriver_0
[2017.02.27-06.30.58:761][ 70]LogOutputDevice:Warning:
Script Stack:
PlayerState.OnRep_PlayerName
Assertion failed: !GuidCache->NetFieldExportGroupIndexToPath.Contains( NewNetFieldExportGroup->PathNameIndex ) [File:D:\UE4\Source Builds\4-15-release\Engine\Source\Runtime\Engine\Private\PackageMapClient.cpp] [Line: 1094]
The patch notes say this was a bug fixed in 4.15 which is pretty ironic since that’s the version I’m on (although I haven’t tried on disk replays yet).
And here’s some of the local values from the UNetDriver::InternalProcessRemoteFunction that processes the RPC:
+ Actor 0x0000018d41663580 (Name=0x0000018d6ffc6bb0 "PlayerController"_1) AActor * {APlayerController}
+ Function 0x0000018d134f81e0 (Name=0x0000018d6fdf1620 "ClientReceiveLocalizedMessage") UFunction *
If I only use one DemoNetDriver for both recording and playback (stop the recording when playing back), the Instant Replay works, but then crashes when I destroy it because it created two different NetConnections.