A12: Tutorial

A short, skippable tutorial on an island of your own: leave the barge, glide
down, walk and jump, cut materials with the boathook, place a wall, aim and
fire, and get above the line the tide will reach after its next rise.

- MatchRules.tutorial(): one player, no bots, last_team_wins off (alone is
  not a win, only the tide or a fall ends it) and starting_kit (a dock
  carbine with a full magazine and 60 cartridges, Tuning.TUTORIAL_KIT).
  Both rules go in command logs; older logs read with the defaults.
- Tutorial watches the client's own view (predicted player, world copy,
  FX) and moves on when each step is done. Instructions name the player's
  own key bindings. TutorialCard shows it under the minimap.
- TutorialPilot plays it through ClientInput for --tutorial --autoplay,
  the tests and make tutorial-check (12 seeds, all finish).
- First launch offers it (welcome screen, remembered in settings); it is
  always on the main menu; Leave in the pause menu skips it. Finishing is
  saved. --tutorial on the command line.
- make tutorial-captures; PLAY.md, the man page, ARCHITECTURE.md and
  CLAUDE.md updated.

Closes #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 05:47:31 -05:00
co-authored by Claude Opus 5.5
parent 4ea170175d
commit b604ced923
32 changed files with 1110 additions and 23 deletions
+12 -4
View File
@@ -32,6 +32,14 @@ func _press(screen: String, text: String) -> void:
(buttons[text] as Button).pressed.emit()
## Settings of a player who has already been offered the tutorial (A12), so the
## program opens on the main menu.
func _offered() -> GameSettings:
var settings: GameSettings = GameSettings.new()
settings.tutorial_offered = true
return settings
func _key(keycode: Key) -> InputEventKey:
var key: InputEventKey = InputEventKey.new()
key.physical_keycode = keycode
@@ -79,7 +87,7 @@ func test_focus_moves_through_the_main_menu_with_the_arrow_keys() -> void:
await tree.process_frame
var seen: Array[String] = []
var focused: Control = menus.get_viewport().gui_get_focus_owner()
for _step: int in 4:
for _step: int in 5:
assert_not_null(focused)
if focused == null:
return
@@ -89,7 +97,7 @@ func test_focus_moves_through_the_main_menu_with_the_arrow_keys() -> void:
break
next.grab_focus()
focused = next
assert_eq(seen, ["Practice against bots", "Join a server", "Settings", "Quit"] as Array[String])
assert_eq(seen, ["Practice against bots", "Tutorial", "Join a server", "Settings", "Quit"] as Array[String])
func test_rebinding_in_the_menu_detects_conflicts() -> void:
@@ -185,7 +193,7 @@ func test_results_say_where_you_placed() -> void:
func test_the_shell_goes_from_the_menu_to_a_match_and_back() -> void:
menus.free()
var shell: AppShell = AppShell.new(GameSettings.new(), PATH)
var shell: AppShell = AppShell.new(_offered(), PATH)
shell.grab_mouse = false
tree.root.add_child(shell)
assert_eq(shell.menus.current, "main")
@@ -220,7 +228,7 @@ func test_the_shell_goes_from_the_menu_to_a_match_and_back() -> void:
func test_the_shell_shows_results_when_a_match_you_played_ends() -> void:
menus.free()
var shell: AppShell = AppShell.new(GameSettings.new(), PATH)
var shell: AppShell = AppShell.new(_offered(), PATH)
shell.grab_mouse = false
tree.root.add_child(shell)
var rules: MatchRules = MatchRules.new()