载入中...
搜索中...
未找到
eve::dev::ScenarioRecorder类 参考

A state-driven bug scenario: baseline snapshot + ordered per-frame inputs. 更多...

#include <ScenarioRecorder.h>

Public 成员函数

 ScenarioRecorder (const ScenarioRecorder &)=delete
 
ScenarioRecorder & operator= (const ScenarioRecorder &)=delete
 
bool begin (HSQUIRRELVM vm, std::string *err=nullptr)
 Start recording: capture the baseline snapshot and observe the event queue.
 
void markFrame ()
 Begin a new frame bucket; no-op unless recording.
 
bool end (const std::string &path, std::string *err=nullptr)
 Stop recording and persist the scenario to a JSON file.
 
void cancel ()
 Abort recording and restore the previous event observer.
 
bool recording () const
 True while a scenario is being recorded.
 
bool beginReplay (HSQUIRRELVM vm, const std::string &path, std::string *err=nullptr)
 Load a scenario and restore its baseline snapshot onto the VM.
 
bool stageFrame ()
 Re-push the next recorded frame's events into the event queue.
 
bool replaying () const
 True while a replay is in progress with frames remaining.
 
int framesRemaining () const
 Number of frames remaining to stage.
 
void setErrorInfo (const std::string &report, const std::string &site)
 Called by DevTool when a script error is dumped during recording.
 
void onEventConsumed (const eve::platform_event::Message &msg)
 Invoked by the event poll observer for every consumed message.
 
void detachObserver ()
 Ensure the event observer is detached (restore previous); safe to call repeatedly.
 
const std::string & baseline () const
 Baseline.
 
const std::vector< ScenarioFrame > & frames () const
 Frames.
 
const std::string & errorReport () const
 Error report.
 
const std::string & errorSite () const
 Error site.
 

静态 Public 成员函数

static ScenarioRecorder & instance ()
 Instance.
 
static bool save (const std::string &baseline, const std::vector< ScenarioFrame > &frames, const std::string &errorReport, const std::string &errorSite, const std::string &path, std::string *err=nullptr)
 Persist a scenario to a JSON file (used for both record and replay paths).
 
static bool load (const std::string &path, std::string *baseline, std::vector< ScenarioFrame > *frames, std::string *errorReport, std::string *errorSite, std::string *err=nullptr)
 Load a scenario from a JSON file into the given outputs.
 

详细描述

A state-driven bug scenario: baseline snapshot + ordered per-frame inputs.

The engine treats itself as stateless (recoverable game state lives in script variables), so restoring the baseline snapshot and re-injecting the recorded per-frame input/event stream reproduces the original run deterministically (given deterministic game logic and RNG seeds).

Record: begin() captures the baseline, an observer on the event module records every consumed message per frame (markFrame()), end() persists the scenario to a JSON file alongside the error report.

Replay: beginReplay() restores the baseline, then each stageFrame() re-pushes one recorded frame's events into the event queue; the caller advances one game frame between calls and watches for the error to reproduce.

在文件 ScenarioRecorder.h 第 47 行定义.

构造及析构函数说明

◆ ScenarioRecorder()

eve::dev::ScenarioRecorder::ScenarioRecorder ( const ScenarioRecorder &  )
delete

成员函数说明

◆ baseline()

const std::string & eve::dev::ScenarioRecorder::baseline ( ) const
inline

Baseline.

在文件 ScenarioRecorder.h 第 100 行定义.

◆ begin()

bool eve::dev::ScenarioRecorder::begin ( HSQUIRRELVM  vm,
std::string *  err = nullptr 
)

Start recording: capture the baseline snapshot and observe the event queue.

返回
false when the VM is null or the baseline capture fails.

在文件 ScenarioRecorder.cpp 第 36 行定义.

引用了 cancel(), eve::dev::Snapshot::capture(), eve::dev::Snapshot::instance() , 以及 vm.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ beginReplay()

bool eve::dev::ScenarioRecorder::beginReplay ( HSQUIRRELVM  vm,
const std::string &  path,
std::string *  err = nullptr 
)

Load a scenario and restore its baseline snapshot onto the VM.

返回
false when the file is invalid or restore fails.

在文件 ScenarioRecorder.cpp 第 114 行定义.

引用了 path , 以及 vm.

◆ cancel()

void eve::dev::ScenarioRecorder::cancel ( )

Abort recording and restore the previous event observer.

在文件 ScenarioRecorder.cpp 第 74 行定义.

引用了 detachObserver().

被这些函数引用 begin(), eve::dev::DevTool::detach() , 以及 eve::dev::DevTool::exposeScriptApi().

◆ detachObserver()

void eve::dev::ScenarioRecorder::detachObserver ( )

Ensure the event observer is detached (restore previous); safe to call repeatedly.

在文件 ScenarioRecorder.cpp 第 29 行定义.

引用了 eve::platform_event::PlatformEvent::setPollObserver().

被这些函数引用 cancel() , 以及 end().

◆ end()

bool eve::dev::ScenarioRecorder::end ( const std::string &  path,
std::string *  err = nullptr 
)

Stop recording and persist the scenario to a JSON file.

参数
pathDestination file (e.g. "scenario_boss.json").
返回
false when not recording or the file cannot be written.

在文件 ScenarioRecorder.cpp 第 62 行定义.

引用了 detachObserver(), ok, path , 以及 save().

◆ errorReport()

const std::string & eve::dev::ScenarioRecorder::errorReport ( ) const
inline

Error report.

在文件 ScenarioRecorder.h 第 104 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ errorSite()

const std::string & eve::dev::ScenarioRecorder::errorSite ( ) const
inline

Error site.

在文件 ScenarioRecorder.h 第 106 行定义.

◆ frames()

const std::vector< ScenarioFrame > & eve::dev::ScenarioRecorder::frames ( ) const
inline

Frames.

在文件 ScenarioRecorder.h 第 102 行定义.

◆ framesRemaining()

int eve::dev::ScenarioRecorder::framesRemaining ( ) const
inline

Number of frames remaining to stage.

在文件 ScenarioRecorder.h 第 88 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ instance()

ScenarioRecorder & eve::dev::ScenarioRecorder::instance ( )
static

◆ load()

bool eve::dev::ScenarioRecorder::load ( const std::string &  path,
std::string *  baseline,
std::vector< ScenarioFrame > *  frames,
std::string *  errorReport,
std::string *  errorSite,
std::string *  err = nullptr 
)
static

Load a scenario from a JSON file into the given outputs.

在文件 ScenarioRecorder.cpp 第 194 行定义.

引用了 eve::dev::ScenarioEvent::args, f, eve::dev::ScenarioFrame::frame, eve::dev::ScenarioEvent::name, path , 以及 root.

◆ markFrame()

void eve::dev::ScenarioRecorder::markFrame ( )

Begin a new frame bucket; no-op unless recording.

在文件 ScenarioRecorder.cpp 第 55 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ onEventConsumed()

void eve::dev::ScenarioRecorder::onEventConsumed ( const eve::platform_event::Message &  msg)

◆ operator=()

ScenarioRecorder & eve::dev::ScenarioRecorder::operator= ( const ScenarioRecorder &  )
delete

◆ recording()

bool eve::dev::ScenarioRecorder::recording ( ) const
inline

True while a scenario is being recorded.

在文件 ScenarioRecorder.h 第 72 行定义.

被这些函数引用 eve::dev::DevTool::exposeScriptApi().

◆ replaying()

bool eve::dev::ScenarioRecorder::replaying ( ) const
inline

True while a replay is in progress with frames remaining.

在文件 ScenarioRecorder.h 第 86 行定义.

◆ save()

bool eve::dev::ScenarioRecorder::save ( const std::string &  baseline,
const std::vector< ScenarioFrame > &  frames,
const std::string &  errorReport,
const std::string &  errorSite,
const std::string &  path,
std::string *  err = nullptr 
)
static

Persist a scenario to a JSON file (used for both record and replay paths).

在文件 ScenarioRecorder.cpp 第 151 行定义.

引用了 a, f, path , 以及 root.

被这些函数引用 end().

◆ setErrorInfo()

void eve::dev::ScenarioRecorder::setErrorInfo ( const std::string &  report,
const std::string &  site 
)

Called by DevTool when a script error is dumped during recording.

在文件 ScenarioRecorder.cpp 第 87 行定义.

被这些函数引用 eve::dev::DevTool::notifyError().

◆ stageFrame()

bool eve::dev::ScenarioRecorder::stageFrame ( )

Re-push the next recorded frame's events into the event queue.

返回
false when replay is exhausted (all frames staged) or not replaying.

在文件 ScenarioRecorder.cpp 第 136 行定义.

引用了 a, eve::dev::ScenarioFrame::events , 以及 eve::platform_event::Variant::makeString().

被这些函数引用 eve::dev::DevTool::exposeScriptApi().


该类的文档由以下文件生成: