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:
dingo
2026-03-17 09:05:05 -04:00
co-authored by Claude Happy
parent c0e9ffbd18
commit 3ba33275e3
14 changed files with 849 additions and 4 deletions
@@ -113,6 +113,52 @@ func _on_sync_progress(fetched_total: int) -> void:
func _on_sync_complete(_total: int) -> void:
_check_active_session()
func _check_active_session() -> void:
_set_status("Checking for active games…")
Network.request(
"game.get_active_session",
{},
func(_type: String, p: Variant): _on_active_session(p),
func(_code: String, _msg: String): _go_to_main()
)
func _on_active_session(payload: Variant) -> void:
var p := payload as Dictionary
var sid : String = str(p.get("sessionId", ""))
# A null or zero UUID means no active session.
if sid.is_empty() or sid == "00000000-0000-0000-0000-000000000000":
_go_to_main()
return
var phase : String = str(p.get("phase", "unknown"))
var dialog := ConfirmationDialog.new()
dialog.title = "Active Game Found"
dialog.dialog_text = "You have an active game in progress (%s phase).\nWould you like to rejoin?" % phase
dialog.ok_button_text = "Rejoin"
dialog.cancel_button_text = "Concede"
add_child(dialog)
dialog.confirmed.connect(func() -> void:
Game.session_id = sid
get_tree().change_scene_to_file("res://scenes/game/GameScreen.tscn")
)
dialog.canceled.connect(func() -> void:
_set_status("Conceding game…")
Network.request(
"game.concede",
{ "sessionId": sid },
func(_t: String, _rp: Variant): _go_to_main(),
func(_c: String, _m: String): _go_to_main()
)
)
dialog.popup_centered()
func _go_to_main() -> void:
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")