Skip to content

feat(casino): initial roulette version#28

Merged
krellekrelle merged 7 commits into
mainfrom
feat/casino-service
May 27, 2026
Merged

feat(casino): initial roulette version#28
krellekrelle merged 7 commits into
mainfrom
feat/casino-service

Conversation

@krellekrelle

Copy link
Copy Markdown
Owner

No description provided.

- casino-service.csproj targeting net10.0 with JWT bearer
- Program.cs: ASP.NET Core with SignalR, JWT cookie auth, /api/lobbies endpoint
- Models: GameSession, PlayerSeat, SessionState
- Games/IGameEngine: plugin interface (CreateInitialState, ApplyAction,
  GetPublicState, CanStart) with GameAction + GameActionResult DTOs
- Games/RussianRoulette: RussianRouletteSettings, RussianRouletteState,
  RussianRouletteEngine — spin-once cylinder, click/bang resolution
- Services/SessionManager: thread-safe in-memory store, per-session locking,
  idle cleanup timer (lobbies 60 min, finished 10 min)
Real-time hub wired to SessionManager:
- CreateLobby, JoinLobby, LeaveLobby (leader leaving dissolves lobby)
- SetReady (joiners must accept terms before leader can start)
- UpdateLobbySettings (leader only, deserialises to typed settings)
- StartGame (leader only, delegates CanStart validation to engine)
- PullTrigger → broadcasts TriggerResult + GameStateUpdated or SessionFinished
- Reconnect support: rejoining mid-game replays GameStarted/SessionFinished
- ApprovedOnly policy enforced via [Authorize] attribute
Stack: React 18 + Vite + react-router-dom + @microsoft/signalr
Uses @platform/ui-library (NavBar, Card, Button) from monorepo.
HashRouter avoids sub-path issues under /casino/ Caddy prefix.

CasinoHubContext: singleton SignalR connection with auto-reconnect,
  exposes invoke() + on() to all pages.

Landing (/):
  - Start Game → CreateLobby('russian-roulette') → /lobby/:id
  - Join Game → fetches /api/lobbies, shows open lobby list
  - Build Character → disabled placeholder

Lobby (/lobby/:id):
  - Players list with per-player ready indicator
  - Joiners: 'Accept Terms & Ready Up' toggle
  - Leader: chamber count + stake display settings, Start Game button
    (gated on canStart from server)

Game (/game/:id):
  - Dispatches to RussianRouletteView by game type
  - Click/Bang fullscreen overlay with fade animation
  - Pull Trigger button shown only on your turn
  - Finished screen with loser name + stake displayed
Build context is the monorepo root (same pattern as hello-world-dotnet-app)
so the React frontend can resolve ui-library via file: reference.
Stages: Node 22 builds React → .NET SDK publishes → .NET ASP.NET runtime.
Serves on port 3007.
- docker-compose.yml: casino-service on port 3007, no DB dependency
- Caddyfile: handle_path /casino/* with WebSocket headers, both host blocks
- CI/CD: paths-filter + matrix entry (monorepo build context) + deploy pull
- dashboard.html: Casino card pointing to /casino/
casino-service/wwwroot/ is build output (generated by Dockerfile) — ignore it
the same way hello-world-dotnet-app/wwwroot/ is already ignored.
Commit package-lock.json for reproducible frontend installs in CI.
@krellekrelle krellekrelle changed the title Feat/casino service feat(casino): initial roulette version May 27, 2026
out _ is ambiguous for the compiler here; out GameSession? _ resolves
the CS1503 error and satisfies the nullable CS8601 warning.
@krellekrelle
krellekrelle merged commit 5c85fb3 into main May 27, 2026
7 checks passed
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