Feature: model retry + rejoin on login + 5-min inactivity detection
**Feature 1 — Model retry (client)** - `ModelCache.gd`: add `evict(url)` to remove failed entries so re-download is possible - `game_screen.gd`: when GLB load fails, `_schedule_model_retry` queues a 60-second retry (up to 10 attempts); `_do_model_retry` evicts + re-downloads and swaps the placeholder mesh for the real model if/when it succeeds **Feature 2 — Rejoin on login (server + client)** - Server: `GameGetActiveSessionHandler` (`game.get_active_session`) — returns the caller's active session ID + phase, or null when no session exists - Client: `init_screen.gd` checks for an active session after content sync; shows a "Rejoin / Concede" dialog when one is found; rejoin navigates to GameScreen with the session ID already set so `send_ready` → `AlreadyStarted` → `_fetch_state` **Feature 3 — 5-minute inactivity detection (server + client)** - `GameSession`: add `LastActionAt` column + EF migration (`20260317000001_AddLastActionAt`) - `GameHandlerBase.SaveStateAsync`: sets `session.LastActionAt` on every action - `GameInactivityMonitorService`: background poll every 60 s; when a session hasn't had an action in ≥ 5 min, pushes `game.inactive_warning` to the stalled player and `game.opponent_inactive` to their opponent (once per session per server lifetime) - `GameForceConcedeHandler` (`game.force_concede`): lets the waiting player claim the win; validates caller is not the active player and `LastActionAt` is stale - `Game.gd`: new `opponent_inactive` / `inactive_warning` signals + push handlers + `send_force_concede()` helper - `game_screen.gd`: handles `opponent_inactive` with Accept/Wait dialog; handles `inactive_warning` with informational popup Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -80,6 +80,12 @@ public sealed record GameActivateAbilityRequest(
|
||||
int AbilityIndex,
|
||||
IReadOnlyList<AbilityTarget>? Targets = null);
|
||||
|
||||
/// <summary>Query whether the caller has an Active game session they can rejoin.</summary>
|
||||
public sealed record GameGetActiveSessionRequest();
|
||||
|
||||
/// <summary>Force-concede a game where the opponent has been inactive.</summary>
|
||||
public sealed record GameForceConcedeRequest(Guid SessionId);
|
||||
|
||||
// ── Custom lobby requests ─────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Create a new custom lobby. Host provides their deck and optional rule overrides.</summary>
|
||||
@@ -140,6 +146,14 @@ public sealed record GameTransitionResponse(GameStateDto State);
|
||||
|
||||
public sealed record GameActivateAbilityResponse(GameStateDto State);
|
||||
|
||||
/// <summary>
|
||||
/// Response for game.get_active_session.
|
||||
/// SessionId is null when the player has no in-progress game.
|
||||
/// </summary>
|
||||
public sealed record GameGetActiveSessionResponse(Guid? SessionId, string? Phase);
|
||||
|
||||
public sealed record GameForceConcedeResponse(GameStateDto State);
|
||||
|
||||
// ── Custom lobby responses ─────────────────────────────────────────────────────
|
||||
|
||||
public sealed record CreateCustomLobbyResponse(
|
||||
@@ -187,6 +201,18 @@ public sealed record GameOverPush(
|
||||
/// </summary>
|
||||
public sealed record GameSessionAbandonedPush(Guid SessionId, string Reason);
|
||||
|
||||
/// <summary>
|
||||
/// Pushed to the active player when they have been inactive for 5 minutes.
|
||||
/// Their opponent now has the option to accept the forfeit.
|
||||
/// </summary>
|
||||
public sealed record GameInactiveWarningPush(Guid SessionId);
|
||||
|
||||
/// <summary>
|
||||
/// Pushed to the non-active player when the opponent has been inactive for 5 minutes.
|
||||
/// The client should offer "Accept forfeit" or "Wait" options.
|
||||
/// </summary>
|
||||
public sealed record GameOpponentInactivePush(Guid SessionId);
|
||||
|
||||
/// <summary>
|
||||
/// Pushed to both players when a custom lobby is full and a GameSession has been created.
|
||||
/// Players should navigate to the game screen and send game.ready.
|
||||
|
||||
Reference in New Issue
Block a user