Skip to content

feat: accelerated turn timeout for offline players#133

Merged
rustwizard merged 1 commit into
masterfrom
feat/presence-accelerated-timeout
Jun 16, 2026
Merged

feat: accelerated turn timeout for offline players#133
rustwizard merged 1 commit into
masterfrom
feat/presence-accelerated-timeout

Conversation

@rustwizard

Copy link
Copy Markdown
Owner

When the current human player is offline, startTurn shortens the turn to a grace window (game.OfflineGraceDuration, 10s) instead of the full 60s, so an abandoned game advances and cleans up quickly (kick after ~30s vs ~180s).

  • presence is now keyed by player_id (string) instead of uid; ping refreshes by claims.PlayerID — the identity the game FSM uses.
  • game gains an OnlineChecker interface + WithOnlineChecker option; startTurn only ever reduces a human player's turn, never bots or custom durations.
  • cmd wires a presenceChecker adapter (*presence.Service + ctx timeout).
  • tests: offline player times out within grace; online keeps the full turn.

When the current human player is offline, startTurn shortens the turn to a
grace window (game.OfflineGraceDuration, 10s) instead of the full 60s, so an
abandoned game advances and cleans up quickly (kick after ~30s vs ~180s).

- presence is now keyed by player_id (string) instead of uid; ping refreshes
  by claims.PlayerID — the identity the game FSM uses.
- game gains an OnlineChecker interface + WithOnlineChecker option; startTurn
  only ever reduces a human player's turn, never bots or custom durations.
- cmd wires a presenceChecker adapter (*presence.Service + ctx timeout).
- tests: offline player times out within grace; online keeps the full turn.
@rustwizard rustwizard self-assigned this Jun 16, 2026
@rustwizard rustwizard merged commit db4c51a into master Jun 16, 2026
2 checks passed
@rustwizard rustwizard deleted the feat/presence-accelerated-timeout branch June 16, 2026 08:38
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