载入中...
搜索中...
未找到
RTSReplay.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
10#include "rts/RTSSystems.h"
11
12#include <map>
13
14namespace eve::rts {
15
16class RTS;
17class IRTSActionExecutor;
18
37
56
64public:
66 [[nodiscard]] Result<void> queue(RTSReplayCommand command, SimulationTick currentTick = {});
68 [[nodiscard]] Result<std::size_t> apply(SimulationTick tick, RTS& world);
70 [[nodiscard]] std::string exportText() const;
72 [[nodiscard]] Result<void> importText(std::string_view text, SimulationTick currentTick = {},
73 bool clearExisting = true);
75 void clear() noexcept;
77 [[nodiscard]] std::size_t size() const noexcept { return history_.size(); }
78
79private:
80 std::map<std::uint64_t, std::vector<RTSReplayCommand>> queued_;
81 std::vector<RTSReplayCommand> history_;
82};
83
86public:
90 [[nodiscard]] Result<void> setFixedStep(Duration value);
95 [[nodiscard]] Result<std::size_t> step(RTS& world, IRTSActionExecutor& executor,
96 std::uint64_t count = 1);
98 [[nodiscard]] Result<void> queue(RTSReplayCommand command) {
99 return commands_.queue(std::move(command), tick_);
100 }
102 [[nodiscard]] RTSCommandLog& commands() noexcept { return commands_; }
104 [[nodiscard]] const RTSCommandLog& commands() const noexcept { return commands_; }
106 [[nodiscard]] SimulationTick currentTick() const noexcept { return tick_; }
108 [[nodiscard]] Duration fixedStep() const noexcept { return fixedStep_; }
110 void reset(SimulationTick tick = {}, bool clearCommands = true) noexcept;
111
112private:
113 SimulationTick tick_{};
114 Duration fixedStep_{};
115 RTSCommandLog commands_;
116};
117
118} // namespace eve::rts
double value
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::string text
World3D * world
Deterministic phase-one RTS systems and their ECS contracts.
std::uint32_t count
SimulationTick tick
float step
Definition TreeMesh.cpp:314
Signed, fixed-resolution simulation duration in nanoseconds.
Definition Time.h:43
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:411
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Strong, domain-neutral reference to a runtime subject.
Definition SubjectRef.h:26
Interface isolating RTS orders from the shared action runtime.
Definition RTSAction.h:38
Deterministic lockstep input buffer and portable command log.
Definition RTSReplay.h:63
std::size_t size() const noexcept
Number of retained commands.
Definition RTSReplay.h:77
Fixed-step coordinator that applies lockstep inputs before the existing RTS system pipeline.
Definition RTSReplay.h:85
SimulationTick currentTick() const noexcept
Current completed simulation tick.
Definition RTSReplay.h:106
Duration fixedStep() const noexcept
Configured fixed interval.
Definition RTSReplay.h:108
Result< void > queue(RTSReplayCommand command)
Queue a command relative to the current lockstep timeline.
Definition RTSReplay.h:98
RTSCommandLog & commands() noexcept
Mutable command-log boundary for import/export tooling.
Definition RTSReplay.h:102
const RTSCommandLog & commands() const noexcept
Read-only command-log boundary.
Definition RTSReplay.h:104
Owns RTS root entities and coordinates the phase-one systems.
Definition RTS.h:63
RTSReplayOperation
Stable operation kinds accepted by the shared deterministic RTS input stream.
Definition RTSReplay.h:20
One domain-neutral command submitted to a unit's generic order queue.
Definition RTSTypes.h:101
Input to the pure formation planner.
Definition RTSSystems.h:34
One process-independent command using stable subjects instead of ECS handles.
Definition RTSReplay.h:39
std::vector< SubjectRef > units
Definition RTSReplay.h:42
RTSReplayOperation operation
Definition RTSReplay.h:41
FormationSpec formation
Definition RTSReplay.h:45
Two-dimensional deterministic RTS world position.
Definition RTSTypes.h:48