Skip to content

UExperimentDemoSubsystem

Game instance subsystem that manages demo recording, playback, and replay enumeration.

Syntax

class UExperimentDemoSubsystem : public UGameInstanceSubsystem

Remarks

Adapted from the driving simulator so that any project can use this functionality without replacing its own game instance class. Attach to any UGameInstance by including the plugin. Provides Blueprint-callable wrappers for all core replay operations, a demo-rendering pipeline for offline frame capture, and OBS integration stubs. UCLASS

Inheritance Hierarchy

UGameInstanceSubsystem → UExperimentDemoSubsystem

Methods

Method Signature Description Blueprint
BP_OnFindReplaysComplete void UExperimentDemoSubsystem::BP_OnFindReplaysComplete(const TArray< FReplayInfo > &AllReplays) Blueprint event fired when replay enumeration completes. yes
CaptureFrames bool UExperimentDemoSubsystem::CaptureFrames() const Returns whether the spectator controller should capture frames during playback.
Deinitialize void UExperimentDemoSubsystem::Deinitialize() override Called by Unreal when the subsystem is destroyed.
DeleteReplay void UExperimentDemoSubsystem::DeleteReplay(const FString &ReplayName) Deletes an existing replay from disk. yes
DemoRenderFrames void UExperimentDemoSubsystem::DemoRenderFrames(const FString &demoName, int fps) Plays back a demo and renders each frame to disk using a spectator controller. yes
FindReplays void UExperimentDemoSubsystem::FindReplays() Asynchronously enumerates all available demo files. yes
GetCaptureFPS int UExperimentDemoSubsystem::GetCaptureFPS() const Returns the target frame rate for demo rendering.
GetCaptureFolder FString * UExperimentDemoSubsystem::GetCaptureFolder() const Returns folder path where captured frames are saved.
GetDemoName FString * UExperimentDemoSubsystem::GetDemoName() const Returns the filename of the demo currently being rendered.
GetDemoState int UExperimentDemoSubsystem::GetDemoState() const Returns the current demo recording status code.
GetDemosList const TArray< FString > & UExperimentDemoSubsystem::GetDemosList() Returns the list of demo filenames, enumerated from disk on every call. yes
GetExperimentType EExperimentType UExperimentDemoSubsystem::GetExperimentType() const Returns the current experiment type loaded from settings.
GetIsDemoRenderedList const TArray< bool > & UExperimentDemoSubsystem::GetIsDemoRenderedList() Returns a bool array indicating which demos have already been rendered. yes
GetPlayerPawn APawn * UExperimentDemoSubsystem::GetPlayerPawn() Returns the player pawn, using tag-based lookup or name-based lookup as appropriate.
GetPlayerPawnByName APawn * UExperimentDemoSubsystem::GetPlayerPawnByName() Finds the player pawn by searching for an actor whose name matches the stored player pawn name.
GetPlayerPawnByTag APawn * UExperimentDemoSubsystem::GetPlayerPawnByTag() Finds the player pawn by searching for an actor tagged with ExperimentPlayerTag.
Initialize void UExperimentDemoSubsystem::Initialize(FSubsystemCollectionBase &Collection) override Called by Unreal when the subsystem is created.
IsAutoRender bool UExperimentDemoSubsystem::IsAutoRender() const Whether we should automatically render all demos.
IsPlayingReplay bool UExperimentDemoSubsystem::IsPlayingReplay() Returns whether a replay is currently being played back.
IsRecordingReplay bool UExperimentDemoSubsystem::IsRecordingReplay() Returns whether a replay is currently being recorded. yes
OnReplayEnded void UExperimentDemoSubsystem::OnReplayEnded() Marks replay playback as ended and returns all replay and recording state to its initial values, so the reloaded gameplay world starts clean: a later watched replay does not re-enter the frame-capture path, auto demo recording can trigger again, and pawn lookups do not go through the dead replay pawn's cached name.
PlayReplay void UExperimentDemoSubsystem::PlayReplay(const FString &replayName) Plays the demo with the given name.
PlayReplayFromBP void UExperimentDemoSubsystem::PlayReplayFromBP(FString ReplayName) Blueprint-callable wrapper to begin playing back a demo. yes
ReadSettings void UExperimentDemoSubsystem::ReadSettings(UExperimentSettings *settings) Reads relevant settings from the settings object.
RenameReplay void UExperimentDemoSubsystem::RenameReplay(const FString &ReplayName, const FString &NewFriendlyReplayName) Renames an existing replay. yes
RequestOBSRecording int UExperimentDemoSubsystem::RequestOBSRecording(bool startStop) Requests OBS to start or stop recording.
SetCaptureFolder void UExperimentDemoSubsystem::SetCaptureFolder(const FString &folder) Sets the folder where rendered frames will be saved.
StartRecordingReplay void UExperimentDemoSubsystem::StartRecordingReplay(const FString &name, const FString &friendlyName) Begins recording a new demo.
StartRecordingReplayFromBP void UExperimentDemoSubsystem::StartRecordingReplayFromBP(FString ReplayName, FString FriendlyName) Blueprint-callable wrapper to begin recording a demo. yes
StopRecordingReplay void UExperimentDemoSubsystem::StopRecordingReplay() Stops the currently active demo recording.
StopRecordingReplayFromBP void UExperimentDemoSubsystem::StopRecordingReplayFromBP() Blueprint-callable wrapper to stop the currently active demo recording. yes

Properties

Property Type Description Blueprint
demoStartTime FDateTime Timestamp recording when the current demo recording started.
replayToRender FString Name of the next replay to render when auto-rendering is enabled. yes