Commit Graph
41 Commits
Author SHA1 Message Date
51f3ee23d4 Feature: tile height variation + stalagmite bottoms + live content refresh
## Tile height variation (fix)
Tile tops now visibly vary (0.8–1.0) from a fixed bottom at world Y=0.
Previously the top was fixed and the variation was only visible underneath.
Heights are seeded by tile coordinate so they're deterministic per board.
Unit y_offsets and highlight positions update to match per-tile height.

## Stalagmite tile bottoms
Server: new TileBottomModel entity + migration (catalog.tile_bottom_models),
content.tile_bottoms handler returns all active CDN URLs.
Admin: "Tile Bottom Models" section in the Tile Model Manager page —
  add/toggle active/delete entries with CDN picker.
Client: ContentCache fetches + disk-caches the URL pool; _try_load_tile_model
  picks a random URL and attaches it flipped below the tile model as a
  stalagmite using the existing _fit_model_to_tile scale logic.

## Live content refresh
ContentCache schedules start_sync() every 5 minutes after sync_complete so
card definitions, tile models, and bottom models are refreshed in the
background without restarting the client.

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>
2026-03-16 15:05:48 -04:00
085249b5c4 Fix: model facing default (south/+Z) + clear game state on rematch
Model facing: GLB models exported from Blender arrive in Godot facing +Z,
not -Z. Changed _facing_to_base_angle default case from 0 (north/-Z) to
PI (south/+Z). Explicit "north" case added. Updated admin dropdown label
from "Default (north)" to "Default (south / Blender GLB)" to match.

Stale game state: when matchmaking.match_found is received, clear Game.state
so the new GameScreen always calls send_ready() rather than rendering the
previous (ended) game's state. Fixes same-players-re-match ending up in
the already-completed session.

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>
2026-03-16 08:18:28 -04:00
c4999c953a Feature: GLB animation playback, model facing, CDN animation preview
Server:
- CardAnimationBinding.AnimationTrackName: nullable override for GLB track name
  (blank = case-insensitive convention match; Idle/Attack/Damaged/Moving/Dying)
- CardAnimationBindingDto: includes AnimationTrackName in content sync
- CardEditor: GLB Track Name column in animation bindings table
- CdnBrowser: model-viewer animation list + playback (JS interop on load event)
- Migration: AddAnimationTrackName applied to production

Client:
- ContentCache.get_anim_track(): resolves GLB track name from binding override
  or falls back to convention with case-insensitive aliases
- game_screen.gd:
  - _find_animation_player(): recursive search in loaded GLB scene tree
  - _resolve_anim_track(): case-insensitive + alias resolution
  - _play_unit_anim(): plays track, returns to Idle when one-shot finishes
  - _play_damage_animations(): detects HP drops and unit deaths before rebuild
  - Model facing: P1 units rotated 180deg Y to face opponent across board
  - Idle loop starts automatically after real model loads
  - Attack animation fires immediately on attack input (before ACK)

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>
2026-03-15 14:06:55 -04:00
3810742fe6 Feature: leaderboard hide, ability animations, card sounds, BGM, in-game settings
Server:
- Account.IsHiddenFromLeaderboard: filter bots/devs from leaderboard
- AbilityAnimationDefinition: type, effect, dimensions, asset/sound URLs per ability
- CardAnimationBinding: CastSoundCdnUrl + ImpactSoundCdnUrl per card action
- GameAudioConfig entity: admin-configurable BGM tracks per context
- GetGameAudioConfigHandler (content.get_audio_config) + ServiceRegistration
- Admin pages: AccountDetail toggle, AudioConfig CRUD, CardEditor + AbilityBuilder UI
- Migrations: AddLeaderboardHide, AddCardActionSounds, AddGameAudioConfig

Client:
- Music.gd autoload: fetches BGM config, crossfades between context tracks
- InGameSettings overlay: audio sliders, camera follow toggle, concede with confirm
- GameScreen: gear button opens settings; ConcedeBtn moved into settings panel
- project.godot: Music autoload registered

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>
2026-03-13 23:31:10 -04:00
c44dadec45 Fix: clear game state on game.over to prevent matchmaking re-entry bug
When game.over was received, Game.state was not cleared. If both players
re-queued and matched again, the new GameScreen saw non-empty state and
called _on_state_updated instead of send_ready(), leaving the new session
stuck in Initializing. Clearing state = {} before emitting game_over fixes this.

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>
2026-03-13 21:32:19 -04:00
cb8cb59b22 Fix: login screen UX + chat poll auth guard
- Status label: connect Network.connected so "Connecting…" clears once the
  WebSocket opens (previously the label stuck forever with no session)
- Remember Me: apply font_color override so the checkbox text is visible
- Register errors: map ASP.NET Identity password-policy error codes
  (PasswordTooShort, PasswordRequiresUpper/Lower/NonAlphanumeric/Digit) to
  user-friendly strings; old WEAK_PASSWORD kept as alias
- Chat poll: guard _on_message_poll_tick with Auth.user_id check so the timer
  cannot send chat.get_messages as the first message on a fresh connection
  when the user is not yet authenticated (caused by logout not stopping the
  timer, leaving it running into the next reconnect cycle)

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>
2026-03-10 20:36:36 -04:00
8e3f64d9d1 Fix: ability WithinRange/IsAdjacentToSource filters + ModelCache web CORS
- AbilitySystem: implement WithinRangeFilter (Manhattan distance min/max) and
  IsAdjacentToSourceFilter in FilterMatches — both were falling through to
  _ => true, so range constraints on targeting were silently ignored
- Program.cs: add GET /cdn/{**path} proxy endpoint with
  Access-Control-Allow-Origin: * so browser web clients can fetch GLB models
  (Ceph RadosGW / cdn.aeternalisgames.com has no CORS headers)
- ModelCache.gd: on web export, rewrite cdn.aeternalisgames.com URLs to go
  through hub.aeternalisgames.com/cdn proxy; disk/memory cache still keyed
  on the original CDN URL for consistency across platforms

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>
2026-03-10 10:39:13 -04:00
9e400c87b4 Feat: ability activation UI with targeting flow
- Ability panel now starts a per-action targeting flow instead of
  immediately firing the ability
- Board abilities: blue tile highlights for unit/tile targets; click
  to collect AbilityTarget and advance to the next action
- Player/zone abilities: left-side player panel with player name
  buttons; zone (Hand/Deck/Discard) sub-buttons appear for zone-scoped
  abilities
- Re-clicking a selected spirit toggles the ability panel open/closed
- Auto-skips actions whose ownership is Self/ExactSelf/Random or whose
  count.all = true (server resolves those without player input)
- Game.send_activate_ability now accepts an optional targets array

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>
2026-03-09 22:22:02 -04:00
1c0ec5fed9 Fix: replace match with if in send_ready lambda to fix GDScript parse error
match inside a lambda inside a function call argument confuses the GDScript
parser. Simple if is equivalent and parses correctly.

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>
2026-03-09 18:53:17 -04:00
014d264540 Fix: remove spurious 'no state key' warning from game.ready ack; handle session_abandoned push
For WaitingForOpponent/Started, state always arrives via game.state_update push
not via the ack payload — calling _apply_state_from_payload on the ack was
producing a confusing warning with no real effect. Replace with a match that
only fetches state for AlreadyStarted.

Also add game.session_abandoned push handler: emits Game.session_abandoned
signal (new) and game_screen connects to it to navigate back to MainScreen,
so clients stuck on the loading screen after a server restart recover cleanly.

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>
2026-03-09 18:51:18 -04:00
c94fe4204d Fix: ModelCache gives actionable error when OBJ/non-GLB file is loaded
Shows the first 20 printable bytes and explains that only binary .glb
is supported at runtime, with a Blender re-export hint.

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>
2026-03-09 14:15:18 -04:00
03b553feab Debug: log ModelCache HTTP result/headers/bytes; fix weakref captures
- ModelCache._download: log result enum, HTTP code, body size,
  Content-Type header, and first 16 bytes for every download — enough
  to diagnose why Godot receives non-GLB data despite CDN serving valid GLB
- Moved disk-cache write to AFTER a successful parse so corrupt bytes
  are never written; disk cache read now deletes + re-downloads on bad parse
- game_screen: replace raw `body` lambda captures with weakref to
  eliminate "Lambda capture freed" noise (behavior unchanged)

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>
2026-03-09 14:06:23 -04:00
6dda0edf17 Fix: 3D model loading for units/tiles + tile model server pipeline
- ModelCache: switch GLTFDocument.append_from_buffer (was append_from_file
  which returned ERR_BUSY/43); validate GLB magic bytes; explicit signal
  disconnect before queue_free to avoid freed-lambda errors
- ContentCache: add tile model fetch (content.tile_models), disk cache at
  user://content/tile_models.json, get_tile_model_url() API
- game_screen: _add_tile now loads tile CDN model via ModelCache when bound
- Server: ContentGetTileModelsHandler (content.tile_models msg), registered
  in ServiceRegistration; TileModelDto / GetTileModelsResponse added to
  ContentMessages

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>
2026-03-09 13:34:17 -04:00
e815dd708f Feat: load 3D models from card definition assets on game board
Client:
- Added ModelCache autoload (autoloads/ModelCache.gd)
  - Downloads .glb files from CDN via HTTPRequest
  - Disk cache: user://remote_model_cache/<sha256>.glb
  - Memory cache: PackedScene per URL for instant re-instantiation
  - Concurrent requests for same URL queue and share one download
  - Loads via GLTFDocument.append_from_file + generate_scene
- game_screen.gd: _add_unit_mesh now looks up cardDefinitionId
  → ContentCache.get_definition() → finds Model3D asset URL
  → calls ModelCache.load_model() to async replace placeholder geometry
  - Placeholder (sphere/cylinder/box) shown immediately
  - Real model swaps in on download completion
  - Guards against body being freed before model arrives
  - Added _unit_bodies dict for O(1) body lookup
- project.godot: registered ModelCache autoload

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>
2026-03-09 12:37:25 -04:00
60697460cb Feat: scroll block over hand, camera follow, chat overlay, admin cleanup
Client (game_screen.gd):
- Scroll wheel no longer zooms camera when mouse is over the hand panel
- Clicking a friendly unit smoothly tweens camera pivot to that unit
  (EASE_OUT CUBIC, 0.4s) — respects Settings.camera_follow_unit toggle
- Chat overlay instantiated from game screen and removed on exit

Client (Settings.gd + SettingsScreen):
- Added camera_follow_unit bool (default: on) to gameplay settings section
- Persisted to user://settings.cfg under [gameplay]
- Toggle visible in Settings screen under new GAMEPLAY section

Server Admin (MatchmakingQueuePage):
- "Clear History" button deletes all non-Searching matchmaking entries

Server Admin (GameSessionsPage):
- Per-row "Abandon" button for Active/Initializing sessions
- "Abandon All Active" bulk button marks all live sessions as Abandoned
  with EndedAt=now and WinCondition="admin"

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>
2026-03-09 09:09:01 -04:00
036738e44d Fix Placement-phase move attempts; case-insensitive player ID matching; hand debug
- Block unit selection in Placement phase (prevents sending game.move_unit
  when opponent hasn't placed yet)
- All accountId comparisons now case-insensitive (Guid serialization may
  differ between auth response and state DTO)
- Add debug log in _on_state_updated: phase, player found, hand size

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>
2026-03-07 11:38:48 -05:00
926c9d53a6 Add Game.gd debug logging for all packets sent and received
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>
2026-03-07 10:50:44 -05:00
dingo e7da2532a2 Client fixors 2026-03-07 10:28:32 -05:00
84612614c5 Fix game state push type and reconnect flow in Game.gd
- Server pushes "game.state_update" not "game.state_update.push"
- On "AlreadyStarted" ack (reconnect), explicitly fetch state via game.get_state
  instead of expecting state in the ready ack (it's never there)

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>
2026-03-07 09:33:56 -05:00
01b6d19d7b Game screen: ownership fix, hand hover, terramorpha, sacrifice, ascend/transition, ability UI
- Game.gd: fix push type "game.over" (not "game.over.push"), store opponent_name
- game_screen.gd full rewrite:
  - Unit ownership via _rebuild_ownership() + _is_enemy_unit()/_is_friendly_unit()
    (CardInstanceDto has no ownerAccountId; build sets from PlayerStateDto instead)
  - Hand card hover y-reset fixed to 0.0 (was incorrectly using container position)
  - Opponent name from Game.opponent_name
  - Terramorpha multi-tile sequential selection with adjacency validation
  - Sacrifice: click ArchSpirit → PopupMenu → select spirit → ConfirmationDialog
  - Ascend/Transition: detected by card tier vs current arch tier, confirmation dialogs
  - Ability panel: parses abilitiesJson, filters Active abilities, floating HUD buttons

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>
2026-03-07 07:20:54 -05:00
3d57931752 Build Bazaar: 4 tabs, sort/filter, art images, USD disabled
Actually: Add ranked gameplay UI — matchmaking + 3D game screen

- Game.gd autoload: stores session/state, handles match_found and
  game.state_update.push, exposes helpers and all server action methods
- MatchmakingScreen: fetches decks, joins ranked queue, shows elapsed
  timer, cancels cleanly; navigates to GameScreen on match_found push
- GameScreen (3D + 2D overlay):
  - 3D board: 1×1×0.5 BoxMesh tiles colored by affinity (24 affinities),
    StaticBody3D per tile for raycast picking
  - Unit placeholders: sphere=Spirit, cylinder=ArchSpirit, box=Ruin,
    team-colored (blue/red), exhaust dimming
  - Camera: orbit (left-drag / one-finger), zoom (scroll / pinch),
    pan (middle-drag / two-finger); isometric default ~40° pitch
  - Hand: scrollable row of GameCardWidgets; hover → scale+rise anim;
    click → select; selected card highlights valid play tiles green
  - Unit selection: click unit → movement range (green), attack
    range (red); click target tile → move; click enemy → attack
  - Placement phase: valid ArchSpirit tiles highlighted automatically
  - Draw phase: auto-draws after 0.3s delay
  - Context popup: hold 0.5s on tile → tile coord/affinity + unit
    stats + ability names
  - Discard viewer: own + opponent, scrollable card list
  - Game-over overlay: result, rank delta, return to main menu
  - All game actions wired: play, move, attack, sacrifice, end turn,
    draw, concede, ascend, transition, activate ability
- main_screen.gd: MatchBtn → MatchmakingScreen

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>
2026-03-07 04:10:31 -05:00
2c107e3851 DM shows player name; add party rename
- ChatGetChannelsHandler: for Direct channels, look up the other
  member's display name from identity DB and return it as the channel
  name (per-caller, no DB schema change)
- ChatDmOpenHandler: same — returns recipient display name in the DTO
  for both new and existing DM channels
- New ChatPartyRenameHandler (chat.party.rename): updates the party
  channel name, returns updated DTO
- Chat.gd: rename_party() calls the new handler and upserts locally
- chat_overlay.gd: "Rename" button in party action bar opens a dialog
  to set a new party name

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>
2026-03-06 22:36:58 -05:00
dceabf4f06 Fix chat bubble visibility, friends refresh, and DM close
- Chat bubble now hidden on all scenes; MainScreen shows/hides it via
  Chat.set_bubble_visible() in _ready/_exit_tree
- send_friend_request now uses Network.request so _fetch_social() fires
  on success, making the friends list update immediately after adding
- Added DM close button (✕) to each conversation row in the DMs tab;
  _close_dm removes the channel from local state via Chat.close_dm()

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>
2026-03-06 22:14:43 -05:00
a482cc5319 Add Settings, Account, Bug Reports, and Leaderboard
Server:
- New SOR.Support project: SubmitBugReport, GetLeaderboard, GetAccountProfile handlers
- New SOR.Database support schema: BugReport + BugReportResponse entities + SupportDbContext
- EF migration: Migrations/Support/AddSupport
- Admin panel: Bug Reports list + detail pages with reply-to-submitter flow
- Admin NavMenu: Support section with Bug Reports link
- Reply creates chat.Notification (type "admin_response") for in-game mailbox

Client:
- Settings autoload (Settings.gd): music/sfx volume+mute, persisted to user://settings.cfg
- SettingsScreen: sliders + mute CheckButtons wired to Settings autoload
- AccountScreen: profile (display name, OP, rank score) + mailbox (admin_response notifications)
- LeaderboardScreen: paginated ranked player list, caller highlighted in blue
- BugReportDialog: category/title/description/steps form, submits via support.submit_bug_report
- MainScreen: new Leaderboard, Account, Settings, Report a Bug navigation buttons

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>
2026-03-06 20:14:12 -05:00
9dadeda7c1 Add friends, DMs, presence, block, and party chat
- Fix social response key mismatch (incomingRequests, blocked)
- Fix DmOpenResponse to return full ChatChannelDto so client can
  add the channel without a separate fetch
- Add Party channel type to ChatChannelType enum
- Add PartyInviteHandler, PartyInviteRespondHandler, PartyLeaveHandler
  with IClientPush invite notification to the invitee
- Add party tab to chat overlay (action bar, messages, Leave button)
- Wire Invite to Party in both player and friend context menus
- Show accept/decline popup dialog on incoming party invite push

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>
2026-03-06 16:12:51 -05:00
dingo 1d775a0f19 Update chat UI auth visibility, default global tab, and fast polling 2026-03-05 22:25:57 -05:00
dingo cd43880a9a fix client chat 2026-03-05 08:33:07 -05:00
dingo 8dca906afd fix client 2026-03-05 06:15:41 -05:00
52419e2199 Chat module — overlay, friends, presence, DMs, context menus
- Chat.gd autoload: data layer for channels, messages, social graph,
  presence, and notifications; wires to Network/Auth singletons
- ChatOverlay.tscn + chat_overlay.gd: CanvasLayer (layer=100) that
  persists across all scenes; bubble toggle at bottom-right corner
- Six tabs: Friends, Presence, Global, Lobby, Game, DMs
- Message rows show [HH:MM] [source] Name: text with color-coded
  source badges (global/lobby/game/private/party/system)
- Friends list: online/offline sections, right-click context menu
  (Private Message, Set Nickname, Block, Remove Friend)
- Player name click: Add Friend, Invite to Party (stub), Mute/Unmute,
  Hi Scores (disabled placeholder)
- Presence tab: own status selector (Online/Away/Offline) + friends
  presence overview with status dots
- DMs tab: conversation sidebar + message pane, input bar shown when
  a conversation is selected
- Unread notification badge on chat bubble
- Per-session nickname overrides and muting

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>
2026-03-05 05:48:09 -05:00
dingo a3bcc71082 Client changes, admin portal, collection fixes. 2026-03-02 10:49:49 -05:00
2508fe1297 client: force WebSocket reconnect on logout so auth arrives on a fresh connection
logout() now calls Network.force_reconnect() to tear down the existing Phase-5
connection; the next auth.login / auth.register is then the very first message
on the new connection, which is the only point where ConnectionLoop handles auth.

Also adds Network.force_reconnect() public method.

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>
2026-03-01 22:55:45 -05:00
fa5beb104c client: map WebSocket close reason to error code in _on_ws_closed
Godot discards buffered data packets when the close frame arrives, so the
JSON error sent by RejectAsync is never received. Map known server close
reasons (auth_failed, auth_required) from the close frame's reason field
to AUTH_FAILED / AUTH_REQUIRED so Auth.gd's logout+navigate logic fires
correctly instead of treating every rejection as a transient DISCONNECTED.

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>
2026-03-01 20:46:48 -05:00
2643fe4276 client: fix auth_failed loop — logout + navigate from Auth.gd centrally
When auth.hello is rejected (session expired/revoked), Auth.gd now calls
logout() to wipe all auth state (including auth.cfg) and drives the scene
change to LoginScreen directly, instead of relying on each scene's own
auth_failed handler.

This covers all screens (main, collection, etc.) without each needing a
handler, and eliminates the race where the auth.hello reply arrived as
DISCONNECTED (STATE_CLOSING path, token kept) → reconnect → resend token.

main_screen.gd no longer subscribes to auth_failed; session expiry redirect
is fully owned by Auth.gd.

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>
2026-03-01 10:57:15 -05:00
4322732b47 client: fix auth-expiry reconnect loop + improve error messages
Network.gd — drain packets before handling close (main bug fix):
  When the server rejects auth.hello it sends an error frame then closes
  the connection. Godot's WebSocketPeer.poll() can transition directly to
  STATE_CLOSED while the error packet sits unread in the buffer. The old
  code returned early on STATE_CLOSED without calling _poll_packets(), so
  _on_ws_closed() fired DISCONNECTED for the pending auth.hello instead of
  the real AUTH_FAILED. Auth kept the session token and retried forever.
  Fix: drain any buffered packets before _on_ws_closed().

Network.gd — fail request() immediately when not connected:
  Previously request() silently dropped the send but left a dangling
  pending entry that was never resolved until the next disconnect. Now
  on_error("DISCONNECTED") is called immediately, giving the caller
  consistent feedback and keeping _pending clean.

main_screen.gd — stay on screen for DISCONNECTED auth errors:
  A transient network drop during auth.hello was sending the user back
  to the login screen unnecessarily. Only navigate to login when the
  session is explicitly rejected (AUTH_FAILED, ACCOUNT_LOCKED, etc.).
  The "● Reconnecting…" status label already handles the transient case.

login_screen.gd — add missing friendly error translations:
  INVALID_PASSWORD / USER_NOT_FOUND → "Wrong email or password."
  DISPLAY_NAME_TAKEN, ACCOUNT_LOCKED, AUTH_REQUIRED,
  AUTH_SERVICE_UNAVAILABLE all now map to clear human-readable strings
  instead of falling through to the raw server message or error code.

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>
2026-03-01 10:17:03 -05:00
2ed7ad2ba9 Fix WebSocket 1009 — increase Godot receive buffer and NATS max payload
Godot's WebSocketPeer.inbound_buffer_size defaults to 65535 bytes (64 KB).
content.sync.ack for a full card catalog (200 cards with assets and animation
bindings) exceeds this, causing Godot to close the connection with code 1009
"Message too big" every time content.sync is called.

- Network.gd: set inbound_buffer_size = 4 MB before connect_to_url so the
  client can receive large sync responses without dropping the connection.
- deployment-nats.yaml: raise NATS max_payload from 1 MB to 8 MB (-max_payload
  8388608) so the content service can reply with large card batches through NATS
  without hitting a publish-too-large error as the card catalog grows.

Note: NATS pod needs a rollout restart to apply the new max_payload arg:
  kubectl rollout restart deployment/nats -n stone-server

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>
2026-02-28 20:03:10 -05:00
bdd6e59dfe Add starter deck flow, admin force-logout + rename, shop flag
Auth chain:
- auth.proto: add needs_starter_deck to Login/Register/ValidateToken responses
- auth.proto: add RevokeAllSessions RPC
- AuthGrpcHandler: populate NeedsStarterDeck from Account.StarterDeckSelectedAt
- AuthGrpcHandler: track tokens in UserSessions Redis SET on create/logout
- AuthGrpcHandler: implement RevokeAllSessions (Redis + Postgres)
- IGatewayAuthValidator / GatewayAuthValidator: thread NeedsStarterDeck through tuples
- ConnectionLoop: include needsStarterDeck in auth ack payload

Client:
- Auth.gd: store needs_starter_deck from auth reply; clear on logout
- login_screen.gd: route to StarterDeckScreen when needs_starter_deck = true
- scenes/starter_deck/: new StarterDeckScreen (fetch decks → pick → confirm → InitScreen)

Admin panel:
- AccountDetail.razor: Force Logout All Sessions card (Redis + Postgres revoke)
- AccountDetail.razor: Change Display Name form with uniqueness check
- SOR.Admin: add StackExchange.Redis package + DI registration
- PrebuiltDeckEditor.razor: split into IsStarterDeck + IsAvailableInShop checkboxes
- PrebuiltDeck.cs: add IsAvailableInShop field
- Migration: AddPrebuiltDeckShopFlag

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>
2026-02-28 13:08:08 -05:00
fa8418387b Add session TTL and disconnect auto-logout to Auth; fix export presets
- Auth.gd: discard saved sessions older than 30 days on load (saved_at timestamp)
- Auth.gd: auto-logout and return to login screen after 30 min disconnected
- Auth.gd: cancel auto-logout timer immediately on reconnect
- Auth.gd: emit session_expired signal for any listener that needs it
- Network.gd: enable debug_log_packets for easier debugging
- export_presets.cfg: updated to full Godot 4.5 web preset (variant/thread_support,
  custom_template paths, PWA options) — fixes web CI build

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>
2026-02-28 12:30:45 -05:00
dingo 0945208e48 gRPC Error 2026-02-28 08:40:05 -05:00
6a33e26237 Godot client: Collection screen — cards grid, deck management, card widget
- CardWidget (146×204px): affinity-coloured border + art placeholder,
  stats with tooltips, foil/serial indicators, selection highlight
- DeckListItem: inline rename, clone/delete signals to parent
- CardsView: paginated + filterable grid (search debounce, type/affinity
  filters, responsive columns, Load More pagination)
- DecksView: deck list with New Deck form (ArchSpirit card picker),
  clone/rename/delete wired to API, ConfirmationDialog for delete
- CollectionScreen: pill-tab container (Cards / Decks), background
  incremental content sync, back button → MainScreen
- MainScreen: wire CollectionBtn → CollectionScreen
- ContentCache: expose is_syncing() public method

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>
2026-02-28 07:48:07 -05:00
2d6b20f3cb Godot client: version check + content sync + caching architecture
Client flow after auth is now:
  LoginScreen → auth_success → InitScreen → MainScreen

autoloads/ContentCache.gd
  - Cursor-based incremental sync via content.sync (PageSize=200)
  - Merges definition DTOs in-memory (id → Dictionary)
  - Persists to user://content/defs.json on sync completion
  - Incremental on repeat launches: 0 round trips when nothing changed
  - Signals: sync_progress(fetched_total), sync_complete(total), sync_failed(error)

scenes/init/InitScreen.tscn + init_screen.gd
  - Step 1: version.check (clientVersion="0.1.0", platform="web")
      UpdateRequired  → show "please refresh" panel, block
      UpdateAvailable → soft banner, continue
      Ok              → continue
      DISCONNECTED    → wait for Network.connected (one-shot), retry
      other error     → warn + proceed (don't block player on non-critical check)
  - Step 2: ContentCache.start_sync()
      Shows running card count while pages arrive
      On sync_complete: transition to MainScreen
      On sync_failed: show error + Retry button

scenes/login/login_screen.gd
  - _go_to_main() now routes to InitScreen instead of MainScreen directly

project.godot
  - ContentCache registered as autoload (loads before Auth)
  - pointing/emulate_touch_from_mouse=true for desktop browser testing

Caching architecture decision (see plan):
  - Layer 1 (definitions/text): always sync all eagerly — no privacy concern
  - Layer 2 (2D art): lazy by definition ID, CDN fetch on demand
  - Layer 3 (3D models/animations): set-bundle granularity + server-injected
    noise during match pre-warm to prevent cache oracle attack
    (Layer 2/3 implementation is future work)

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>
2026-02-27 21:31:47 -05:00
3aaabe75e3 Godot client networking + auth + login/main screens; fix admin hamburger
Server:
- ConnectionLoop: accept auth.login and auth.register as valid first messages
  (not just auth.hello); all ack payloads now include sessionToken for client
  persistence
- IGatewayAuthValidator: add LoginAsync and RegisterAsync
- GatewayAuthValidator: implement both via auth gRPC; fetch displayName from
  ValidateAsync after login/register succeeds
- Admin hamburger: custom .sor-admin-hamburger CSS (hardcoded white, no Bootstrap
  btn-link theme fighting); topbar z-index 1050 with position:sticky

Client (Godot 4.5, GDScript):
- autoloads/Network.gd: WebSocketPeer state machine (CONNECTING / CONNECTED /
  RECONNECTING), exponential backoff (1→30s), app-level keepalive ping every
  30s of idle, 30s ping timeout → reconnect, request/reply correlation by
  sequence number, debug_log_packets export flag for full packet dumps
- autoloads/Auth.gd: drives auth.hello / auth.login / auth.register as first
  WS message; persists sessionToken + userId + displayName to user://auth.cfg;
  auto-resumes saved session on reconnect; auth_success / auth_failed signals
- scenes/login/LoginScreen.tscn + login_screen.gd: Login + Register tabs,
  touch-friendly inputs (44px height), status label, Enter key submits, handles
  reconnect/resume states
- scenes/main/MainScreen.tscn + main_screen.gd: top bar with live connection
  dot, welcome label, placeholder nav buttons, sign-out, redirects to login on
  session expiry
- project.godot: Network and Auth autoloads registered; LoginScreen as main scene

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>
2026-02-27 20:48:53 -05:00