OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends | List of all members
EngineTraceRecorder Class Reference

#include <EngineTraceRecorder.h>

Inheritance diagram for EngineTraceRecorder:
PlatformApplicationAware

Public Member Functions

 EngineTraceRecorder ()
 
 ~EngineTraceRecorder ()
 
void startRecording (EngineController *game, const Blob &savedGame={})
 
EngineTraceRecording finishRecording (EngineController *game)
 
bool isRecording () const
 

Private Attributes

Blob _savedGame
 
std::unique_ptr< EventTrace_trace
 
std::unique_ptr< ConfigPatch_configSnapshot
 
std::unique_ptr< FileSystem_ramFs
 
std::optional< ScopedRollback< FileSystem * > > _fsRollback
 

Friends

class PlatformIntrospection
 

Additional Inherited Members

- Private Member Functions inherited from PlatformApplicationAware
 ~PlatformApplicationAware ()=default
 
PlatformApplicationapplication () const
 
template<class T >
T * component () const
 
virtual void installNotify ()
 
virtual void removeNotify ()
 

Detailed Description

Component that exposes a trace recording interface. Doesn't have a Component in its name because who likes class names half a screen long.

Depends on EngineDeterministicComponent and EngineTraceSimpleRecorder, install them into PlatformApplication first.

Note that the difference from EngineTraceSimpleRecorder is that this component isn't dumb and offers a complete solution to trace recording. Traces that were recorded with startRecording / finishRecording can then be played back with EngineTracePlayer.

Some notes on how this works. When starting trace recording:

Why do we need to start trace recording with loading the game? Loading the game updates the states of all actors on the map, and since trace recording and playback must start in the same state, the only option that we have is to start both trace playback and trace recording by loading the same save.

See also
EngineTracePlayer

Constructor & Destructor Documentation

◆ EngineTraceRecorder()

EngineTraceRecorder::EngineTraceRecorder ( )

◆ ~EngineTraceRecorder()

EngineTraceRecorder::~EngineTraceRecorder ( )

Member Function Documentation

◆ finishRecording()

EngineTraceRecording EngineTraceRecorder::finishRecording ( EngineController game)

Finishes trace recording.

Note that this method needs to be called from the control thread, see EngineControlComponent.

Parameters
gameEngine controller.
Returns
Resulting recording.

◆ isRecording()

bool EngineTraceRecorder::isRecording ( ) const
inline
Returns
Whether recording is in progress. Make sure to call this method only from the control thread, otherwise you basically can't reason about the current recording state.

◆ startRecording()

void EngineTraceRecorder::startRecording ( EngineController game,
const Blob savedGame = {} 
)

Starts trace recording.

Note that this method needs to be called from the control thread, see EngineControlComponent.

Parameters
gameEngine controller.
savedGameSaved game to load instead of starting recording from current game state.

Friends And Related Function Documentation

◆ PlatformIntrospection

friend class PlatformIntrospection
friend

Member Data Documentation

◆ _configSnapshot

std::unique_ptr<ConfigPatch> EngineTraceRecorder::_configSnapshot
private

◆ _fsRollback

std::optional<ScopedRollback<FileSystem *> > EngineTraceRecorder::_fsRollback
private

◆ _ramFs

std::unique_ptr<FileSystem> EngineTraceRecorder::_ramFs
private

◆ _savedGame

Blob EngineTraceRecorder::_savedGame
private

◆ _trace

std::unique_ptr<EventTrace> EngineTraceRecorder::_trace
private

The documentation for this class was generated from the following files: