Implement SOR.Ai Phase 1: project scaffold, transport, seeding, lobby handlers, session manager
- New SOR.Ai project with AI account/deck seeding (50 accounts: 10 difficulty × 5 strategy) - AiNoOpClientConnection + AiClientMessage: AI invokes game handlers in-process - AiPlayerSessionManager: BackgroundService subscribing to GameStarted/AiTurnStarted/GameEnded - AiPlayerSession: sends game.ready and executes turns (Phase 1 stub: pass immediately) - Lobby handlers: game.ai.add, game.ai.remove, game.ai.configure - IAiAccountRegistry in SOR.Shared to break circular dependency with SOR.Game - GameEndTurnHandler + GameReadyHandler publish AiTurnStarted event when AI is active player - Account entity: IsAi, AiDifficulty, AiStrategy columns - CustomLobby entity: AiSlotsJson column 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:
@@ -1,5 +1,36 @@
|
||||
namespace SOR.Game;
|
||||
|
||||
// ── AI lobby requests / responses / pushes ────────────────────────────────────
|
||||
|
||||
/// <summary>Host adds an AI player to a custom lobby.</summary>
|
||||
public sealed record GameAddAiRequest(Guid LobbyId, int Difficulty, string Strategy);
|
||||
public sealed record GameAddAiResponse(Guid AiAccountId, string AiDisplayName, int SeatIndex);
|
||||
|
||||
/// <summary>Host removes an AI player from a custom lobby.</summary>
|
||||
public sealed record GameRemoveAiRequest(Guid LobbyId, Guid AiAccountId);
|
||||
public sealed record GameRemoveAiResponse(bool Success);
|
||||
|
||||
/// <summary>Host changes the difficulty or strategy of an existing AI slot.</summary>
|
||||
public sealed record GameConfigureAiRequest(Guid LobbyId, Guid AiAccountId,
|
||||
int? Difficulty, string? Strategy);
|
||||
public sealed record GameConfigureAiResponse(bool Success);
|
||||
|
||||
/// <summary>
|
||||
/// Pushed to all lobby members when the AI slot list changes
|
||||
/// (AI added, removed, or configured).
|
||||
/// </summary>
|
||||
public sealed record CustomLobbyAiSlotsChangedPush(
|
||||
Guid LobbyId,
|
||||
IReadOnlyList<AiSlotInfo> CurrentAiSlots);
|
||||
|
||||
/// <summary>One AI seat in a custom lobby.</summary>
|
||||
public sealed record AiSlotInfo(
|
||||
Guid AccountId,
|
||||
string DisplayName,
|
||||
int Difficulty,
|
||||
string Strategy,
|
||||
int SeatIndex);
|
||||
|
||||
// ── Requests ─────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Signal that the player has loaded the game screen and is ready to start.</summary>
|
||||
|
||||
Reference in New Issue
Block a user