Appearance
Lesson 04 — Build the playable wall path
Where this lesson fits: the player can move, but movement still needs a single source of truth for where walking is allowed. The path is derived from unclaimed tiles and rebuilt after a claim.
Time: 4–6 hours
Prerequisites and outcomes
Complete lessons 02–03. By the end, you can build the initial path, test containment, snap a position to it, and explain when a rebuild is required.
Prepare and run
- From your learner project's solution folder, follow tutorial chapter 04 steps 1–5.
- Open
Tests\Systems\WallSystemV2Tests.cs; findRebuildPlayablePath_AfterClaim_MatchesRemainingPlayableRegion. Its fixture claims six tiles and assertspath.Contains(new Vector2(12, 4))is true whilepath.Contains(new Vector2(2, 2))is false. - Run the focused commands below, then follow the tutorial's checkpoint. Capture gameplay arrives in the later capture chapter; here the test applies a prepared claim.
Code anchors
last-perimeter/Source/Entities/PlayableWallPath.cslast-perimeter/Source/Systems/WallSystemV2.cslast-perimeter/Source/Systems/MovementSystem.cslast-perimeter/Tests/Systems/WallSystemV2Tests.cslast-perimeter/Tests/Systems/PlayableWallPathTests.cs
Guided operations
- Build the first path from a fresh
ArenaSystem; inspect its segments and nodes. - Follow
ContainsandSnap. Mark where tolerance is applied and what snapping guarantees. - Use a test arena with claimed tiles. Rebuild and compare the resulting path with the unclaimed region's edge.
- Move the player toward a point on and off the path. Verify that accepted movement uses the path model rather than reinterpreting tile flags.
- Trace the claim handoff in lesson 08: the path must be rebuilt from the committed arena, not before.
Run the focused suites:
powershell
dotnet test --filter FullyQualifiedName~PlayableWallPathTests
dotnet test --filter FullyQualifiedName~WallSystemV2Tests
dotnet test --filter FullyQualifiedName~MovementSystemTestsCheckpoint
The initial path is closed, snapping returns a point on a segment, and a path rebuilt after a claim follows the remaining playable edge.
Common mistakes
- Letting the player walk on claimed interior because it was once adjacent to the arena wall.
- Rebuilding the path from an uncommitted solver result.
- Increasing movement speed without checking whether the path tolerance still permits corners.
Questions and extension
Which invariants should remain true if the arena is irregular? Add a path test for a small non-rectangular fixture.

