Skip to content

Added command line modes to launch forge into the lobby - #11577

Open
kenjitamura wants to merge 8 commits into
Card-Forge:masterfrom
kenjitamura:lobbyCommandLineLaunch
Open

Added command line modes to launch forge into the lobby#11577
kenjitamura wants to merge 8 commits into
Card-Forge:masterfrom
kenjitamura:lobbyCommandLineLaunch

Conversation

@kenjitamura

@kenjitamura kenjitamura commented Aug 9, 2026

Copy link
Copy Markdown

I'm setting up moonshine to run a forge server and several clients on the same machine. While setting it up I decided being able to use command line launch arguments to open to the lobby was something that'd be nice to have. Willing to clean this up if there are specific pointers and feelings aren't hurt if this is decided to be something the project doesn't want.

However, my experience with Java is practically non-existent with the closest being I've done some projects in C#.

This is admittedly all DeepSeek. I took dumps with async-profiler of the operations-

Host

  1. Launch forge
  2. Navigate to Lobby
  3. Host new match
  4. Refuse port forward
  5. Close Forge after started

Join

  1. Launch forge
  2. Navigate to Lobby
  3. Join match with the URL to the existing host
  4. Close Forge after joined

And asked it to make purely additive changes while preserving formatting of the original to add command line arguments as modes:

  1. join ip:port
  2. host port

I tested locally and the only issues I've ran into are:

  1. If you try to launch with join and the host hasn't added an available player slot it will fail
  2. Host and join are populating with the default name in the system and it might be good to add another argument to specify the player name at launch

Output from deepseek and confirmed with diff view in vscode:

The change set (verified via git status — exactly 6 files)

4 modified (formatting-preserving, additions only):

Main.java — added join and host switch cases, each with return (preventing the fall-through to System.exit(0) that caused your earlier crash).
CSubmenuOnlineLobby.java — added public joinServer(String url) delegating to the existing private join(url).
NetConnectUtil.java — refactored host(...) into a delegating 2-arg + new public host(lobby, chat, port) + private host(lobby, chat, port, forceUPnP); changed server.startServer(port) → startServer(port, forceUPnP).
FServerManager.java — added startServer(int, Boolean forceUPnP) overload; the existing startServer(int) delegates; the original UPnP logic was moved into the else branch guarded by forceUPnP != null.

2 new files (in forge.view):

JoinMatch.java, HostMatch.java

Imports: Preserved original imports exactly. FServerManager, NetConnectUtil, CSubmenuOnlineLobby, and Main needed zero new imports (I used Boolean/fully-qualified names already in scope), so there were no additional imports to place anywhere. The two new files carry their own self-contained import blocks.

As a note I've found on my Ultramarine 44 x64 setup that each forge instance is showing 1.1GB ram usage with OpenJDK25. When I switched to OpenJ9 17 with sharedclasses mode each forge instance is using between 500 and 700MB.

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.

1 participant