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
+7
View File
@@ -75,6 +75,9 @@ var practice_difficulty: int = -1:
var practice_team_size: int = 1:
set(value):
practice_team_size = clampi(value, 1, Tuning.DUO_TEAM_SIZE)
## The tutorial (A12): offered on the first launch until answered, and finished once.
var tutorial_offered: bool = false
var tutorial_done: bool = false
func shadow_distance() -> float:
@@ -123,6 +126,8 @@ func save(path: String = DEFAULT_PATH) -> Error:
config.set_value("practice", "bots", practice_bots)
config.set_value("practice", "difficulty", practice_difficulty)
config.set_value("practice", "team_size", practice_team_size)
config.set_value("tutorial", "offered", tutorial_offered)
config.set_value("tutorial", "done", tutorial_done)
return config.save(path)
@@ -150,6 +155,8 @@ static func load_from(path: String = DEFAULT_PATH) -> GameSettings:
settings.practice_bots = _int(config, "practice", "bots", settings.practice_bots)
settings.practice_difficulty = _int(config, "practice", "difficulty", settings.practice_difficulty)
settings.practice_team_size = _int(config, "practice", "team_size", settings.practice_team_size)
settings.tutorial_offered = _bool(config, "tutorial", "offered", settings.tutorial_offered)
settings.tutorial_done = _bool(config, "tutorial", "done", settings.tutorial_done)
return settings
+62
View File
@@ -0,0 +1,62 @@
## The tutorial's card on the HUD (A12): a paper card under the minimap with the step
## counter, the step's title, what to do (naming the player's own keys) and how far
## along it is. Hidden until the player is in the match. Drawn like the HUD's other
## cards (Hud.draw_card); everything is words, so nothing relies on colour.
class_name TutorialCard
extends Control
const WIDTH: float = 340.0
const PADDING: float = 14.0
var _counter: Label
var _title: Label
var _body: Label
var _progress: Label
var _column: VBoxContainer
func _init() -> void:
name = "TutorialCard"
mouse_filter = Control.MOUSE_FILTER_IGNORE
_column = VBoxContainer.new()
_column.position = Vector2(PADDING, PADDING * 0.7)
_column.add_theme_constant_override("separation", 4)
_column.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(_column)
_counter = _ink(Hud.FONT_SMALL, Palette.SEA_INK)
_title = _ink(Hud.FONT_TITLE, Palette.INK)
_body = _ink(Hud.FONT_BODY, Palette.INK)
_body.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_body.custom_minimum_size = Vector2(WIDTH - PADDING * 2.0, 0.0)
_progress = _ink(Hud.FONT_SMALL, Palette.OCHRE_RED)
for label: Label in [_counter, _title, _body, _progress]:
_column.add_child(label)
visible = false
## Shows `tutorial`'s step, or hides the card while the player isn't in the match.
func show_tutorial(tutorial: Tutorial, playing: bool) -> void:
visible = tutorial != null and playing
if not visible:
return
_counter.text = tutorial.counter().to_upper()
_title.text = Tutorial.TITLES[tutorial.step]
_body.text = tutorial.instruction()
_progress.text = tutorial.progress()
_progress.visible = not _progress.text.is_empty()
var height: float = _column.get_combined_minimum_size().y + PADDING * 1.4
if not size.is_equal_approx(Vector2(WIDTH, height)):
size = Vector2(WIDTH, height)
queue_redraw()
func _draw() -> void:
Hud.draw_card(self, Rect2(Vector2.ZERO, size))
func _ink(font_size: int, colour: Color) -> Label:
var label: Label = Label.new()
label.add_theme_font_size_override("font_size", font_size)
label.add_theme_color_override("font_color", colour)
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
return label
+1
View File
@@ -0,0 +1 @@
uid://dimljb3jidhs8