Fix 4: Remove Art2dUrl/ModelUrl from UnitDelta

These URLs are fixed for the lifetime of a card definition and are
already delivered once in the initial UnitSnapshot (CardInstanceDto).
Sending them again in every UnitDelta was wasting bandwidth on every
stat change, move, and attack.

Server:
- GameStateDiffer.DiffUnit: remove Art2dUrl/ModelUrl from the anyChange
  detection block and from the UnitDelta constructor call
- GameMessages.UnitDelta record: remove string? Art2dUrl and ModelUrl
  fields (CardInstanceDto/UnitSnapshot retains both — first placement
  delivery is unaffected)

Client:
- Game.gd _merge_unit_delta: remove the five URL merge lines
  (art2dUrl, Art2dUrl, modelUrl, ModelUrl, modelurl). Values on the
  unit dict are set once via unitsAdded and stay for the unit's lifetime.

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-05-20 20:34:30 -04:00
co-authored by Claude Happy
parent e7bf25759f
commit 93e3c8b0db
3 changed files with 8 additions and 13 deletions
+2 -3
View File
@@ -556,9 +556,8 @@ public sealed record UnitDelta(
int? ExtraAttacksRemaining,
CoordDto? Position,
string? AbilitiesJson,
string? AbilityUsesJson,
string? Art2dUrl,
string? ModelUrl);
string? AbilityUsesJson);
// Art2dUrl and ModelUrl removed: fixed per card definition, sent once in UnitSnapshot.
public sealed record PublicCountsDelta(
int? DeckCount,
+4 -5
View File
@@ -251,9 +251,10 @@ internal static class GameStateDiffer
prevC.ExtraAttacksRemaining != nextC.ExtraAttacksRemaining ||
prevFc?.Position != nextFc?.Position ||
prevC.AbilitiesJson != nextC.AbilitiesJson ||
prevC.Art2dUrl != nextC.Art2dUrl ||
prevC.ModelUrl != nextC.ModelUrl ||
abilityUsesChanged;
// Art2dUrl and ModelUrl are intentionally excluded: they are fixed for the
// lifetime of a card definition and are already sent in the initial UnitSnapshot.
// Including them in UnitDelta would waste bandwidth on every stat change.
if (!anyChange) return null;
@@ -282,9 +283,7 @@ internal static class GameStateDiffer
ExtraAttacksRemaining : prevC.ExtraAttacksRemaining != nextC.ExtraAttacksRemaining ? nextC.ExtraAttacksRemaining : null,
Position : positionDelta,
AbilitiesJson : prevC.AbilitiesJson != nextC.AbilitiesJson ? nextC.AbilitiesJson : null,
AbilityUsesJson : abilityUsesJson,
Art2dUrl : prevC.Art2dUrl != nextC.Art2dUrl ? nextC.Art2dUrl : null,
ModelUrl : prevC.ModelUrl != nextC.ModelUrl ? nextC.ModelUrl : null);
AbilityUsesJson : abilityUsesJson);
}
private static PlayerStatsDelta? DiffPlayerStats(PlayerState prev, PlayerState next)