Appearance
Lesson 15 — Separate level, run, and profile progression
Where this lesson fits: screen flow and profile persistence exist. Now connect level completion to a deterministic choice whose effects last for the run, not forever.
Time: 2–3 hours
Prerequisites and outcomes
Complete lessons 12 and 14. By the end, you can trace an upgrade offer, selection, run-state update, and application at the next level boundary.
Prepare and run
- From your learner project's solution folder, follow tutorial chapter 13 steps 1–6.
- Open
Source\Data\RunModifiers.cs,GameSession.cs, and the app'sUpdateLevelComplete,UpdateUpgradeSelect, andSetupLevel. Run the focused command below. - Run
dotnet run --project Platforms\DesktopVKand follow the tutorial's checkpoint to clear a level, select an upgrade, and start a fresh run.
Code anchors
last-perimeter/Source/Data/RunModifiers.cslast-perimeter/Source/Data/RunUpgradeChoice.cslast-perimeter/Source/Data/GameSession.cs(ApplyUpgrade)last-perimeter/Source/Systems/PowerupSystem.cs(CreateUpgradeChoices)last-perimeter/Tests/Systems/RunModifiersTests.cs
Guided operations
- Trace level completion into draft generation. Record the seed inputs and confirm identical inputs produce the same offers.
- Trace a menu selection into
GameSession.ApplyUpgrade. Separate a modifier from an immediate resource such as an extra life. - Follow the modifier to its actual use: setup configuration, movement speed, fuse timing, respawn grace, or claim scoring.
- Compare the lifetimes: level state is rebuilt by
SetupLevel; run state survives level changes; profile state survives runs. - Start a fresh run and check that modifiers do not leak. Run the focused tests.
powershell
dotnet test --filter FullyQualifiedName~RunModifiersTestsCheckpoint
An upgrade is recorded once, affects only the intended run, and reaches live gameplay at a named point rather than by mutating multiple systems ad hoc.
Common mistakes
- Storing run modifiers in the persistent profile.
- Applying a modifier to a live system and then applying it again during level setup.
- Using an unseeded shuffle when repeatable offers are part of the design.
Questions and extension
What caps or trade-offs would keep repeated additive upgrades from breaking movement or balance? Propose a test for a cap before changing the implementation.

