implement simulation shell

This commit is contained in:
2026-04-19 15:49:18 +02:00
parent 41fd2a83ee
commit ffe69f08b5
8 changed files with 275 additions and 0 deletions

21
src/lib/sim/TickDriver.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
// Accumulator-based fixed-timestep driver. Decouples wall-clock render rate
// from the 30 Hz simulation tick rate. See architecture.md §Render Loop.
class TickDriver
{
public:
TickDriver() = default;
// Adds elapsedWallMs * gameSpeedMultiplier to the accumulator and returns
// how many simulation ticks should be stepped this frame. The remainder
// stays in the accumulator for the next call.
// A multiplier of 0.0 freezes accumulation (pause).
// Valid multipliers per REQ-UI-SPEED: 0, 0.5, 1, 2, 4.
int advance(double elapsedWallMs, double gameSpeedMultiplier);
void reset();
private:
double m_accumulatorMs = 0.0;
};