Skip to content

Add playable Powergrid tutorials and city income reference - #155

Merged
goldjohn6 merged 3 commits into
masterfrom
feat/playable-tutorials
Sep 16, 2026
Merged

goldjohn6 merged 3 commits into
masterfrom
feat/playable-tutorials

Conversation

@coyotte508

Copy link
Copy Markdown
Member

Powergrid now has seven playable tutorials using the ordinary viewer and real engine: auctions, resources, connecting cities, income, replacing plants, Steps 2/3, and final scoring. Learners use the normal board controls, with scripted opponents, short questions, saved progress, rewind/replay and next-chapter navigation.

The city track also shows total income for each number of powered cities, with a compact portrait layout. House tooltips identify their owner. The unread-chat shortcut moves above overlapping game buttons when the layout changes.

Implementation

  • Expose powergrid.launchTutorial alongside powergrid.launch in the same JS/CSS bundle, using @boardgamers/protocol 0.3.3.
  • Keep tutorial actions deterministic and engine-validated; render only the learner's filtered state. Highlight the city requested by a lesson.
  • Add local preview and chapter-manifest commands, documentation, and tutorial tests to CI.
  • Viewer-only change: no engine changes or release. Chapter metadata still needs to be configured on the BGS game version when this is published.

Screenshots

Desktop: connecting cities

Desktop tutorial with the real board and highlighted destination

Income reference

Houses mark cities built; the lower row gives total income for the number actually powered.

City track and income row

Mobile: collecting income Mobile tutorial showing three cities built but only two powered

Validation

  • Eight tutorial tests: legal walkthroughs, saved-state replay, rewind/restart, rejected actions, resource conservation and hidden information.
  • All seven chapters completed through the browser at 1280px and 390px, including refresh and navigation.
  • 27 existing viewer unit tests and normal viewer/chat browser checks at 390px and 1400px.
  • Viewer production build, TypeScript check, repository-wide Prettier check and git diff --check pass.
  • No new ESLint errors; the 14 existing template-indentation/quote errors in Game.vue and Map.vue are unchanged.

@coyotte508
coyotte508 marked this pull request as ready for review September 16, 2026 13:21
goldjohn6 and others added 2 commits September 16, 2026 10:00
The income row shortened the city-count cells, and the house markers were
packed to fit: 6px between columns against a 12px-wide house, and 3px
between rows. Two players on the same number — the ordinary case for most
of a game — overlapped by half and read as a single smudge; five or six at
the start of a game read as one blob.

Lay them out bottom-aligned in the cell instead, growing upward from the
income strip so the number above stays legible, a house-width between
columns and a house-height between rows. Five or six sharing go three wide
rather than three tall: a third row starts at the top of the cell and hides
the number completely, which is every game's opening position.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The status bar is sticky at z-index 10 and every modal sat at z-index 1, so
the bar painted over the top of any open dialog. Modals open 10vh down and
the bar is a fixed 40px, so on a short viewport — a phone held sideways —
the bar landed across the dialog's own header and covered the close button,
leaving no way out of the dialog at all. Put the modal above it; the bar is
then dimmed behind the overlay like the rest of the page.

The payment table counted to citiesToEndGame, which stopped one column short
of the number that ends the game, and a player can finish holding more cities
than that by building in the same phase as whoever triggered the end. Render
the whole table instead, so it agrees with the city track on the board.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@goldjohn6

Copy link
Copy Markdown
Collaborator

Pushed three small changes on top — happy to drop any of them.

Houses on the city track. The income row shortens the cells, and at the old 6px column / 3px row offsets two players on the same number overlapped by half; five or six at the start of a game read as one blob. They're now bottom-aligned in the cell, growing upward from the income strip so the number above stays legible, a house-width apart — and five or six sharing go three wide rather than three tall, since a third row starts at the top of the cell and hides the number completely.

Two pre-existing ones that the new track made visible:

  • .modal was z-index: 1 under the sticky .statusBar at 10. Modals open at 10vh and the bar is a fixed 40px, so below roughly 400px of viewport height — a phone held sideways — the bar landed across the dialog's own header and covered the close button, leaving no way out of the dialog. Modals now sit above it and the bar dims behind the overlay.
  • The payment table counted to citiesToEndGame, which stops one column short of the number that ends the game — and a player can finish holding more than that, having built in the same phase as whoever triggered it. It now renders the whole table, so it agrees with the new track.

Checked against master with #154 merged: it auto-merges cleanly, sendMove keeps both sides, and the engine, tutorial and viewer unit suites all pass on the merged tree.

For what it's worth on the UI question — I like it. The income row is genuinely useful, and the two-row portrait track is a big improvement on what that track became at phone width.

@goldjohn6
goldjohn6 merged commit 5f2406e into master Sep 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants