GameClockScheduler checks every live game once a second and ends those whose running clock has reached zero, whether or not anyone is connected. The clock replaces the offline turn timeout and the inactivity rule, so both are removed with the offline times they used.
1.8 KiB
1.8 KiB
Game clock: tasks
Work through the tasks in order; each ends with its tests passing and a commit. Tick a task when it is committed.
- 1. Core types and helpers:
GameClock,CLOCK_LOW_TIME_MS, the new optional fields onGame,GameEndMessage,MoveRecordandFinishedGameSummary;getClockTimes,ClockSync,getClockAtMove,formatClockwith unit tests; English timeout texts. - 2. Clock in the game lifecycle:
GameClock.ts,GAME_CLOCK_MS,clockandmoveRemainingMsonBackendGame, start, charging moves, refusing late moves, stopping the clock on every ending,clockandserverTimein client messages; unit tests. - 3. Scheduled service:
endGamesOutOfTime,GameClockSchedulerwired inindex.ts; removecheckTimeouts, the 10-second timer and the backend'sofflineSince; unit tests. - 4. Restore and saving: snapshot version 2 and restore of versions 1 and 2,
remainingMsandclockInitialMsin game records, migration002_clockand the repository; unit and integration tests. - 5. Web app, live game:
useGameClock,GameClockView, clocks inGamePageon desktop and mobile layouts; remove the offline countdown, and with itTURN_TIMEOUT_MS,INACTIVE_TIMEOUT_MS,UserConnectionInfo.offlineSinceandOpponentOfflineCountdownfrom core (the web app uses them until then). - 6. Web app, replay: clocks in
ReplayViewfromgetClockAtMove. - 7. Mobile app: clocks in
GameScreen; type check and bundle. - 8. End to end and docs: Chrome tests from
design.md; README,AGENTS.mdandTODO.md(release the mobile update before or with the backend; the out of scope items); markgame-historyR3.3 and R3.4 as replaced.