Status: Shipped Entry points: src/features/setup/ChooserPage.tsx, src/features/setup/NewGamePage.tsx, src/features/game/gameSlice.ts
Configure and start a new game — 2 to 8 players, each with a name and a switch saying whether the machine plays them, plus an optional game name and a theme. A player's colour is assigned by the engine, not chosen. The same screen lists previously saved games so any of them can be resumed or deleted.
A seat can be a bot, which is what makes this a game one person can play: the engine's minimum is two players, so before it there had to be somebody else in the room or on another device. See bots.md.
This is #/new now, not /. The front door is a chooser
(navigation.md): it asks how you want to play and sends you here, to #/host, or
to #/join. What used to be one screen carried the masthead, a ruleset table, this whole form, an
appearance picker, the saved-games list and a "Play online" button sharing a .button-row with
"Create game".
NewGamePage form state (local useState)
└─ submit → validate (non-empty, unique names, at least one human)
└─ dispatch(createNewGame(CreateGameInput)) gameSlice thunk
├─ createGameState(input, DefaultRandomSource) domain/rules/gameEngine
├─ saveGame(nextGame) features/persistence
└─ setActiveGame + bootstrapRecentGames
└─ navigate(`/game/${nextGame.id}`)
On mount, bootstrapRecentGames() reads the saved-game index and fills the "Recent games" list.
Each entry is a StoredGameIndexEntry — a denormalised summary, so listing saves never parses
full game states.
Turn order is not the form order: createGameState simulates an opening roll per player
(chooseFirstPlayerOrder) and sorts by score.
-
Form state is local, not Redux. It is ephemeral and belongs to one screen; putting it in the store would add persistence questions for nothing.
-
Handing a seat to the machine renames it — but only while the name is still one this form wrote. "Player 2" and "Bot 2" are placeholders; anything else was typed by a person, and overwriting that is the kind of helpfulness that loses work. The rename matters because a name is what the history, the toasts and the player card all speak, so a bot called "Player 2" is indistinguishable from the human beside it in every sentence the game says.
-
A table of nothing but bots is refused (
SETUP_ERRORS.noHumans), and the rule is checked LAST, after the blank and duplicate names: a table with nobody at it is a stranger problem than an empty field, and the first thing wrong with a form should be the first thing said about it. -
The bot switch is a
<label>around the box, not a box with a label beside it.$control-checkboxstays 20px on purpose and the label is what carries the 44px tap floor — the same arrangement.checkbox-fieldalready had, and whatmobile.spec.tsmeasures. It uses theis-inlinevariant, because up to eight of them stack in one column and the slab treatment written for the single Speed Die switch reads as eight competing panels at that count. -
Validation happens before the thunk, so the engine only ever sees valid input and does not need to defend against duplicate names. It no longer has to defend against duplicate colours at all — it assigns them.
-
The game id is generated by the engine (
crypto.randomUUID()), not the form, so the URL is stable and shareable immediately after creation. -
data-themeis set from the form's current selection, so the theme preview is live before the game exists. It goes throughAppShell, which owns the shell and the header for every page. -
The appearance picker left the form. It was a
<select>between the identity fields and the Speed Die toggle, which implied it was saved with the game — it is a per-device preference, and it lives in the header's settings menu. -
The masthead is gone entirely — the edition name in the display serif, the lede, the "at a glance" ruleset card and the link to the booklet. The header carries the nav and the chooser carries the framing, so on this screen they were a banner between the player and the form.
-
Nobody picks a piece any more, and the whole class of bug went with it. Each player row carried a
Tokenselect of eight pieces, and the piece was never drawn:BoardTokenLayerrenders a self-closing span with abackgroundColor, so an elephant and a top hat were the same circle in two colours. All four editions listed the same eight colours in the same order, so the catalog was a seat-index palette wearing four sets of names.It is one shared list now (playerColors.constants.ts), assigned by
createPlayersin creation order — which makes two players sharing a colour unrepresentable rather than refused, soSETUP_ERRORS.duplicateTokenis deleted rather than rewritten. The row shows the colour it will get, as a promise rather than a control.What this retired:
defaultTokensread India's catalog whatever edition was selected and keyed its effect on the player count alone, so picking another edition left ids likeelephantthat exist in no other catalog — the finder returnedundefinedand every player rendered as a colourless, emoji-less disc, on a board where colour is the only thing telling them apart. A shared palette cannot disagree with an edition, so neither the bug nor the fix for it exists. -
The
Playerscount field stays. It is the one thing a hot-seat game genuinely has to be told, and tests/e2e/helpers.ts drivesstartGame({ players })for nearly the whole e2e suite through it. -
A saved game says whether it is Local or Online, from
tableModeon the index entry, and an online save is Rejoined rather than continued. One whose join code this device never had is refused with the reason on screen rather than opened with every control dead — seeresumeBlockedReason. -
The screen is addressed to a player, not to whoever built the app. It opened with a project description ("a typed, resumable rebuild ... with the rules engine separated from the UI") beside a Locked v1 scope table listing
Persistence: LocalStorage. That table had also gone stale: its Speed Die row still read "planned later" while the Speed Die's own toggle sat a few centimetres below it. Both are gone. Two tests keep them gone — the rendered copy may not contain "LocalStorage", "rules engine" or "planned later". -
The masthead is built as a title deed, because that is an object the game already has and the player already recognises: a colour band across the top, a mono label, a serif name. It is the tie to the board, which is card stock and a display serif — the screen shared nothing with it before. No new theme tokens were needed; the band takes
--accentand the cards take the surfaces every panel already uses. -
The title is the theme's own name, not copy in the component, so the masthead follows whichever ruleset is selected in the form below it.
-
The ruleset card quotes the constants — players, starting cash, GO salary, jail fine — so the screen cannot drift from the game it is about to start. It is a table of rows rather than a sentence, which is why the e2e assertion is scoped to the card and checks the label and the amount separately.
-
The form takes the wider column. It had the narrower of the two, with the room given to a recent-games list that is empty on a first visit.
-
The player count is a narrow field. It sat on a row of its own beside the ruleset summary, stretched to half the form's width — a single-digit input the size of a name field. Name, count and ruleset share one row now, and the summary moved to the masthead.
- Local:
gameName,playerCount,themeId,playerNames[],playerTokens[],formError. - Store: reads
game.recentGames,game.loadError; writes viacreateNewGame,removeSavedGame. - Storage: writes
monopoly.game.<id>.v1and the indexmonopoly.games.index.v1.
| Level | File | Covers |
|---|---|---|
| Unit | setupValidation.utils.test.ts | Every validation rule and the order they are reported in, bots included. |
| Integration | NewGamePage.test.tsx | Renders setup + recent games; rejects duplicate names; the masthead titles itself from the ruleset and quotes the constants. |
| Unit | resume.utils.test.ts, tableModeLabel.guard.test.ts | An online save needs its code on this device; every table mode has a label. |
| E2E | tests/e2e/bots.spec.ts | A solo game started with a bot in seat two, and a table of nothing but bots refused. |
| E2E | tests/e2e/setup.spec.ts | Create game → navigates to /game/:id; the masthead is set in the display serif, the form takes the wider column, and the copy carries no build detail. |
- Nothing outstanding. Duplicate names, duplicate tokens and empty names are each covered in
setupValidation.utils.test.ts; the player-count clamp says what it did; and deleting a saved game asks first.