Skip to content

Network multiplayer optimization (UI improvements)#9671

Open
MostCromulent wants to merge 6 commits intoCard-Forge:masterfrom
MostCromulent:NetworkPlay/ui
Open

Network multiplayer optimization (UI improvements)#9671
MostCromulent wants to merge 6 commits intoCard-Forge:masterfrom
MostCromulent:NetworkPlay/ui

Conversation

@MostCromulent
Copy link
Contributor

THIS PR HAS BEEN SPLIT FROM #9642.

Network UI Improvements: Better feedback during network operations including the prompt window identifying which player currently has priority and how long the game has been waiting for them to take an action; e.g. "Waiting for MostCromulent... (32 seconds)".

Dependency
This branch is has been refactored to be fully independent from other features in #9642.

Features
Waiting timer and connection error improvements for network games:

  • Show player name in waiting messages ("Waiting for Bob..." instead of generic "Waiting for opponent...")
  • Add elapsed time counter to waiting prompts (e.g., "Waiting for Bob... (1:23)")
  • Replace generic "Unable to connect" with more detailed connection error messages (connection refused, unknown host,
    timeout, no route to host)
    • "Unknown host. Please check the hostname or IP address is correct."
    • "Connection timed out. The server may be unreachable or behind a firewall."
    • "No route to host. Please check your network connection."

Files Changed

File Module Description
CMatchUI.java forge-gui-desktop Waiting timer, player name prompt messages, view-safe priority detection
InputLockUI.java forge-gui Network-aware waiting messages with player name and elapsed time
NetConnectUtil.java forge-gui Detailed connection error messages for common failure types
CSubmenuOnlineLobby.java forge-gui-desktop Handle CONN_ERROR_PREFIX for detailed error display
OnlineLobbyScreen.java forge-gui-mobile Handle CONN_ERROR_PREFIX for detailed error display
ForgeConstants.java forge-core CONN_ERROR_PREFIX constant
en-US.properties forge-gui 9 new localization strings for waiting and error messages

Screenshot 2026-02-05 064449 Screenshot 2026-02-05 064401

MostCromulent and others added 2 commits February 5, 2026 06:20
Improves user experience during network games:
- Waiting timer shows player name and elapsed time (CMatchUI, InputLockUI)
- Connection errors display detailed messages instead of generic failure
- Adds CONN_ERROR_PREFIX constant for structured error handling
- New localization strings for waiting and error messages

UI-only changes, no game logic or delta sync functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use GameView data only in findWaitingForPlayerName() to work on
  both host and client (fixes null Game on network clients)
- Add findPriorityPlayer() using PlayerView.getHasPriority()
- Use localized string prefixes in isWaitingMessage() instead of
  hardcoded English strings
- Add volatile to timer fields for thread safety

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
if (ixCall != iCall.get() || !isActive()) {
return;
}
FThreads.invokeInEdtLater(showMessageFromEdt);
Copy link
Contributor

Choose a reason for hiding this comment

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

when is this relevant in netplay? somehow I never reached a breakpoint here... 🤔

I don't understand why there should be two timer systems:
If one input isn't enough, then why isn't it only handled in AbstractGuiGame instead so it works for mobile too?

Copy link
Contributor Author

@MostCromulent MostCromulent Feb 5, 2026

Choose a reason for hiding this comment

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

Ignore most recent commit, I'll rework this.

Copy link
Contributor Author

@MostCromulent MostCromulent Feb 6, 2026

Choose a reason for hiding this comment

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

Actually, can I confirm:

I understand ordinarily display wouldn't be in AbstractGuiGame, however Claude AI's initial approach in 9cfa358 was to consolidate both timing and display in AbstractGuiGame on the basis waiting for opponent prompt is already dealt with in line 479-480 (albeit briefly).

From your perspective is that the preferable approach, or should it be attempting to keep the timing in AbstractGuiGame and move the rest elsewhere? E.g. Have AbstractGuiGame deal with the timer then CMatchUI and MatchController can each format their own platform-specific waiting messages.

My assumption is better to split them out given current waiting prompt is ~1-2 lines in AbstractGuiGame and therefore trivial, while Claude's consolidated approach would take up a lot more space.

Sorry for ignorance or if this is a stupid question, I just want to figure out the correct principle to apply here and for future reference.

Copy link
Contributor

Choose a reason for hiding this comment

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

what's the argument for "platform-specific waiting messages"?

it looked like a step in the right direction before revert

MostCromulent and others added 3 commits February 6, 2026 06:41
Addresses review feedback from tool4ever: consolidate timer logic into
the existing awaitNextInput() mechanism in AbstractGuiGame instead of
adding separate timer systems in InputLockUI and CMatchUI.

Changes:
- Revert InputLockUI.java to master (remove ~100 lines of timer code)
- Revert CMatchUI.java to master (remove ~185 lines of timer/prompt code)
- Enhance AbstractGuiGame.updatePromptForAwait() with:
  - Player name lookup (shows "Waiting for [Player]..." in network games)
  - Elapsed time display (shows "(5s)" or "(1:23)" suffix)
  - 1-second reschedule loop for network games only
- Remove unused lblYieldingWaitingForPlayer from en-US.properties

Benefits:
- 1 timer system instead of 3 (reuses existing awaitNextInputTimer)
- Platform-neutral: works on mobile automatically
- No duplicate code: single findWaitingForPlayerName() implementation
- Smaller diff: 155 lines total vs 369 before refactor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…8-UP5xm

Revert "Refactor waiting timer to AbstractGuiGame (PR 9671 feedback)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants