Appearance
Lesson 14 — Orchestrate screens and save player choices
Where this lesson fits: the in-level loop is complete. Add the front end and persistence while keeping screen transitions explicit and disk work out of active gameplay frames.
Time: 3–4 hours
Prerequisites and outcomes
Complete lesson 13. By the end, you can trace a menu input to a state transition, explain pause/update behavior, and follow settings from disk to a new run.
Prepare and run
- From your learner project's solution folder, follow tutorial chapter 12 steps 1–7.
- Open
Source\Game\LastPerimeterApp.cs,Source\Systems\ProfileStorage.cs, andProfileTracker.cs. Run the focused commands below. - Run
dotnet run --project Platforms\DesktopVKand follow steps 2–7 and 9 of the tutorial's checkpoint. Settings are saved to the game's local profile; note any pre-existing settings before changing them and restore them afterwards if desired. Do not follow checkpoint step 8 on a profile you want to keep: it deliberately corrupts and deletes the profile. Test that scenario only with a safely backed-up or disposable profile.
Code anchors
last-perimeter/Source/Data/Enums.cs(GameStatus)last-perimeter/Source/Game/LastPerimeterApp.cs(update/draw switches and menu handlers)last-perimeter/Source/Systems/ProfileStorage.cslast-perimeter/Source/Systems/ProfileTracker.cslast-perimeter/Source/Data/PlayerProfile.cs,GameSettings.cslast-perimeter/Tests/Systems/ProfileStorageTests.cs,ProfileTrackerTests.cs
Guided operations
- Trace the current status through
UpdateandDraw; identify which states update gameplay and which only update a menu. - Follow confirm, cancel, and pause edges. Test the same-frame pause transition to ensure it does not immediately resume.
- Open options from more than one screen and follow the return-status field.
- Trace profile load during initialization and save when leaving active play or exiting. Inspect the injectable storage path in tests.
- Change one option, save, restart, and verify it is loaded. Confirm an active gameplay frame does not perform a profile write.
powershell
dotnet test --filter FullyQualifiedName~ProfileStorageTests
dotnet test --filter FullyQualifiedName~ProfileTrackerTestsCheckpoint
Pause stops gameplay updates, options return to the correct caller, and changed settings persist across application restarts.
Common mistakes
- Treating pause as a visual overlay while gameplay timers continue advancing.
- Reusing one input edge in both the gameplay state and the newly-entered menu.
- Swallowing all profile errors without making the failure diagnosable.
Questions and extension
Which settings should apply immediately, and which should be read only at run or level setup? Trace each setting to its consumer.

