Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
bicameral::save::ReplayPlayer Class Reference

#include <replay_session.h>

Collaboration diagram for bicameral::save::ReplayPlayer:
[legend]

Public Member Functions

 ReplayPlayer (ReplayFile replay)
std::vector< sim::Command > TakeCommands (uint64_t applyTick, uint32_t limit)
void CheckHash (uint64_t tick, uint64_t hash)
void Rewind (uint64_t tick)
bool Finished () const
bool Passed () const
uint64_t Matches () const
uint64_t Mismatches () const
uint64_t LateCommands () const
size_t HashCount () const
size_t CommandCount () const
uint64_t LastTick () const

Static Public Member Functions

static std::expected< ReplayPlayer, std::string > Load (const fs::path &path)

Static Public Attributes

static constexpr uint64_t LOOKAHEAD_TICKS = 8

Private Attributes

ReplayFile m_replay
size_t m_nextCommand = 0
size_t m_nextHash = 0
uint64_t m_matches = 0
uint64_t m_mismatches = 0
uint64_t m_lateCommands = 0

Detailed Description

Definition at line 37 of file replay_session.h.

Constructor & Destructor Documentation

◆ ReplayPlayer()

bicameral::save::ReplayPlayer::ReplayPlayer ( ReplayFile replay)
explicit

Definition at line 45 of file replay_session.cpp.

References m_replay.

Referenced by Load().

Here is the caller graph for this function:

Member Function Documentation

◆ CheckHash()

void bicameral::save::ReplayPlayer::CheckHash ( uint64_t tick,
uint64_t hash )

Definition at line 92 of file replay_session.cpp.

References bicameral::Error, bicameral::Log(), m_matches, m_mismatches, m_nextHash, m_replay, and bicameral::Sim.

Here is the call graph for this function:

◆ CommandCount()

size_t bicameral::save::ReplayPlayer::CommandCount ( ) const
inlinenodiscard

Definition at line 67 of file replay_session.h.

References m_replay.

◆ Finished()

bool bicameral::save::ReplayPlayer::Finished ( ) const
inlinenodiscard

Definition at line 58 of file replay_session.h.

References m_nextHash, and m_replay.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay(), and Passed().

Here is the caller graph for this function:

◆ HashCount()

size_t bicameral::save::ReplayPlayer::HashCount ( ) const
inlinenodiscard

Definition at line 66 of file replay_session.h.

References m_replay.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay().

Here is the caller graph for this function:

◆ LastTick()

uint64_t bicameral::save::ReplayPlayer::LastTick ( ) const
inlinenodiscard

Definition at line 68 of file replay_session.h.

References m_replay.

◆ LateCommands()

uint64_t bicameral::save::ReplayPlayer::LateCommands ( ) const
inlinenodiscard

Definition at line 63 of file replay_session.h.

References m_lateCommands.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay().

Here is the caller graph for this function:

◆ Load()

std::expected< ReplayPlayer, std::string > bicameral::save::ReplayPlayer::Load ( const fs::path & path)
staticnodiscard

Definition at line 47 of file replay_session.cpp.

References bicameral::save::Probe, bicameral::save::ReadReplayFile(), and ReplayPlayer().

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::CreateParts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Matches()

uint64_t bicameral::save::ReplayPlayer::Matches ( ) const
inlinenodiscard

Definition at line 61 of file replay_session.h.

References m_matches.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay().

Here is the caller graph for this function:

◆ Mismatches()

uint64_t bicameral::save::ReplayPlayer::Mismatches ( ) const
inlinenodiscard

Definition at line 62 of file replay_session.h.

References m_mismatches.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay().

Here is the caller graph for this function:

◆ Passed()

bool bicameral::save::ReplayPlayer::Passed ( ) const
inlinenodiscard

Definition at line 59 of file replay_session.h.

References Finished(), m_lateCommands, and m_mismatches.

Referenced by bicameral::frame::anonymous_namespace{frame_loop.cpp}::FrameLoop::FinishReplay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Rewind()

void bicameral::save::ReplayPlayer::Rewind ( uint64_t tick)

◆ TakeCommands()

std::vector< sim::Command > bicameral::save::ReplayPlayer::TakeCommands ( uint64_t applyTick,
uint32_t limit )
nodiscard

Definition at line 58 of file replay_session.cpp.

References bicameral::Error, bicameral::Log(), LOOKAHEAD_TICKS, m_lateCommands, m_nextCommand, m_replay, bicameral::sim::Command::sequence, bicameral::Sim, and bicameral::sim::Command::targetTick.

Here is the call graph for this function:

Member Data Documentation

◆ LOOKAHEAD_TICKS

uint64_t bicameral::save::ReplayPlayer::LOOKAHEAD_TICKS = 8
staticconstexpr

Definition at line 39 of file replay_session.h.

Referenced by TakeCommands().

◆ m_lateCommands

uint64_t bicameral::save::ReplayPlayer::m_lateCommands = 0
private

Definition at line 82 of file replay_session.h.

Referenced by LateCommands(), Passed(), and TakeCommands().

◆ m_matches

uint64_t bicameral::save::ReplayPlayer::m_matches = 0
private

Definition at line 80 of file replay_session.h.

Referenced by CheckHash(), and Matches().

◆ m_mismatches

uint64_t bicameral::save::ReplayPlayer::m_mismatches = 0
private

Definition at line 81 of file replay_session.h.

Referenced by CheckHash(), Mismatches(), and Passed().

◆ m_nextCommand

size_t bicameral::save::ReplayPlayer::m_nextCommand = 0
private

Definition at line 76 of file replay_session.h.

Referenced by Rewind(), and TakeCommands().

◆ m_nextHash

size_t bicameral::save::ReplayPlayer::m_nextHash = 0
private

Definition at line 77 of file replay_session.h.

Referenced by CheckHash(), Finished(), and Rewind().

◆ m_replay

ReplayFile bicameral::save::ReplayPlayer::m_replay
private

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