Skip to content

feat(simulation): add deterministic fixed-step execution - #27

Merged
czlin7 merged 2 commits into
developfrom
feat/deterministic-simulation
Sep 16, 2026
Merged

czlin7 merged 2 commits into
developfrom
feat/deterministic-simulation

Conversation

@czlin7

@czlin7 czlin7 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a small SimulationClock to decouple real frame time from fixed simulation ticks
  • make pause, speed, maxTicks, and configured timestep operate through fixed-step simulation timing
  • move simulation randomness to a seed-controlled SimulationWorld RNG
  • pass RNG dependencies explicitly into AI/random helpers and use the same stream for spawning
  • add foundation coverage for fixed-step timing and same-seed deterministic simulation
  • split color and random helpers into focused utility headers

Why

The simulation previously advanced directly from variable frame delta and used separate hidden random sources. This made behavior dependent on frame timing and prevented reliable reproduction of a simulation run.

This change establishes a deterministic simulation foundation: with the same initial state, seed, fixed timestep, and tick sequence, the simulation follows the same path within the same execution environment.

Validation

  • local Debug build completed successfully
  • foundation tests passed: 1/1
  • verified production simulation code contains no std::random_device or hidden thread_local RNG
  • manually exercised pause/resume and simulation speed behavior during implementation

@czlin7
czlin7 merged commit f1dc674 into develop Sep 16, 2026
3 checks passed
@czlin7
czlin7 deleted the feat/deterministic-simulation branch September 16, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant