Skip to content

feat(network): Add debug Direct Connect startup options - #3111

Draft
bobtista wants to merge 9 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/feat/debug-auto-lan-startup
Draft

bobtista wants to merge 9 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/feat/debug-auto-lan-startup

Conversation

@bobtista

@bobtista bobtista commented Aug 11, 2026 •

Copy link
Copy Markdown

Closes #3092.

Adds debug command-line options to host or join a Direct Connect match without going through the menus manually. This makes repeated network testing easier, especially with eight clients.

Use -autoNetworkMode direct with -autoNetworkHost <player-count> or -autoNetworkJoin <host-address>. Optional arguments set the local IP, player name, map and timeout.

Uses the existing LAN join, accept and start paths. Tested two-player startup and eight-player Zero Hour startup with matching simulation CRCs.

The process launcher is separate and is not included here.

Note

Add debug Direct Connect auto-startup options for LAN games

  • Adds a debug-only NetworkAutoStart automation layer that drives LAN game startup end-to-end: main menu to LAN lobby, direct-connect screen, host/join requests with retries, map selection, and game start. All debug builds process new command-line options (-autoNetworkMode, -autoNetworkHost, -autoNetworkJoin, -autoNetworkLocalAddress, -autoNetworkName, -autoNetworkMap, -autoNetworkTimeout); invalid values exit with status 1.
  • Adds strict IPv4 parsing via networkutil.ParseIPv4Address and a new LANAPI::init overload that binds an explicit local IP. MapUtil.CanTransferMap centralizes the map-transfer eligibility check that LAN callers previously assembled inline.
  • Automation failures record a terminal state, request engine shutdown, leave any active LAN game, and return exit code 1 in both Generals and GeneralsMD GameMain.
  • LanGameOptionsMenu::StartPressed is renamed to StartLANGame and now returns whether the start request was issued; the manual start-button callback ignores the result.
  • Risk: StartLANGame rename changes the callback signature in LanGameOptionsMenu.cpp and LanGameOptionsMenu.cpp; the no-argument LANAPI::init in LANAPI.cpp now delegates to the explicit-IP variant.

Macroscope summarized 87ff6a0. (Automatic summaries will resume when PR exits draft mode or review begins).

@bobtista bobtista self-assigned this Aug 11, 2026
@bobtista bobtista added Enhancement Is new feature or request Debug Is mostly debug functionality labels Aug 11, 2026
@mirelle7

Copy link
Copy Markdown

I'm working on a related networking refactor in feature/modernize-networking that removes networking settings from the client entirely (splitting it into smaller PRs against TSH). Might be worth syncing so this doesn't need rework once that lands.

@bobtista

Copy link
Copy Markdown
Author

I'm working on a related networking refactor in feature/modernize-networking that removes networking settings from the client entirely (splitting it into smaller PRs against TSH). Might be worth syncing so this doesn't need rework once that lands.

I reviewed your related work, these will go well together. Whichever is merged first just needs to account for differences in prefs.getLANIPAddress()

@bobtista
bobtista force-pushed the bobtista/feat/debug-auto-lan-startup branch from 4ba7b93 to b75b9af Compare August 26, 2026 14:25
@bobtista
bobtista force-pushed the bobtista/feat/debug-auto-lan-startup branch 2 times, most recently from a33c187 to 56ed502 Compare September 14, 2026 21:06
@bobtista bobtista changed the title feat(network): Add debug command-line automated match startup feat(network): Add debug Direct Connect startup options Sep 24, 2026
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Debug builds can configure LAN match hosting or joining from command-line arguments. The auto-start flow uses Direct Connect, LAN callbacks, map-transfer checks, and menu integration in Generals and Zero Hour.

Changes

Debug LAN match auto-start

Layer / File(s) Summary
Configure debug auto-start
Core/GameEngine/Include/GameNetwork/NetworkAutoStart.h, Core/GameEngine/Include/GameNetwork/networkutil.h, Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp, Core/GameEngine/Source/Common/CommandLine.cpp, Core/GameEngine/CMakeLists.txt
Adds debug-only command-line options for mode, host or join role, addresses, player name, map, and timeout. Adds IPv4 and integer validation and includes the auto-start files in the build.
Run auto-start through LAN
Core/GameEngine/Include/GameClient/MapUtil.h, Core/GameEngine/Source/GameClient/MapUtil.cpp, Core/GameEngine/Include/GameNetwork/LANAPI.h, Core/GameEngine/Source/GameNetwork/LANAPI.cpp, Core/GameEngine/Include/GameNetwork/LANAPICallbacks.h, Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp, Core/GameEngine/Source/GameNetwork/NetworkAutoStart.cpp
Adds host/join configuration and retry handling, LAN initialization with a selected local IP, map-transfer eligibility checks, and callbacks for network and game-start results.
Wire menus and game exit handling
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/*, Generals/Code/GameEngine/Source/Common/GameMain.cpp, GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/*, GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp
Connects auto-start to menu navigation, local-address selection, map selection, LAN updates, and the host start action. Both game variants clear the LAN instance and set exit code 1 after an auto-start failure.

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CommandLine
  participant NetworkAutoStart
  participant LANAPI
  participant LANAPICallbacks
  CommandLine->>NetworkAutoStart: Set mode, role, address, and startup options
  NetworkAutoStart->>LANAPI: Request host creation or join
  LANAPI->>LANAPICallbacks: Report create or join result
  LANAPICallbacks->>NetworkAutoStart: Pass operation result
  NetworkAutoStart->>LANAPI: Accept player slots and request game start
  LANAPICallbacks->>NetworkAutoStart: Report game-start result
Loading
Merge Risk: Minimal · previous review 87ff6

The supplied evidence does not establish a remaining startup failure that should block merging.

Security architecture risk: Low · up to 87ff6

Debug-only auto-start retains the existing network and game-start checks, but it can start a match without a person confirming who joined. The risk is limited to reachable debug sessions; peer-admission controls and deployment exposure remain uncertain.

Retained concerns

  • Low · security · inferred: A reachable peer that joins and accepts a debug-hosted Direct Connect game may satisfy the expected-player count and trigger start without host confirmation of that peer’s identity. Actual exposure depends on network reachability and lower-level admission controls that were not established.
Security review details

Security Blast Radius

  • inferred — The newly non-interactive peer-selection decision affects a reachable debug-hosted match, not an evidenced production service or credential boundary. Actual network reachability and debug-build deployment are unknown.

Security Findings and Attack Paths

  • inferred — If an unintended peer can join the debug host and accept, its slot can count toward automatic start without an expected-peer identity check in the auto-start decision. Lower-level peer admission was not established.

Trust Boundaries and Controls

  • observed — Auto-join parses its configured IPv4 host, uses the existing LAN join request, checks map availability or transferability before acceptance, and preserves the existing game-start validator.

Resilience and Maintainability Implications

  • observed — Pending requests are throttled, selected join failures permit retry, and terminal failures disable auto-start and request process exit. Cleanup on failure is evidenced; cancellation and state reuse after a manual Back action remain unproven.

Hardening Proposals

  • proposed — If debug hosts run on networks with untrusted peers, bind automated start to intended peer identities or an explicit admission control rather than accepted-player count alone.
🚥 Pre-merge checks | ✅ 4

✅ Passed checks (4 passed)

Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding debug Direct Connect startup options for network testing.
Description check ✅ Passed The description directly explains the new command-line options, supported host and join flows, testing scope, and excluded process launcher.
Linked Issues check ✅ Passed The PR satisfies the coding objectives in [#3092]. The debug-only NetworkAutoStart path supports Direct Connect host and join roles, local addresses, unique default names, map and timeout options, r…
Out of Scope Changes check ✅ Passed The changes remain within [#3092]. Command-line parsing, LAN initialization, callback handling, map-transfer checks, menu automation, and failure cleanup support automated LAN startup. The PR does not…
ℹ️ Recent review info

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 6fa37071-7105-4e1a-9710-1311703271bb

📥 Commits

Reviewing files that changed from the base of the PR and between 2bbd82ca218b5305e414f3e76216b8471d044af7 and 87ff6a0046451d6021244a140a40d0987ec287e0.

📒 Files selected for processing (4)

  • Generals/Code/GameEngine/Source/Common/GameMain.cpp
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp
🚧 Files skipped from review as they are similar to previous changes (1)

  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 8b3d5ce8-c37a-4a76-b7b2-0f744b783b05

📥 Commits

Reviewing files that changed from the base of the PR and between bfa3bbf and 2bbd82ca218b5305e414f3e76216b8471d044af7.

📒 Files selected for processing (20)
  • Core/GameEngine/CMakeLists.txt
  • Core/GameEngine/Include/GameClient/MapUtil.h
  • Core/GameEngine/Include/GameNetwork/LANAPI.h
  • Core/GameEngine/Include/GameNetwork/LANAPICallbacks.h
  • Core/GameEngine/Include/GameNetwork/NetworkAutoStart.h
  • Core/GameEngine/Include/GameNetwork/networkutil.h
  • Core/GameEngine/Source/Common/CommandLine.cpp
  • Core/GameEngine/Source/GameClient/MapUtil.cpp
  • Core/GameEngine/Source/GameNetwork/LANAPI.cpp
  • Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp
  • Core/GameEngine/Source/GameNetwork/NetworkAutoStart.cpp
  • Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp
  • GeneralsMD/Code/GameEngine/Source/Common/GameMain.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp
  • GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@tintinhamans

Copy link
Copy Markdown

@macroscope-app review

@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026

Copy link
Copy Markdown

Manual reviews triggered for commit 2bbd82c:

All prior checks · these links stay valid even if you push more commits.

@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026

Copy link
Copy Markdown

Review started; results will be posted as check runs.

Comment thread Core/GameEngine/CMakeLists.txt Resolved
@bobtista
bobtista force-pushed the bobtista/feat/debug-auto-lan-startup branch from 87ff6a0 to 127715e Compare October 17, 2026 20:00
@mirelle7

Copy link
Copy Markdown

Really like this change. Could also be useful for non-debug builds, like for launchers.

@bobtista

Copy link
Copy Markdown
Author

Thanks. I kept it debug-only for this PR.

@bobtista
bobtista force-pushed the bobtista/feat/debug-auto-lan-startup branch from 127715e to 4c6f671 Compare October 28, 2026 18:04
@bobtista
bobtista force-pushed the bobtista/feat/debug-auto-lan-startup branch from 4c6f671 to 748568f Compare November 27, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Debug Is mostly debug functionality Enhancement Is new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(network): Add command-line LAN match startup for debug builds

3 participants