powergrid/viewer
2026-10-01 23:56:32 +02:00
..
.vscode Initial 2021-10-13 00:09:21 -03:00
docs/tutorials Add playable Powergrid tutorials and city income reference (#155) 2026-09-16 10:10:47 -07:00
public Initial 2021-10-13 00:09:21 -03:00
scripts fix: hand floating chat reminders over to the BGS rail 2026-09-30 14:25:52 +02:00
src Show platform Supporter badges and preferred player colours 2026-10-01 23:56:32 +02:00
tests Add current-round planning and city/powering premoves (#156) 2026-09-18 10:35:54 -07:00
.browserslistrc Initial 2021-10-13 00:09:21 -03:00
.eslintrc.js 🐛 (engine) auction should follow clockwise order 2021-10-26 00:26:40 -03:00
.gitignore Initial 2021-10-13 00:09:21 -03:00
babel.config.js Initial 2021-10-13 00:09:21 -03:00
package.json Show platform Supporter badges and preferred player colours 2026-10-01 23:56:32 +02:00
pnpm-lock.yaml Show platform Supporter badges and preferred player colours 2026-10-01 23:56:32 +02:00
README.md Document complete viewer uploads 2026-09-30 00:27:36 +02:00
tsconfig.json Add playable Powergrid tutorials and city income reference (#155) 2026-09-16 10:10:47 -07:00
vue.config.js Show platform Supporter badges and preferred player colours 2026-10-01 23:56:32 +02:00

powergrid-viewer

Project setup

yarn install

Compiles and hot-reloads for development

yarn serve

Compiles and minifies for production

yarn build

Run your unit tests

yarn test:unit

Lints and fixes files

yarn lint

Customize configuration

See Configuration Reference.

Playable tutorials

Seven independent chapters cover auctions, fuel, connections, income, plant replacement, Steps 2/3 and final scoring. They use Germany with classic rules, deterministic positions and scripted opponents. Actions go through the real engine; only the learner's filtered state reaches the board.

From the repository root:

pnpm --dir engine build
pnpm --dir viewer test:tutorial
NODE_OPTIONS=--openssl-legacy-provider pnpm --dir viewer package
pnpm --dir viewer test:tutorial:browser
pnpm --dir viewer preview:tutorial

Open http://127.0.0.1:5199/?chapter=auctions. Other chapter IDs are resources, network, income, upgrades, steps and final-round.

The ordinary viewer bundle exposes both powergrid.launch and powergrid.launchTutorial. Upload the entry JS, CSS and all .umd.min.locale-*.js chunks and configure the tutorial chapters on the same BGS game version. pnpm --dir viewer tutorial:manifest prints the chapter metadata. No second bundle or engine release is required.

Lessons live in src/tutorial/lessons.ts. Keep their IDs stable and increase a chapter's version when changing its setup or accepted actions would invalidate saved progress. Test normal board clicks, refresh, rewind and completion on desktop and mobile before release.

See the desktop and mobile screenshots for examples of the tutorial UI.

Shared accessibility preference

The viewer accepts BGS's colorBlind boolean preference (default false). The eye button on the board changes it through update:preference, so BGS saves the setting across games. It also works locally in tutorials.

When enabled, houses on the map, turn-order track and city-count track carry their owner's seat number. Player panels use the same number, regardless of turn order or selected color. City rims use contrasting dash and dot patterns to distinguish map regions without extra labels. Each region keeps its pattern after region selection. Resources already use different shapes.