Skip to content

Fix library cards showing as card backs for guest in multiplayer - #11585

Closed
shoeless wants to merge 1 commit into
Card-Forge:masterfrom
shoeless:fix/mp-library-cardview-id-compare
Closed

Fix library cards showing as card backs for guest in multiplayer#11585
shoeless wants to merge 1 commit into
Card-Forge:masterfrom
shoeless:fix/mp-library-cardview-id-compare

Conversation

@shoeless

@shoeless shoeless commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Problem

CardView.mayPlayerLook looked up the may-look PlayerView collection with indexOf (reference equality):

return col != null && col.indexOf(pv) != -1;

In network play the client's local PlayerViews are distinct objects from the deserialized server ones, so the lookup always missed. Cards a player should be able to see — their own revealed library top (Future Sight/Garruk's Horde), opponent-hand reveals, etc. — rendered as card backs for the guest.

Fix

Compare by getId() instead of object reference. Single file, forge-game only.

🤖 Generated with Claude Code

TrackableCollection<PlayerView> col = get(TrackableProperty.PlayerMayLook);
// TODO don't use contains as it only queries the backing HashSet which is problematic for netplay because of unsynchronized player ids
return col != null && col.indexOf(pv) != -1;
if (col == null) { return false; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't reproduce

CardView.mayPlayerLook checked the may-look PlayerView collection with
indexOf/contains (reference equality). In network play the client's local
PlayerViews are distinct objects from the deserialized server ones, so the
lookup always missed and revealed cards (e.g. own library under Future Sight,
opponent hand reveals) rendered as card backs for the guest. Compare by id
instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shoeless
shoeless force-pushed the fix/mp-library-cardview-id-compare branch from b783bcd to 8d36ea9 Compare August 11, 2026 05:15
@shoeless

Copy link
Copy Markdown
Contributor Author

Confirmed — redundant on master, closing. indexOf already compares by id (TrackableObject.equals is final: same class + same id — your 1ae39dd from 2022), so this explicit loop is semantically identical to current behavior. Traced the history: I originally hit the card-backs symptom on a branch based on January master — before #9642 replaced the client sync path with delta sync — and it doesn't reproduce on the current stack, as you found.

One adjacent real find while verifying: canBeShownTo compares mindSlaveMaster == viewer by reference (~lines 697/719) — that one does break for a deserialized viewer in netplay mind-control scenarios. Happy to PR it separately if there's interest.

@shoeless shoeless closed this Aug 11, 2026
@shoeless
shoeless deleted the fix/mp-library-cardview-id-compare branch August 11, 2026 06:38
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.

2 participants