Skip to content

Lesson 00 — The game as state transitions ​

Where this lesson fits: before opening the solution. The goal is to make the nouns and state transitions visible before MonoGame APIs enter the picture.

Time: 45–60 minutes

Prerequisites ​

None. This is a paper exercise. Read getting started before lesson 01; you do not need a project yet.

Learning objectives ​

By the end, you can explain the capture loop, name the system that owns each kind of space, and distinguish per-level, per-run, and profile state.

The model ​

Last Perimeter has three spatial truths:

What the player seesWhat owns it
Traversable safe edgePlayableWallPath, derived from arena tiles
Temporary exposed lineactive Trail
Permanent territoryauthoritative tile state in ArenaSystem

A trail is not yet a claim. It is an input to a solver. A solver result is not yet live state. It must be applied to the arena before the path is rebuilt.

Guided activity ​

  1. Draw an arena rectangle and mark one claimed block, one unclaimed region, and a trail that divides it.
  2. Label which shapes are authoritative data and which are derived from that data.
  3. Add an enemy to one region. The solver chooses the smallest enemy-free region; if all regions contain enemies, it chooses the smallest region and identifies its enemies for removal. Predict the chosen region.
  4. On a second sketch, show a failed trail that partitions nothing. Write down what must remain unchanged.
  5. Add three lifetimes to the side of the sketch: level state, run state, and profile state.

Checkpoint ​

Explain why the project keeps ArenaSystem, PlayableWallPath, and Trail separate. A good answer says which owns truth, which is derived, and which is temporary.

Common confusion ​

Do not call every line a wall. The trail is temporary; the wall path is rebuilt from committed arena state.

Questions and extension ​

  • Which state should reset after a level, after a run, and after the application closes?
  • Extend the sketch to show where scoring, enemy removal, and renderer invalidation occur after a successful claim.