Skip to content

Commit 4144bda

Browse files
MostCromulentclaude
andcommitted
Remove UI_NETPLAY_COMPAT and unify the network codec
The pref gated two outer-codec branches that had been functionally equivalent for production traffic since 2020. Reference compression runs at the inner layer (DeltaSyncManager.toNetworkValue, wrapEvents) regardless of the outer codec, and a pref-mismatch between endpoints could corrupt the stream on the first class descriptor. Apply tracker-aware IdRef substitution from <!-- -->Card-Forge#10644 on the surviving codec, gated on per-client DeltaSyncManager consumerId rather than server-tracker presence: the server's tracker holds CardViews that never reach the client (Card.fromPaperCard choice copies registered as a side effect of SpellAbilityView.updateHostCard during buildAbilities), so trackable.hasConsumer(consumerId) is the correct "client knows" predicate. Ephemerals fall through to inline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 55a42ab commit 4144bda

29 files changed

Lines changed: 162 additions & 121 deletions

File tree

forge-game/src/main/java/forge/trackable/TrackableObject.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@ public int getVersion() {
144144
return version;
145145
}
146146

147+
/**
148+
* Check whether a consumer is currently registered on this object.
149+
* <p>
150+
* Used by network serialization to gate IdRef substitution: the server
151+
* registers a consumer on every TrackableObject it has included in a
152+
* delta packet for a given client. An object without that consumer is
153+
* one the client hasn't been told about (typically an ephemeral such as
154+
* a {@code Card.fromPaperCard} choice copy that never enters a tracked
155+
* zone), and protocol-method args holding it must serialize inline.
156+
*/
157+
public boolean hasConsumer(int consumerId) {
158+
return consumers != null && consumers.containsKey(consumerId);
159+
}
160+
147161
/**
148162
* Register a consumer for per-consumer dirty tracking.
149163
*/

forge-gui-android/src/forge/app/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private void loadGame(final HWInfo hwInfo, final String title, final String step
385385
forgeLogo = findViewById(resId("id", "logo_id"));
386386
activeView = findViewById(resId("id", "mainview"));
387387
activeView.setBackgroundColor(Color.WHITE);
388-
forgeView = initializeForView(Forge.getApp(hwInfo, getAndroidClipboard(), adapter, ASSETS_DIR, false, !isLandscape, isTabletDevice, Build.VERSION.SDK_INT), config);
388+
forgeView = initializeForView(Forge.getApp(hwInfo, getAndroidClipboard(), adapter, ASSETS_DIR, !isLandscape, isTabletDevice, Build.VERSION.SDK_INT), config);
389389

390390
getAnimator(ObjectAnimator.ofFloat(forgeLogo, "alpha", 1f, 1f).setDuration(800), ObjectAnimator.ofObject(activeView, "backgroundColor", new ArgbEvaluator(), Color.WHITE, Color.BLACK).setDuration(1600), new AnimatorListenerAdapter() {
391391
@Override

forge-gui-desktop/src/main/java/forge/control/FControl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import forge.gamemodes.match.HostedMatch;
4646
import forge.gamemodes.quest.data.QuestPreferences.QPref;
4747
import forge.gamemodes.quest.io.QuestDataIO;
48-
import forge.gui.GuiBase;
4948
import forge.gui.SOverlayUtils;
5049
import forge.gui.framework.FScreen;
5150
import forge.gui.framework.InvalidLayoutFileException;
@@ -261,10 +260,6 @@ public void initialize() {
261260

262261
display = FView.SINGLETON_INSTANCE.getLpnDocument();
263262

264-
//set ExperimentalNetworkOption from preference
265-
boolean propertyConfig = prefs != null && prefs.getPrefBoolean(ForgePreferences.FPref.UI_NETPLAY_COMPAT);
266-
GuiBase.enablePropertyConfig(propertyConfig);
267-
268263
closeAction = CloseAction.valueOf(prefs.getPref(FPref.UI_CLOSE_ACTION));
269264

270265
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage(getLocalizer().getMessage("lblLoadingQuest"));

forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,6 @@ public void initialize() {
101101
SoundSystem.instance.changeBackgroundTrack();
102102
});
103103

104-
// This updates Experimental Network Option
105-
view.getCbUseExperimentalNetworkStream().addItemListener(arg0 -> {
106-
if (updating) { return; }
107-
108-
final boolean toggle = view.getCbUseExperimentalNetworkStream().isSelected();
109-
GuiBase.enablePropertyConfig(toggle);
110-
prefs.setPref(FPref.UI_NETPLAY_COMPAT, String.valueOf(toggle));
111-
prefs.save();
112-
});
113-
114104
lstControls.clear(); // just in case
115105
lstControls.add(Pair.of(view.getCbAnte(), FPref.UI_ANTE));
116106
lstControls.add(Pair.of(view.getCbAnteMatchRarity(), FPref.UI_ANTE_MATCH_RARITY));
@@ -136,7 +126,6 @@ public void initialize() {
136126
lstControls.add(Pair.of(view.getCbEnableUnknownCards(), FPref.UI_LOAD_UNKNOWN_CARDS));
137127
lstControls.add(Pair.of(view.getCbEnableNonLegalCards(), FPref.UI_LOAD_NONLEGAL_CARDS));
138128
lstControls.add(Pair.of(view.getCbAllowCustomCardsDeckConformance(), FPref.ALLOW_CUSTOM_CARDS_IN_DECKS_CONFORMANCE));
139-
lstControls.add(Pair.of(view.getCbUseExperimentalNetworkStream(), FPref.UI_NETPLAY_COMPAT));
140129
lstControls.add(Pair.of(view.getCbImageFetcher(), FPref.UI_ENABLE_ONLINE_IMAGE_FETCHER));
141130
lstControls.add(Pair.of(view.getCbDisableCardImages(), FPref.UI_DISABLE_CARD_IMAGES));
142131
lstControls.add(Pair.of(view.getCbDisplayFoil(), FPref.UI_OVERLAY_FOIL_EFFECT));
@@ -254,7 +243,6 @@ public void update() {
254243
setPlayerNameButtonText();
255244
view.getCbDevMode().setSelected(ForgePreferences.DEV_MODE);
256245
view.getCbEnableMusic().setSelected(prefs.getPrefBoolean(FPref.UI_ENABLE_MUSIC));
257-
view.getCbUseExperimentalNetworkStream().setSelected(prefs.getPrefBoolean(FPref.UI_NETPLAY_COMPAT));
258246

259247
for(final Pair<JCheckBox, FPref> kv: lstControls) {
260248
kv.getKey().setSelected(prefs.getPrefBoolean(kv.getValue()));

forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
121121
private final JCheckBox cbEnableUnknownCards = new OptionsCheckBox(localizer.getMessage("lblEnableUnknownCards"));
122122
private final JCheckBox cbEnableNonLegalCards = new OptionsCheckBox(localizer.getMessage("lblEnableNonLegalCards"));
123123
private final JCheckBox cbAllowCustomCardsDeckConformance = new OptionsCheckBox(localizer.getMessage("lblAllowCustomCardsInDecks"));
124-
private final JCheckBox cbUseExperimentalNetworkStream = new OptionsCheckBox(localizer.getMessage("lblExperimentalNetworkCompatibility"));
125124
private final JCheckBox cbAiPicker = new OptionsCheckBox(localizer.getMessage("lblAiPickerSettings"));
126125
private final JCheckBox cbCardArtCoreExpansionsOnlyOpt = new OptionsCheckBox(localizer.getMessage("lblPrefArtExpansionOnly"));
127126
private final JCheckBox cbSmartCardArtSelectionOpt = new OptionsCheckBox(localizer.getMessage("lblSmartCardArtOpt"));
@@ -382,9 +381,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
382381
pnlPrefs.add(cbAllowCustomCardsDeckConformance, titleConstraints);
383382
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlAllowCustomCardsInDecks")), descriptionConstraints);
384383

385-
pnlPrefs.add(cbUseExperimentalNetworkStream, titleConstraints);
386-
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlExperimentalNetworkCompatibility")), descriptionConstraints);
387-
388384
pnlPrefs.add(cbAiPicker, titleConstraints);
389385
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlAiPickerSettings")), descriptionConstraints);
390386

@@ -749,11 +745,6 @@ public JCheckBox getCbAllowCustomCardsDeckConformance() {
749745
return cbAllowCustomCardsDeckConformance;
750746
}
751747

752-
/** @return {@link javax.swing.JCheckBox} */
753-
public JCheckBox getCbUseExperimentalNetworkStream() {
754-
return cbUseExperimentalNetworkStream;
755-
}
756-
757748
/** @return {@link javax.swing.JCheckBox} */
758749
public JCheckBox getCbImageFetcher() {
759750
return cbImageFetcher;

forge-gui-ios/src/forge/ios/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected IOSApplication createApplication() {
3030
final IOSApplicationConfiguration config = new IOSApplicationConfiguration();
3131
config.useAccelerometer = false;
3232
config.useCompass = false;
33-
final ApplicationListener app = Forge.getApp(null, new IOSClipboard(), new IOSAdapter(), assetsDir, false, false, false, 0);
33+
final ApplicationListener app = Forge.getApp(null, new IOSClipboard(), new IOSAdapter(), assetsDir, false, false, 0);
3434
final IOSApplication iosApp = new IOSApplication(app, config);
3535
return iosApp;
3636
}

forge-gui-mobile-dev/src/forge/app/GameLauncher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public GameLauncher(final String versionString, final String[] args) {
8080
else if (hasBothDims) isPortrait = heightArg > widthArg;
8181

8282
ApplicationListener start = Forge.getApp(hw, new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),
83-
assetsDir, false, isPortrait, false, 0);
83+
assetsDir, isPortrait, false, 0);
8484

8585
// Initialize window size
8686
int windowWidth, windowHeight;

forge-gui-mobile/src/forge/Forge.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public class Forge implements ApplicationListener {
131131
private static Localizer localizer;
132132
private static boolean desktopAutoOrientation = true;
133133

134-
public static ApplicationListener getApp(HWInfo hwInfo, Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean propertyConfig, boolean androidOrientation, boolean isTablet, int AndroidAPI) {
134+
public static ApplicationListener getApp(HWInfo hwInfo, Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean androidOrientation, boolean isTablet, int AndroidAPI) {
135135
if (app == null) {
136136
app = new Forge();
137137
if (GuiBase.getInterface() == null) {
@@ -140,7 +140,6 @@ public static ApplicationListener getApp(HWInfo hwInfo, Clipboard clipboard0, ID
140140
//obb directory on android uses the package name as entrypoint
141141
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app"));
142142
GuiBase.setInterface(new GuiMobile(assetDir0));
143-
GuiBase.enablePropertyConfig(propertyConfig);
144143
isPortraitMode = androidOrientation;
145144
isTabletDevice = isTablet;
146145
androidVersion = AndroidAPI;

forge-gui-mobile/src/forge/screens/settings/SettingsPage.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,15 +448,6 @@ public void select() {
448448
);
449449
}
450450
}, 3);
451-
lstSettings.addItem(new BooleanSetting(FPref.UI_NETPLAY_COMPAT,
452-
Forge.getLocalizer().getMessage("lblExperimentalNetworkCompatibility"),
453-
Forge.getLocalizer().getMessage("nlExperimentalNetworkCompatibility")) {
454-
@Override
455-
public void select() {
456-
super.select();
457-
GuiBase.enablePropertyConfig(FModel.getPreferences().getPrefBoolean(FPref.UI_NETPLAY_COMPAT));
458-
}
459-
}, 3);
460451
lstSettings.addItem(new BooleanSetting(FPref.UI_ENABLE_DISPOSE_TEXTURES,
461452
Forge.getLocalizer().getMessage("lblDisposeTextures"),
462453
Forge.getLocalizer().getMessage("nlDisposeTextures")) {

forge-gui/res/languages/de-DE.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,6 @@ lblAllowCustomCardsInDecks=Erlaube benutzerdefinierte Karten
11371137
nlAllowCustomCardsInDecks=Erlaubt die Verwendung von benutzerdefinierten Karten in Decks. (Erfordert Neustart)
11381138
lblDisableCardImages=Kartenbilder abschalten
11391139
nlDisableCardImages=Wenn aktiviert, zeigt Forge keine Kartenbilder mehr.
1140-
lblExperimentalNetworkCompatibility=Experimentelle Netzwerkkompatibilität
1141-
nlExperimentalNetworkCompatibility=Forge wechselt auf kompatiblen Netzwerk-Stream. (Im Zweifel bitte ausschalten)
11421140
lblDisposeTextures=Bildspeicher reorganisieren
11431141
nlDisposeTextures=Wenn aktiviert, wird der Kartenbildspeicher zwischen einzelnen Spiele entleert um RAM zu sparen. (Im Zweifel bitte ausschalten)
11441142
lblAutoCacheSize=Aktiviere automatische Cache-Größe

0 commit comments

Comments
 (0)