Instant Replay or Killcam

I’m trying to implement an Instant Replay Killcam feature in my game where when the play dies, it plays back the last couple of seconds before their death in an instant replay. Right now I have it set to when the player character spawns, their client creates a DemoNetDriver on the local machine using an InMemory Replay Streamer. The recording part works fine. It’s when I try to play back the replay is where I get confused.

Following the code in AGameInstance from PlayReplay(), it destroys the current DemoNetDriver and creates another one. I can understand this logic for on disk replays, but I can’t figure out how to translate this logic for In Memory replays. According to the “DemoNetDriver and Streamers” page in the documentation, you’re supposed to create 2 different DemoNetDrivers, one for the live game and one for the collection of Dynamic Duplicate Levels where the replay is actually played. I can’t figure out how I would go about doing this.

If I follow the code for regular replays, when I call InitConnect() on the DemoNetDriver using InMemoryReplayStreamer, it disconnects from the live game to travel to the replay world, which is undesired. I want it to switch visibility to the Dynamic Duplicate Levels collection without disconnecting from the live game.

So that leaves my question: how do you connect to a DemoNetDriver to watch the replay without disconnecting from and destroying the IpNetDriver that connects to the live server?

1 Like

Hi Chilliam,

I’m just wondering if you ever managed to get this working? I’m having the same issue that you were having and am struggling to understand what’s going on. Any advice that you have would be really helpful!

Thanks,

Check out the source code for UT4, that has instant replays in its Raid gamemode which uses a clientside demo recording and I wouldn’t imagine it being too difficult to adapt that for serverside demos. Replays work there by having a separate replay world and switching between them on the fly without disconnecting the player from the live game.

Maybe you can look into this
Unreal already has built in recording system Using the Replay System in Unreal Engine | Unreal Engine 5.1 Documentation