Skip to content

Make "turns" first class citizens.#57

Merged
simlmx merged 7 commits intomainfrom
builtin-use-turns
Dec 31, 2025
Merged

Make "turns" first class citizens.#57
simlmx merged 7 commits intomainfrom
builtin-use-turns

Conversation

@simlmx
Copy link
Contributor

@simlmx simlmx commented Aug 24, 2025

Overview

"Turns" effectively become first class citizens.
We add builtin utils and a nicer DevX to begin/end player turns and deal with turn expiration.

Usage

In the game definition:

turns.begin(userId, {
  expiresIn: 10000
  boardMoveOnExpire: ["someboardMove"],
});

In the UI:

const { itsTheirTurn, beganAt, expiresAt } = useUserTurn(userId);

Changes

  • We put the turn info (begin and expiration time) in meta
  • Refactor the Random object with a cleaner API
  • Remove game1-v2.3.0 (effectively breaking support to 2.3.0)
  • Add new 3.0.0 test game (FIXME change the number from 2.7.0 to 3.0.0)
  • Fix typing for playerboard: it's either an object (of type defined by the game) or null (when there is none or for spectators)
  • Refactor dev-server
  • Show turn expiration in dev-server

@simlmx simlmx changed the title [WIP] [BACKUP] Add build-in useUserTurn Add build-in useUserTurn Dec 24, 2025
@simlmx simlmx changed the title Add build-in useUserTurn Make "turns" first class citizens. Dec 24, 2025
* We put the turn info (begin and expiration time) in meta
* Refactor the Random object with a cleaner API
* Remove game1-v2.3.0 (effectively breaking support to 2.3.0)
* Add new test game (2.7.0, even though that version number probably
  won't exist).
* Fix typing for playerboard: it's either an object (of type defined by the game) or null (when there is none or for spectators)
* Many refactors
@simlmx simlmx merged commit 5e347e8 into main Dec 31, 2025
1 check passed
@simlmx simlmx deleted the builtin-use-turns branch December 31, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant