Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PoMiniGames

Fourteen instant-play mini-games on one website. A .NET 10 minimal API host serves its own Blazor WebAssembly client from one origin, runs online play over SignalR and keeps scores in Azure Table Storage. There is no sign-in (a player is a random browser id plus three initials) and no AI service: CPU opponents run in the browser, and the two quizzes draw from JSON banks.

  • Live: https://app-5ln5hfdrvof5u-f1win2.azurewebsites.net (System status: /diag)
  • Run locally: Quick start.
  • Deploys: every push to master runs .github/workflows/deploy.yml (format, build, Unit + Integration tests, publish, deploy, then waits for /health/live to report this commit).
  • Rules for changing it: AGENTS.md (the Po web standard plus this repo's notes).

How it fits together

  • Each game is a Razor page plus a JavaScript engine (wwwroot/js/<game>/), loaded on demand and driven over JS interop. Engines share platform/stage/ and the platform/2d|3d/ helpers.
  • Online play uses one shared lobby per game and an in-game hub, 18 SignalR hubs in all, each at /hubs/{game}/{role} (PoMiniGames.Shared/HubPaths.cs). Match state lives in server memory.
  • Scores go through GameResultService on the client; the server checks them (Features/Integrity) and stores them in Table Storage. A failed submit is parked and retried.
  • Pages: the main menu (game cards, Continue, Scores, Watch all demos), Scores (two tabs: Leaderboards and My stats, with "Your data" export/erase at the bottom of My stats) and /diag. On a phone the bottom bar is Games / Scores.

The long version is docs/overview.md.

Shared game UI

  • PageHeader is the one page header: title, an optional meta line and an action slot, used by the hub and the two Scores tabs (Leaderboards, My Stats) (/diag uses the standard System status layout). New top-level pages use it rather than their own head markup.
  • The main menu (Features/Home/Index.razor) displays every game card in one scrolling grid (two cards per row on wide windows, stacked on narrower viewports), with one chip per supported mode.
  • GameShell owns the title, diagnostics and result dialog. Keep game artwork and HUDs game-specific, but do not override the shared dialogs' theme, typography or geometry.
  • GameIntro owns modal focus containment, readiness, controls, setup and the one OK action. A game with several maps passes Maps (IntroMap id + name) and binds MapId: in 1P and 2P the footer shows a map dropdown beside OK (Racer tracks, Marble Race courses, Sand Playground worlds). A map is always that dropdown, never cards or buttons. Essential choices stay visible; longer explanations and customization belong in disclosures. On a portrait phone a game's setup is a third Setup tab beside Controls and How to play, so the card fits a 375×667 phone without scrolling; wider cards show setup beside the controls. Escape cancels the intro rather than silently starting play. Choose 1P, 2P, Online or Demo on the main menu; intro modals do not repeat mode selection.
  • During gameplay, Tab toggles stats, and Esc closes them. Shift+Tab, forms and dialogs retain normal focus navigation. The visible Stats control supports touch. The panel's pop out button opens po-dev.html, a separate developer window (also reachable from the Live debug window button on /diag) fed live over a BroadcastChannel (frame rate graph, viewport, heap, long tasks, recent errors, the game's own rows); nothing is measured until the panel or window is opened. Tab is not claimed on non-game pages, where it stays the keyboard's focus mover (WCAG 2.1.1). Ecosystem retains its observation dashboard and does not open a second generic panel. Marble's physics/render metrics join the shared stats panel instead of using a separate F3 overlay.
  • Results keep headline facts compact, with full standings/telemetry behind details. The end card has exactly one action, Back to main menu (GameOverModal takes no extra buttons); another race or match starts from the start card. Demos and multi-race runs retain their existing progression.
  • Pause dialogs share focus handling and presentation; online menus explicitly say when the match keeps running. There is no settings page (removed in 080be6b6).
  • LinkAuditUiTests covers reachable routes, start cards at 375×667 and 1280×720, the end card at 375×667, and a 44px touch-target floor on every route.

Documentation

Document What it covers
docs/overview.md How the site works as a whole: hosting, online play, scores, the hub and the shared shell
docs/games.md Every game: modes, maps, controls and its engine
docs/notes.md Identity, deployment, the F1 budget and other operating notes
docs/changelog.md Dated log of configuration keys, routes and storage changes
scripts/README.md Every script: verification, deploy hooks and the offline asset tools
Architecture map Component diagrams, request flows and the data model (private link)

Quick start

# prerequisites: .NET SDK 10.0.400 or a later feature band (global.json), Docker
docker compose up -d azurite                                  # local table storage
dotnet run --project src/PoMiniGames.Api/PoMiniGames.Api.csproj
# → http://localhost:5080  (API + client, one origin)

pwsh scripts/verify.ps1                                       # format, build, Unit, Integration, CSS + JS lint
pwsh scripts/verify.ps1 -Full                                 # adds Bicep, trim audit, E2E API and E2E UI

Layout

src/
├── PoMiniGames.Api/            Host + vertical feature slices (Features/<Slice>); storage in Infrastructure/Persistence
├── PoMiniGames.Client/         Blazor WASM client (Features/<Game>, wwwroot/js/<game>/ engines)
└── PoMiniGames.Shared/         DTOs, domain rules (GameKey, ScoreRules, Elo), hub paths, shared game logic
tests/
├── PoMiniGames.Unit/           482 tests (hermetic; CI)
├── PoMiniGames.Integration/    14 tests (Testcontainers Azurite; CI; skip without Docker)
├── PoMiniGames.E2EAPI/         HTTP contract tests, in-process host (local only)
└── PoMiniGames.E2EUI/          Playwright tests (local only; skip without Docker or Chromium)
infra/                          main.bicep + main.bicepparam + modules/ (az deployment, run locally)
scripts/                        Working scripts only (scripts/README.md)
docs/                           Everything else that is prose

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages