Skip to content

Lesson 16 — Make repetition measurable ​

Where this lesson fits: runs have persistent choices. Add a daily entry point and local statistics, then be precise about which parts of a daily run are actually repeatable.

Time: 2 hours

Prerequisites and outcomes ​

Complete lesson 15. By the end, you can describe the daily seed's current use and trace how run events update local profile statistics.

Prepare and run ​

  1. From your learner project's solution folder, follow tutorial chapter 14 steps 1–6.
  2. Open Source\Game\LastPerimeterApp.cs and find StartRun, UpdateLevelComplete, and FinishRun; then open Source\Systems\ProfileTracker.cs.
  3. Run dotnet test --filter FullyQualifiedName~ProfileTrackerTests, then run dotnet run --project Platforms\DesktopVK. Follow the tutorial's daily checkpoint; exit and relaunch to check local persistence.

Code anchors ​

  • last-perimeter/Source/Data/GameSession.cs (RunMode, DailyChallengeSeed)
  • last-perimeter/Source/Data/PlayerStatistics.cs
  • last-perimeter/Source/Systems/ProfileTracker.cs
  • last-perimeter/Source/Game/LastPerimeterApp.cs (StartRun, run summary)

Guided operations ​

  1. Start a Daily Challenge and follow how the UTC date becomes a seed.
  2. Find where that seed affects the upgrade draft. Compare it with the random sources used for enemies and powerups.
  3. Trace a run start, capture, powerup, level clear, and run end into profile statistics.
  4. Inspect the run summary and identify which values come from the current GameSession and which come from persistent profile state.
  5. Write one sentence that accurately describes today's determinism. Do not claim that the entire run replays identically.

Checkpoint ​

You can explain how two players receive the same upgrade offers for the daily seed and why enemy and powerup behavior may still differ.

Common mistakes ​

  • Treating one seeded subsystem as proof that all randomness is seeded.
  • Storing a daily seed in a place that survives when it should be recalculated.
  • Reporting telemetry externally; the current statistics are local.

Questions and extension ​

What inputs would need to share a seed for a truly reproducible daily run? Design a determinism test before threading that seed through more systems.