Skip to content

ExperimentState

A single-frame snapshot of all experiment state, collected during demo playback.

Syntax

class ExperimentState : public IExperimentAgentComponentVisitor

Remarks

Each instance records the simulation time, frame number, all agent component positions and rotations, and the subject's replicated player state (TTL, points, etc.). Implements IExperimentAgentComponentVisitor so that agent components can push their data in.

After collection, call WriteToFile() to serialize the frame as XML-style log output.

Interfaces Implemented

  • IExperimentAgentComponentVisitor

Methods

Method Signature Description Blueprint
ExperimentState ExperimentState::ExperimentState(double time)
ExperimentState::ExperimentState(double time, int frame)
Constructs a state snapshot for the given simulation time.
GetDisplayedPromptType EDisplayedPromptType ExperimentState::GetDisplayedPromptType() const Returns the type of prompt being displayed at the time of this frame.
GetFrame int ExperimentState::GetFrame() const Returns the rendered frame index for this snapshot.
GetFrameTime double ExperimentState::GetFrameTime() const Returns the simulation time at which this frame was captured.
GetPoints int ExperimentState::GetPoints() const Returns the subject's accumulated points at the time of this frame.
Num int ExperimentState::Num() const Returns the number of entity states recorded in this frame.
Record void ExperimentState::Record(TArray< const UExperimentAgentComponent * > agents, AExperimentSubjectState *playerState) Records the full frame into this snapshot: visits every agent and copies the subject's TTL count, points, and displayed prompt type.
RecordStates void ExperimentState::RecordStates(TArray< const UExperimentAgentComponent * > agents) Visits all agent components in the given array and records their states.
TotalTTLCount int ExperimentState::TotalTTLCount() const Returns the total number of TTLs recorded at the time of this frame.
Visit void ExperimentState::Visit(const UExperimentAgentComponent &agent) override
void ExperimentState::Visit(const UExperimentPlayerAgentComponent &agent) override
Called by UExperimentAgentComponent::AcceptVisitor to record this agent's state.
WriteContents void ExperimentState::WriteContents(std::ofstream &stream, int &indent) Writes the inner XML content for this frame.
WriteFrameAttributes virtual void ExperimentState::WriteFrameAttributes(std::ofstream &stream) Writes additional attributes into the tag.
WriteToFile void ExperimentState::WriteToFile(std::ofstream &logFile, int &indentation) Writes the state at this frame out to XML at the given file stream.
operator[] EntityState & ExperimentState::operator[](int index) Returns the EntityState at the given index.
~ExperimentState ExperimentState::~ExperimentState() Destructor.

Properties

Property Type Description Blueprint
displayedPromptType EDisplayedPromptType Type of prompt displayed during this frame.
entityStates TArray< EntityState > Per-agent position/rotation/type snapshots for this frame.
frame int Zero-based replay rendering frame index.
isTTL bool True if a TTL pulse was active during this frame.
points int Subject's accumulated points at the time of this frame.
thisType EEntityType Entity type of the primary tracked actor for this frame.
time double Simulation time in seconds at which this frame was captured.
totalTTLs int Total TTLs received up to this frame.