Commit Graph
105 Commits
Author SHA1 Message Date
8d85f76180 Fix: unique CDN URLs per upload to bust browser + disk model cache
Uploading a replacement GLB with changed animation names to the same
folder/fileName path silently overwrote the S3 object but left the URL
unchanged.  ModelCache keyed its disk cache and in-memory cache by URL,
so all clients continued loading the stale model indefinitely.

Fix (CardEditor.razor):
- Asset uploads: append _yyyyMMddHHmmss timestamp to the filename stem
  before calling UploadAsync, e.g. merlock_20260316_143022.glb.
- Animation uploads: same treatment.
- Result: every upload produces a unique URL; the card asset record is
  updated to that URL; ModelCache sees a new key and fetches fresh bytes.

Fix (HttpCdnClient.cs):
- Set Cache-Control: public, max-age=31536000, immutable on uploaded
  objects.  Since keys are now unique-per-upload, aggressive caching is
  safe and avoids unnecessary re-downloads of unchanged assets.

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 12:05:28 -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
42a2834e03 Feature: model config UI + move scale/tint to CardDefinition
Reorganised model3D config into two logical levels:

Card-level (CardDefinition — "this card's visual identity"):
  ModelScale      float?   — uniform scale multiplier
  ModelTintColor  string?  — multiplicative hex tint e.g. "#FF8800"

Asset-level (CardAsset — "properties of this mesh file"):
  ModelFacingDirection  string?  — GLB export facing ("north" default)
  ModelTintMaskUrl      string?  — CDN URL for per-texel tint mask

Admin UI (CardEditor.razor):
  Basic tab: new "3D Model" row with Scale (number) + Tint Colour
  (text + live swatch preview).
  Assets tab: Model3D asset cards now show Facing Direction dropdown
  and Tint Mask URL input.

Server:
  ContentMessages: ModelScale/ModelTintColor moved to CardDefinitionDto;
  CardAssetDto retains only ModelFacingDirection + ModelTintMaskUrl.
  ContentDtoMapper updated accordingly.

Client (game_screen.gd):
  modelScale + modelTintColor now read from the definition dict;
  modelFacingDirection stays on the asset dict.

DB: migration MoveModelScaleTintToCard applied to pg-forge-01/SOR.

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 07:25:20 -04:00
8e8b61cbb7 Feature: model config (facing/scale/tint) + animation loop fix
SERVER
- CardAsset gains ModelFacingDirection (string?), ModelScale (float?),
  ModelTintColor (string?), ModelTintMaskUrl (string?) columns.
- CardAssetDto and ContentDtoMapper updated to expose them.
- EF migration AddModelConfig applied to pg-forge-01 / SOR DB.

CLIENT (game_screen.gd)
Animation loop:
- GLB standard: first 5 frames (ANIM_TRANSITION_SECS = 5/30s) are
  entry frames that blend from idle into the action.  Looping
  animations now skip those frames on every iteration after the
  first, eliminating the bind-pose flash at the loop seam.
- Manual loop management via animation_finished + CONNECT_ONE_SHOT
  replaces LOOP_LINEAR so the seek-past-transition trick works.
- _idle_callbacks tracks active loop callables so they can be
  disconnected when a one-shot animation interrupts idle.
- _idle_entry_done reset when a one-shot starts so the transition
  frames play correctly when returning to idle after the action.

Model config:
- _find_model3d_asset() replaces _find_model3d_url() — returns the
  full asset dict including the new fields.
- ModelFacingDirection → _facing_to_base_angle() → rotation.y applied
  at load; stored in _model_base_angles for movement / idle reset.
- ModelScale applied uniformly to model_node.scale on load.
- ModelTintColor applied as multiplicative albedo_color tint to all
  StandardMaterial3D surfaces (materials duplicated per-instance).
- ModelTintMaskUrl stored in DB/DTO; per-texel shader not yet wired.

Movement facing:
- _animate_unit_move pre-computes a facing angle per BFS step and
  snaps model_node.rotation.y at the start of each step so units
  face the direction they walk.
- On movement end, rotation resets to the idle/team direction.

Cleanup:
- _rebuild_units removal loop erases _idle_entry_done, _idle_callbacks,
  _model_base_angles, _needs_face_rot for freed units.

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 22:01:58 -04:00
5f87093a75 Fix: _schedule_rebuild race condition kills movement animation
Rapid echo state-updates (phase-change, turn-tick) arriving with
delay=0 used to cancel the pending movement tween, making unit travel
instant.  Now a delay=0 call only updates _pending_rebuild so the
latest state is applied when the existing tween fires; the tween is
only cancelled when a new positive delay arrives.

Also: password min-length 12→8 (auth), anchor preset cleanup (tscn).

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 20:55:40 -04:00
a86675b0c9 Fix: CORS header before upstream await + movement debug prints
CORS: Access-Control-Allow-Origin must be set before the CDN GetAsync
call so it is present even if the upstream throws (ASP.NET Core exception
handling resets responses, dropping headers set after an exception).
Added try/catch to return 502 cleanly on upstream failures.

Debug: [Move] prints in _play_move_animations and _schedule_rebuild to
diagnose why movement animation appears instant.

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 20:42:09 -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
dfafe89e79 Fix: regenerate EF migrations with proper Designer.cs files
Replaced linter-generated stubs (missing [Migration] attribute and
Designer.cs snapshots) with correctly generated migrations.
Applied to production (pg-forge-01).

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-14 08:26:46 -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
dingo 92f61dcd76 Ability Range fix 2026-03-13 17:36:57 -04:00
dingo 60268fd310 Ability changes 2026-03-13 09:47:06 -04:00
dingo c62b5c9355 bazaar bug 2026-03-10 22:09:52 -04:00
dingo 967af85545 Bazaar 2026-03-10 21:38:06 -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
da6899b2c7 Fix: include ArchSpirit in Battlefield ability target candidates
BuildCandidates only added p.Field to the candidate pool for
Scope=Battlefield, leaving p.ArchSpirit (stored as a separate
PlayerState property) out. A Unit-typed ability targeting the
opponent's ArchSpirit would match zero candidates → INSUFFICIENT_TARGETS.

Also include p.ArchSpirit in the AnyZone pool for consistency.

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:58:28 -04:00
696452f4c9 Fix: replace [JsonDerivedType] with [PolyType] to avoid STJ PolymorphicTypeResolver conflict
[JsonDerivedType] alone (without [JsonPolymorphic]) is sufficient in .NET 8 to
activate the built-in PolymorphicTypeResolver, which then throws
NotSupportedException because our custom converter does not support metadata
reads/writes.

Introduce PolyTypeAttribute — a plain internal attribute unknown to the
framework — and replace all [JsonDerivedType] usages on Effect, Condition,
TriggerEvent, and Filter with [PolyType]. PolymorphicAbilityConverter<T> reads
[PolyType] via reflection to build its type map; the framework ignores it entirely.

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 20:53:02 -04:00
bd07c0cdde Fix: remove [JsonPolymorphic] from Effect/Condition/TriggerEvent/Filter base classes
Having both [JsonPolymorphic] on the class AND a custom JsonConverter<T> in options
causes NotSupportedException: the built-in polymorphic resolver tries to configure
alongside the custom converter but requires it to support metadata reads/writes.

Our custom PolymorphicAbilityConverter<T> takes full ownership of polymorphic
dispatch, so [JsonPolymorphic] is redundant. The [JsonDerivedType] attributes
remain — our converter reads them via reflection for the type map; the framework
ignores them without [JsonPolymorphic] present.

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 20:37:33 -04:00
51a7f9e8d2 Fix: extend $type-anywhere deserialization to Condition, TriggerEvent, and Filter
Refactor EffectPolymorphicConverter into a generic PolymorphicAbilityConverter<T>
base class, add concrete converters for all four abstract ability model types:
Effect, Condition, TriggerEvent, and Filter — all share the same abstract +
[JsonPolymorphic] pattern and the same ordering constraint from the admin builder.

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 20:17:01 -04:00
5ed0ec87e3 Fix: deserialize polymorphic Effect when $type is not the first JSON property
[JsonPolymorphic] on an abstract base class requires $type to appear first in
the JSON object. Card abilities authored in the admin tool don't guarantee this
ordering (e.g. {"N":1,"$type":"DrawCards","Player":"Owner"}), causing a
NotSupportedException at ParseAbilities time.

Add EffectPolymorphicConverter which overrides CanConvert to intercept only
typeof(Effect) (not concrete derived types). It buffers the full JSON object,
finds $type at any position, looks up the concrete type from the [JsonDerivedType]
attribute map, then deserializes via the default converter. Because CanConvert
returns false for concrete types, there is no infinite recursion even for nested
Effect[] (e.g. ApplyOnEventEffect.Effects).

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 19:51:43 -04:00
764a47b7d8 Fix: serialize concurrent game.ready with FOR UPDATE to prevent stuck Initializing sessions
Both players navigate to the game screen at the same time after match_found
and both send game.ready concurrently. Without row-level locking, each request
reads the other player's ready flag as false before the other's SaveChanges
commits, so neither handler ever sees both flags set — both return
WaitingForOpponent and the session stays Initializing forever.

Fix: wrap GameReadyHandler in an explicit transaction with SELECT … FOR UPDATE,
matching the same locking pattern already used by LoadActiveSessionAsync for
active-game mutations. The second request now blocks until the first commits,
then reads the updated ready flag and proceeds to initialize.

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:06:00 -04:00
fd95cce564 Fix: only abandon Initializing sessions older than 60 s at startup
MatchmakerService is registered before GameStartupCleanupService in
Program.cs. BackgroundService.StartAsync fires ExecuteAsync on a
background thread and returns immediately, so the matchmaker's first
tick runs concurrently with the cleanup's StartAsync. If players were
already in the queue when the process restarted, the matchmaker creates
a fresh Initializing session within the first milliseconds of startup —
and the cleanup's ToListAsync would include it, abandoning a brand-new
session before game.ready could be sent.

Adding a 60-second staleness threshold: sessions younger than 60 s are
left alone; only genuinely stale sessions (from the previous process)
are abandoned. A legitimate game.ready exchange completes in < 10 s, so
60 s is a safe lower bound.

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 17:23:36 -04:00
5b8f34e794 Fix: abandon stale Initializing sessions on Game startup
When SOR.Game is redeployed, sessions in Initializing status are
unreachable — clients already sent game.ready to the old process and
won't retry. GameStartupCleanupService runs once at startup, marks all
Initializing sessions as Abandoned (WinCondition = "server_restart"),
and pushes game.session_abandoned to both players so clients can return
to the main menu instead of hanging on the loading screen.

Also fix MatchmakerService to include WinnerOpReward, LoserOpReward,
and RankDiffOpMultiplierPct in the rule snapshot so FinalizeGameAsync
picks up the correct OP rewards from the snapshot.

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 17:12:54 -04:00
0600326db7 Feat: chat archiving + ranked OP rewards + admin award OP
- ChatChannel: add ArchivedAt (nullable DateTimeOffset)
- ChatChannelMembership.EndMatchMembershipsAsync: set channel.ArchivedAt
  so match channels are archived when games end
- GameHandlerBase.FinalizeGameAsync: add IEventBus param; compute
  OriginPoints rewards scaled by rank diff; publish GameEndedEvent so
  ChatLifecycleHostedService triggers archival
- GameRuleSet: add WinnerOpReward (50), LoserOpReward (10),
  RankDiffOpMultiplierPct (0) with NOT NULL + defaults
- GameMessages.GameOverPush: add WinnerOpDelta / LoserOpDelta fields
- GameConcedeHandler + GameAttackHandler: inject IEventBus, pass to
  FinalizeGameAsync
- Migrations: 20260309200000_AddArchivedAtToChatChannel (ChatDbContext),
  20260309210000_AddOpRewardFields (GameDbContext)
- Admin GameSessionsPage: inject ChatDbContext; purge Match channels
  before deleting sessions in PurgeAllAsync
- Admin RankedRulesPage: new "Origin Points Rewards" card with three
  number inputs (WinnerOpReward, LoserOpReward, RankDiffOpMultiplierPct)
- Admin AccountDetail: display RankScore + OriginPoints in Profile card;
  new "Award OP" card that credits OP directly to the account balance

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 16:16:22 -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
dingo bb0f7dae91 Tile bindings added to admin portal, CDN improvements 2026-03-09 10:48:24 -04:00
4fa4c21b6e Feat: game explorer, action log result capture, session purge
DB / Server:
- Added ResultJson (jsonb, nullable) to GameActionLog entity + EF migration
- Updated SaveStateAsync to accept resultJson (optional, default null)
- All 11 action handlers now serialize GameEngine.ToDto() result into the log

Admin — GameSessionsPage:
- Session IDs are now clickable links → /game/sessions/{id}
- "Abandon All Active" bulk button (previous)
- "Purge All" button (SuperAdmin only, JS confirm) — hard-deletes all sessions
  and action logs via cascade

Admin — GameSessionDetailPage (/game/sessions/{id}):
- Session header: status badge, P1/P2 display names (click to copy GUID)
- Info cards: Player 1, Player 2, Created timestamp, Duration/WinCondition
- Action log table: seq#, time, actor name (click to copy GUID), action type
- Expandable Payload (JSON) and Result (JSON) per row
- Actor display names resolved from SorIdentityDbContext

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:33:40 -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
bc65e8b9d4 Fix: add ExactSelf to TargetOwnership enum + resolve in AbilitySystem
`ExactSelf` was accepted by the admin builder dropdown but crashed on
deserialization because the TargetOwnership enum was missing the value.

- Added `ExactSelf` to `TargetOwnership` enum in Action.cs
- BuildCandidates treats ExactSelf like Self/Owner (actor's player pool)
- ResolveTargets post-filters to ctx.Source.InstanceId when ExactSelf

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-08 17:47:59 -04:00
3c16fcfce5 Fix: admin ability builder — ExactSelf ownership + target filter dropdown
TargetOwnerships: add "ExactSelf" so action target selectors can restrict to
the specific unit instance that owns the ability (rather than any allied unit).

Target Filter dropdown (new): exposes the TargetSelector.Filters[] field that
previously had no UI. Supports no-param filter types:
  • (none)
  • IsSelf            — any unit with the same card definition
  • IsExactSelf       — only this specific instance (InstanceId match)
  • IsAdjacentToSource

Filter compiles to Target.Filters[0] in the JSON and round-trips correctly
when loading existing ability JSON back into the builder.

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-08 17:05:46 -04:00
11ebdc40d7 Fix: abilitiesJson null crash, battlefield popup, ExactSelf ability filter
Client (game_screen.gd):
- Fix crash when clicking a unit with null abilitiesJson: server sends the key
  with a null value, so dict.get(key,default) returns null — guard both uses
  (_show_ability_panel and _on_hold_timer_fired) with explicit null check.
- Add double-click on battlefield units to open a full CardDetailPopup showing
  name, affinity, stats, and ability descriptions. Popup is instantiated once
  in _ready() and reused; aliases movementPoints/abilities keys as expected.

Server (Filters.cs / AbilitySystem.cs):
- IsSelf filter now matches by CardDefinitionId (definition-level: any copy of
  the same card). This is the appropriate semantic for "self" as a type scope.
- IsExactSelf filter added: matches by InstanceId (instance-level: only this
  specific unit on the battlefield). Use this to prevent duplicate-instance
  trigger bleed where two copies of a card both fire when only one acted.
- TriggerMatches now accepts the evaluating FieldCard and forwards its
  InstanceId to Own() for all ownership checks.
- Own() gains "ExactSelf" scope: fires only when occ.Data.SourceId matches the
  evaluating unit's InstanceId — eliminating the definition-level bleed bug.

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-08 16:28:06 -04:00
c82682f77e Fix: card play input bug, populate CardInstanceDto fields, genus/SP/ST/MP display
- Input bug: CardWidget only consumed mouse PRESS via accept_event(), not RELEASE.
  This caused _unhandled_input to fire _handle_board_click on release of a card
  click, hitting the tile physically behind the hand area in 3D — accidentally
  sending play_card to the wrong tile (Spirit/Ruin) or picking the first tile for
  Terramorpha. Fixed by tracking _press_was_on_board: board clicks only fire when
  the originating PRESS also reached _unhandled_input (i.e., was not consumed by
  a UI card widget).

- Server: added SpCost, StCost, Genus, MinChannelRange, MaxChannelRange,
  MinAttackRange, MaxAttackRange, CanMove, CanAttack, ExtraAttacksRemaining,
  CanBeAttacked, AbilitiesJson to CardInstanceDto and ToCardDto mapping.
  All fields were already on CardInstance; they were simply not exposed to clients.

- Client: build def dict in _make_hand_card with maxMp → movementPoints alias
  so CardWidget displays movement points correctly.

- Client: show MetaRow (genus + type) in compact hand card; only StatsGrid is
  hidden. HandArea / RightPanel height raised 190 → 220px for better visibility.

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-08 09:10:24 -04:00
0af6b61999 Fix action_log duplicate key: increment NextActionSequence before serializing
SaveStateAsync was serializing GameState BEFORE incrementing NextActionSequence,
so the written StateJson always had the pre-increment value. Every subsequent
request read the same NextActionSequence and computed the same SequenceNumber,
causing duplicate key violations on IX_action_logs_GameSessionId_SequenceNumber
even in purely sequential scenarios (e.g. P2 places then P1 places).

Fix: increment NextActionSequence first, then serialize, so the persisted JSON
always reflects the sequence number that was just consumed.

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 18:30:26 -05:00
ece3eaa3be Fix NATS serialization: use System.Text.Json for custom event types
NatsUtf8PrimitivesSerializer (the default) can only handle primitives and
strings, causing "Can't serialize GameStartedEvent" at runtime.

Add NatsJsonSerializer<T> implementing INatsSerialize<T>/INatsDeserialize<T>
using System.Text.Json, and pass it explicitly to PublishAsync/SubscribeAsync
in NatsEventBus so all custom NATS event payloads serialize as JSON.

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 14:15:45 -05:00
dc9b64dc6f Serialize concurrent session mutations with SELECT FOR UPDATE; board 9x9
- LoadActiveSessionAsync: begin explicit transaction + lock session row
  with SELECT FOR UPDATE so concurrent handlers for the same session
  queue up instead of racing
- SaveStateAsync: commit (and release) the transaction after EF SaveChanges
  fixes duplicate key on IX_action_logs_GameSessionId_SequenceNumber
  when both players act simultaneously (e.g. both placing ArchSpirits)
- GameRules: default board size 9x9 (was 8x8)

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 13:12:28 -05:00
30c7bef445 Add PlayerOneAccountId to GameStateDto; fix placement row detection
Client had no way to know if it was P1 or P2, so _valid_placement_tiles
always chose row bh-1. Now the DTO exposes playerOneAccountId so the
client can correctly pick row 0 (P1) or row bh-1 (P2).

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:26:56 -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
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 aa0c17490b Fix serializer changes and ignore local .dotnet cache 2026-03-05 22:47:08 -05:00
dingo 2cfcaf6853 Add global/lobby auto-join and match chat lifecycle 2026-03-05 21:30:43 -05:00
dingo 62763859a3 CDN 2026-03-03 18:39:20 -05:00
dingo ba04911acc CDN flag change 2026-03-03 17:05:27 -05:00
dingo 551610a8ee CDN Browser changes 2026-03-03 11:49:45 -05:00
dingo 8bf7da1092 CDN browser in Admin Portal 2026-03-03 11:26:59 -05:00
dingo d3411e54b5 Remove Starter Deck 2026-03-03 07:18:00 -05:00
dingo a3bcc71082 Client changes, admin portal, collection fixes. 2026-03-02 10:49:49 -05:00
dingo ffe1ec5094 Fixing Deck rules on server.... 2026-03-02 08:45:25 -05:00
dingo d3e39f9511 minor admin portal changes 2026-03-02 08:37:51 -05:00
cec6773a12 fix: NatsMessageRpcResponder SerializePayload must use CamelCase JSON options
SerializePayload was using default JsonSerializerOptions, so record properties
like GetStarterDecksResponse.Decks were serialized as "Decks" (PascalCase).
That JsonElement travels through the NATS reply back to the gateway, which
forwards it verbatim. The client reads p.get("decks", []) and finds nothing
→ "No starter decks available."

Fix: use the same PropertyNamingPolicy=CamelCase that SystemTextJsonSerializer
uses, so all payload field names arrive at the client in camelCase.

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:28:33 -05:00
5d4f0c3745 admin: fix CardEditor AddAsset/AddAnimation + Remove EF bugs
Same two classes of bug as PrebuiltDeckEditor:

1. AddAsset / AddAnimation — ValueGeneratedOnAdd sentinel mismatch:
   New entities with Id = Guid.NewGuid() added to a tracked ObservableHashSet
   are classified as Modified by EF, causing a 0-rows-affected UPDATE.
   Fix: Db.Entry(entry).State = EntityState.Added when !_isNew.

2. RemoveAsset / RemoveAnimation — redundant Db.Remove on detached entity:
   Id != Guid.Empty is always true (Guid.NewGuid() default). Removing an
   Added entity from the collection detaches it; calling Db.Remove re-attaches
   it as Deleted → DELETE on a non-existent row → DbUpdateConcurrencyException.
   Fix: removed the explicit Db.Remove calls; EF handles orphan deletion.

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 11:14:06 -05:00