Skip to content

feat(gamemode): introduce the gamemode registry and ENABLED_GAMEMODES - #815

Open
garrappachc wants to merge 1 commit into
refactor/e2e-groundworkfrom
feat/gamemode-registry
Open

garrappachc wants to merge 1 commit into
refactor/e2e-groundworkfrom
feat/gamemode-registry

Conversation

@garrappachc

@garrappachc garrappachc commented Aug 27, 2026

Copy link
Copy Markdown
Member

📚 Multi-gamemode 5.0.0 PR stack — merge bottom-up:


Stacked on #814 (base is that branch — review after it merges; will be rebased onto master). Second PR of the multi-gamemode (5.0.0) stack. Behavior-neutral foundation, no DB change.

Why

Today the instance's one gamemode is a single QUEUE_CONFIG env value resolved into a module-level singleton that ~20 sites read directly. Before any surface can serve several gamemodes, we need a first-class Gamemode type, a registry keyed by it, and a way to declare which gamemodes an instance runs — without changing behavior yet.

What

  • Gamemode enum (6v6/9v9/ultiduo/bball) + registry getQueueConfig(gamemode).
  • ENABLED_GAMEMODES env (comma-separated) → enabledGamemodes / defaultGamemode (first entry). Falls back to the legacy QUEUE_CONFIG when unset, so existing single-gamemode deployments — and the e2e CI matrix that sets QUEUE_CONFIG — upgrade with no env change. QUEUE_CONFIG is kept and marked deprecated.
  • bball config (2 soldiers/team, 2v2).
  • The single-gamemode call sites (telemetry, atlas heartbeat, queue/game views, api/v1/queue) now read defaultGamemode instead of environment.QUEUE_CONFIG, emitting identical values.

No collection is gamemode-aware yet; that's the next PR (schema partition + backfill migration).

Verification

  • pnpm test → 433 pass · tsc → no new errors · prettier + eslint clean.
  • Registry resolves all four gamemodes; reported telemetry/heartbeat values byte-identical.

Note: the earlier feat/multi-gamemode prototype also had a test gamemode; intentionally omitted here (4 modes per the agreed design).

Foundation for multi-gamemode: a closed `Gamemode` enum (6v6/9v9/ultiduo/bball),
a registry keyed by it (`getQueueConfig`), and an `ENABLED_GAMEMODES` env list
whose first entry is `defaultGamemode`. Adds the bball config (2 soldiers/team).

Behavior-neutral. `ENABLED_GAMEMODES` falls back to the legacy `QUEUE_CONFIG`
when unset, so existing single-gamemode deployments (and the e2e CI matrix that
sets QUEUE_CONFIG) upgrade with no env change. The ~7 call sites that read the
one gamemode now route through `defaultGamemode` instead of `environment.QUEUE_CONFIG`,
emitting identical values, so no surface is yet multi-gamemode.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Playwright test results

passed  245 passed
flaky  1 flaky

Details

stats  246 tests across 47 suites
duration  12 minutes, 52 seconds
commit  f1ba1dd

Flaky tests

chromium › 10-queue/12-ready-up-dialog-after-refresh.spec.ts › ready-up dialog is shown again after page refresh @6v6

return [...new Set(parsed)]
}

export const enabledGamemodes: Gamemode[] = parseEnabledGamemodes()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the reduntant type annotation

Comment thread src/environment.ts
// @deprecated — use ENABLED_GAMEMODES. Kept as the fallback default when
// ENABLED_GAMEMODES is unset so existing single-gamemode deployments upgrade
// with no env change.
QUEUE_CONFIG: z.enum(['6v6', '9v9', 'ultiduo']).default('6v6'),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add bball to this set, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant