#pragma once #include #include #include // // Note: the _best_ solution to the 'proper animation state' problem is to implement animation graphs serialization, // and then send the graphs over the network. But since that is a pretty hard reverse engineering task, // let's do simple action replays until better days. // class ActionReplayCache { public: ActionReplayCache() = default; ~ActionReplayCache() = default; static constexpr uint32_t kReplayCacheMaxSize = 32; ActionReplayChain FormRefinedReplayChain() noexcept; /// Appends actions to the replay cache void AppendAll(const Vector& acActions) noexcept; const Vector& GetActions() const noexcept { return m_actions; }; void Clear() noexcept; private: // Returns true if clients should reset the animation graph of the Actor before replaying bool RefineReplayCache() noexcept; static bool IsExitAction(const ActionEvent& acAction) noexcept; static bool ShouldIgnoreAction(const ActionEvent& acAction) noexcept; static std::optional FindInstantCounterpartForAction(std::string_view aAction) noexcept; Vector m_actions{}; };