Hi,
I’m trying to use the Replay framework to allow for more consistent performance profiling whilst performing several actions with my player character while traversing levels.
Due to Replay spawning its own SpectatorPawn/Controller the default behaviour when playing a recorded demo is that you’d get a static camera probably at the center of your world.
My desired behaviour is to get the replay to play back the same viewtarget as was used during recording (behind shoulder camera in case of a third person game). Ideally I’d like to get this working just through the use of console commands without needing to override ReplayPawn/Controller behaviour.
This seems to be what Demo.SetLocalViewerOverride should handle. Unfortunately, I’m unable to get this to work.
Looking at the code I got the impression Demo.ActorPrioritizationEnabled might also need to be enabled for this to work but it didn’t seem to make a difference.
Could I get clarification on how to use Demo.SetLocalViewerOverride as well as its intended usage?
Is it possible to get the kind of demo replay I desire simply through correct usage of console commands?
While scouring UDN (or EpicProSupport now I suppose, old habits die hard) and going through the code I also noticed there are a bunch of options you can set for customizing your recorded demos including where they’re saved out to etc. Looking for DemoURL.HasOption calls check for several options such as “SkipSpawnSpectatorController” but how is this intended to be used? As a flag after the console command like so? demorec test_01 -SkipSpawnSpectatorController
Lastly, to reaffirm my understanding of some behaviour I’ve seen I’d like to ask if the usage of console commands are also recorded and played back by the demonetdriver during a replay? I’ve seen console commands to spawn actors work the same way when recorded and played back but I assume this is due to the actor spawning being replicated and thus recorded rather than the console command itself.
Thanks for any assistance you can provide!
Kind regards,
Gaethan
Hi,
In this case, I don’t believe demo.SetLocalViewerOverride or the “SkipSpawnSpectatorController” option will do what you’re looking for. Unfortunately, you will likely need to implement your own replay spectator.
You are correct that the viewer override should be used in conjunction with Demo.ActorPrioritizationEnabled. If the DemoNetDriver is determining the priority of actors being recorded into the replay, it uses the position and rotation of the connection’s ViewTarget when calling AActor::GetReplayPriority. The ViewerOverride on the DemoNetDriver provides a way to change which ViewTarget is being used. This does not do anything to change which pawn is spectated during playback.
The “SkipSpawnSpectatorController” is meant to be added to the AdditionalOptions string passed to AGameInstance::StartRecordingReplay. However, this option is meant to be used when recording something like an “instant replay” that is intended to be played back while the game is still going on, since the game will have its own controller/spectator already around (more info [Content removed]
In this case, you’ll still need to spawn a spectator controller, as during playback, this controller and its spectator pawn are what will be used by the local player to spectate the replay. It is up to the project to implement its own spectator class and define its camera’s behavior. You can check out the Lyra sample project (ALyraReplayPlayerController) for an example.
Finally, I do not believe console commands will be recorded into the replay, but any replicated effects of those commands will. In the example you mentioned, you are correct that it is the replicated actor’s spawn that is recorded, not the console command itself.
Thanks,
Alex
Hi Alex,
Apologies for the late response. Thank you for all that information, this helped a lot in my understanding.
I’ll just do as suggested and set up the appropriate spectator classes to get the behaviour I’m looking for next time I’m needing to do some profiling.
Thanks again! Feel free to close this question.
Hi,
I’m glad that I could help! If you have any further questions, please don’t hesitate to reach out.
Thanks,
Alex