Phase 8: Free Play ready-up system + client scenes

Server (Phase A):
- CustomLobby: +HostReady/GuestReady/HostFirstTurnPref/GuestFirstTurnPref/MaxPlayers
- Migration: AddReadyUpSystem — applied to prod DB
- GameJoinCustomLobbyHandler: no longer auto-creates session; sets Full status,
  resets readiness, pushes CustomLobbyGuestJoinedPush to host
- GameLobbyReadyHandler (NEW): game.custom.lobby.ready — marks caller ready,
  resolves first-turn, creates session + pushes game.custom.started when all ready
- GameUnreadyHandler (NEW): game.custom.lobby.unready
- GameChangeLobbyDeckHandler (NEW): game.custom.lobby.change_deck
- GameUpdateLobbyRulesHandler (NEW): game.custom.update_rules (host only)
- GameListActiveLobbiesHandler (NEW): game.custom.list_active (Status==Started)
- GameListCustomLobbiesHandler: now batch-loads host/guest display names
- GameMessages: +LobbyReadyRequest/Response, UnreadyInLobbyRequest/Response,
  ChangeLobbyDeckRequest/Response, UpdateLobbyRulesRequest/Response,
  ListActiveLobbiesRequest/Response, LobbyReadyStatusPush, LobbyDeckChangedPush,
  ActiveLobbyDto; CustomLobbyDto +HostDisplayName/GuestDisplayName
- ServiceRegistration: register 5 new handlers

Client (Phase B):
- CustomLobby.gd: new autoload for Free Play lobby state + all server calls
- project.godot: register CustomLobby autoload
- MainScreen: +Free Play button → FreePlayScreen.tscn
- FreePlayScreen (NEW): Open Lobbies tab + Active Games tab + Create dialog
- LobbyRoomScreen (NEW): ready-up UI, first-turn selector, preset voting
- Game.gd: +is_spectating, +start_spectating(), +stop_spectating()
- game_screen.gd: spectator mode — SPECTATING label, hidden action buttons,
  neutral HUD labels, stop_spectating() on exit

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-19 09:10:55 -04:00
co-authored by Claude Happy
parent cf05bacf0c
commit d61ebe66b8
23 changed files with 2685 additions and 99 deletions
+55 -2
View File
@@ -159,6 +159,23 @@ public sealed record ListCustomLobbiesRequest(
string? NameSearch = null,
bool ShowPasswordProtected = true);
// ── Ready-up requests ─────────────────────────────────────────────────────────
/// <summary>Mark the caller as ready in a Full lobby with their final deck and first-turn preference.</summary>
public sealed record LobbyReadyRequest(Guid LobbyId, Guid DeckId, string FirstTurnPref);
/// <summary>Withdraw the caller's ready status in a Full lobby.</summary>
public sealed record UnreadyInLobbyRequest(Guid LobbyId);
/// <summary>Change the caller's deck selection while in a Full lobby (not yet ready).</summary>
public sealed record ChangeLobbyDeckRequest(Guid LobbyId, Guid DeckId);
/// <summary>Host updates lobby rule overrides while in Full state (neither player ready yet).</summary>
public sealed record UpdateLobbyRulesRequest(Guid LobbyId, CustomRulesOverride Rules);
/// <summary>List all in-progress custom games (Status == Started). Supports paging.</summary>
public sealed record ListActiveLobbiesRequest(int Page = 1, int PageSize = 20);
// ── Responses ─────────────────────────────────────────────────────────────────
public sealed record GameReadyResponse(Guid SessionId, string Status);
@@ -205,8 +222,8 @@ public sealed record CreateCustomLobbyResponse(
public sealed record JoinCustomLobbyResponse(
Guid LobbyId,
string Status, // "WaitingForHost" | "GameCreated"
Guid? GameSessionId); // set when Status == "GameCreated"
string Status, // "WaitingForReady"
Guid? GameSessionId); // always null; reserved for future use
public sealed record LeaveCustomLobbyResponse(Guid LobbyId);
@@ -238,6 +255,22 @@ public sealed record ListCustomLobbiesResponse(
int Page,
int PageSize);
// ── Ready-up responses ────────────────────────────────────────────────────────
public sealed record LobbyReadyResponse(Guid LobbyId, bool IsReady);
public sealed record UnreadyInLobbyResponse(Guid LobbyId);
public sealed record ChangeLobbyDeckResponse(Guid LobbyId);
public sealed record UpdateLobbyRulesResponse(Guid LobbyId, CustomRulesDto Rules);
public sealed record ListActiveLobbiesResponse(
IEnumerable<ActiveLobbyDto> Games,
int TotalCount,
int Page,
int PageSize);
// ── Server Pushes ─────────────────────────────────────────────────────────────
/// <summary>
@@ -309,6 +342,12 @@ public sealed record LobbyUpdatedPush(Guid LobbyId, CustomRulesDto NewRules);
/// <summary>Pushed to both participants when a preset-load vote is rejected.</summary>
public sealed record PresetVoteRejectedPush(Guid LobbyId, Guid PresetId);
/// <summary>Pushed to both participants whenever a lobby participant's ready status changes.</summary>
public sealed record LobbyReadyStatusPush(Guid LobbyId, bool HostReady, bool GuestReady);
/// <summary>Pushed to both participants when a lobby participant changes their selected deck.</summary>
public sealed record LobbyDeckChangedPush(Guid LobbyId, Guid AccountId, Guid DeckId);
// ── DTOs ─────────────────────────────────────────────────────────────────────
/// <summary>
@@ -396,10 +435,24 @@ public sealed record CustomLobbyDto(
Guid LobbyId,
string LobbyName,
Guid HostAccountId,
string HostDisplayName,
bool HasGuest,
string? GuestDisplayName,
CustomRulesDto Rules,
DateTimeOffset CreatedAt);
/// <summary>Summary of an in-progress custom game, shown in the Active Games browser.</summary>
public sealed record ActiveLobbyDto(
Guid LobbyId,
string LobbyName,
Guid HostAccountId,
string HostDisplayName,
Guid GuestAccountId,
string GuestDisplayName,
Guid GameSessionId,
bool HasPassword,
CustomRulesDto Rules);
/// <summary>
/// Detailed view of a custom lobby, including full rule set and participant presence.
/// Returned by game.custom.get.