Files

112 lines
6.8 KiB
Markdown

# Milestone 2: content and input foundations
Implemented for manual testing. Model rigs, equipment attachments, animations, and
sound hooks remain in milestone 4.5. Playwright authoring/runs remain deferred.
## Available in Control -> Content
- **Requirement sets:** immutable named collections of up to eight integer
thresholds. Titles support existing achievement/stat metrics; equipment accepts
sets containing only level/stat thresholds. Existing title prerequisites on
equipment remain available separately.
- **Effect sets:** immutable named collections of signed flat/percentage stat
modifiers. These are the first reusable effect building blocks; timed damage,
healing, auras, and spell behavior arrive with their later systems.
- **Composition:** title/equipment drafts can select up to eight sets of each kind
and include inline values. Repeated thresholds resolve to the highest value;
modifiers add using the existing stat formula. The final result still obeys
title/item limits. Unsupported equipment metrics fail server validation.
- **Preview changes:** validates and shows the resolved definition against the
draft's catalog version. It does not publish, increment the version, create
items/awards, or write an audit event. Form edits clear the previous preview.
- **Publish changes:** repeats the same content validation under the existing
catalog lock and writes the catalog version and audit atomically. Stale editors,
missing sets, mixed payloads, unsupported values, and repeated
references are rejected. Identical publication retries return the original result.
Sets are expanded into concrete values at publication, not stored as live links on
acquired gear or earned titles. Published definitions/sets are append-only: use a new
definition for a variation; its ID is assigned by the server. Sets cannot reference other sets, so recursive composition is
not supported. Old catalogs without these collections remain valid. No new table
or title-ownership migration is required for this milestone.
Server implementations: `content/library.go`, `store/catalog_preview.go`, and the
existing catalog publication path. Shared content API models are generated from
`schemas/protocol.json` alongside the unchanged gameplay intent/snapshot shapes.
The read-only preview uses authenticated same-origin POST
`/api/control/catalog/preview` with the same draft body as publication.
## Follow-up: automatic IDs and dark mode
Content creation asks for names and properties only. The server assigns a random
permanent ID when publishing a title, item, requirement set, or effect set. Preview
does not reserve or display an ID. The audit stores the assigned identity, and an
identical request retry returns that same ID, including after restart. Public API
creation rejects client-supplied definition IDs. Existing catalog IDs/references
and trusted seed/import paths remain compatible. The hidden request UUID is only
an idempotency token, not a user-selected content identity.
The website and Control have a **Dark mode** toggle in their headers. The default
follows the device preference; choosing light/dark saves the preference for both
pages and syncs across tabs. Theme applies to forms, tables, dialogs, status badges,
stat breakdowns, and content previews. Gameplay rendering is unchanged.
## Input and menus
Keyboard and movement buttons feed named input actions rather than duplicating
gameplay dispatch. Existing bindings remain: WASD/arrows move, E gathers, Space
attacks, and I opens inventory. Controller support and rebinding UI arrive later.
Esc closes one focused menu: game inventory/settings, Control character/command
dialogs, or the content draft. With multiple panels open, only the focused/most
recent menu closes. Focus returns to its opener where available. Esc works while
editing a field and does not trigger an underlying game action.
Opening a game menu stops movement/auto-approach; typing in fields cannot move or
attack. Key release, pointer capture loss, tab hiding, and window blur clear held
movement. Closing a draft discards unsaved edits; closing while a request is in
flight does not cancel that submitted request. Publication results still appear
in the catalog/audit. Arrival/death/disconnect screens retain their existing flows.
## Manual test checklist
Use recognizable test names; the server creates IDs. Published test content cannot
currently be deleted.
1. In **Control -> Content -> Requirement sets**, name a set `M2 Level` with level >= 1.
Fill a reason, preview, and confirm the catalog version/audit has not changed.
Publish; refresh and confirm the new set and one audit/version increment.
2. Create effect set `M2 Defence` with defence +2 flat and movement speed -5%.
Preview/publish it. Create a ring with those two sets, drop chance 0, and any
inline modifiers you want to inspect. Preview shows the expanded requirements
and effects. Publish and confirm the equipment list contains the same values.
3. Use **Control -> Characters -> Manage items and titles** to give the ring to a
living character. Equip/unequip it in game and inspect the final stat breakdown.
Confirm existing inventory, titles, health, and daily usage were not reset.
4. Confirm there is no permanent-ID input and publication shows an assigned ID in
the catalog/audit. For stale editing, open drafts in two Control tabs, publish one, then preview/
publish the other: expect a refresh conflict, not silent overwriting.
5. Open inventory and settings together. Focus a settings field and press Esc:
settings closes, inventory stays open. Press Esc again: inventory closes.
Repeat in a Control draft and a character/command dialog; only that menu closes.
6. Move with WASD/arrows and the on-screen controls, gather with E, attack with
Space. Opening a menu or switching tabs stops movement. Typing in fields must
not move/attack; returning focus must not leave a movement key stuck.
7. Toggle dark mode on the public site, open Control, and reload. Confirm the choice
persists and that dialogs, fields, stat rows, and badges remain readable. Switch
back to light mode and check that both pages follow the new preference.
## Verification and limits
Required verification: TypeScript check, production build, generated-contract
freshness, and Go tests. Added server tests cover preview non-mutation, composed
publication parity, reference validation, retry identity, immutable IDs, restart
persistence, and anonymous/player/cross-origin/strict-JSON boundaries. Existing
lifecycle tests remain in the full Go suite. PostgreSQL-specific tests require
`TEST_DATABASE_URL`; no new capacity/load claim is made.
Manual browser testing is the user's handoff; automated Playwright was not run.
This milestone does not activate resurrection, hub travel, character-title
migration, new resource/mob definitions, or model/animation/audio systems.
Pause after commit/push for feedback before milestone 3.