Skip to content

feat(gui): Add Random Armies button to game setup lobbies - #675

Closed
Amjad-Kallas wants to merge 1 commit into
GeneralsOnlineDevelopmentTeam:mainfrom
Amjad-Kallas:go/random-armies-button
Closed

Amjad-Kallas wants to merge 1 commit into
GeneralsOnlineDevelopmentTeam:mainfrom
Amjad-Kallas:go/random-armies-button

Conversation

@Amjad-Kallas

@Amjad-Kallas Amjad-Kallas commented Nov 20, 2026 •

Copy link
Copy Markdown

This change adds a RANDOM ARMIES button to the Skirmish, LAN and Online game setup screens. It sits between the PLAY GAME and back buttons, matches their style and height, and is slightly narrower.

Why

Many players, especially in 1v1, want random armies, but they also want both players to know the armies before the match starts. Today the only way is a workaround: start a match with Random, look at the armies, quit, then host a new lobby with those armies set by hand. This button replaces that workaround. The armies are rolled randomly in the lobby, everyone can see them, and the match starts normally.

What it does

  • Each player's army is picked independently, at random, from the armies their army combo box allows (same filters as the combo box). Two players can get the same army.
  • Observers and empty slots are skipped.
  • The button can be used once per lobby. After a click it is disabled. A new lobby enables it again.
  • The button is hidden while the map select screen is open.

Who rolls what

  • Skirmish and LAN: the host rolls the armies of all players and AI. On LAN, only the host sees the button, and the new armies are sent to everyone like any other host option change, which also resets the accepted state.

  • Online (GeneralsOnline lobby): every player rolls their own army, and the host also rolls the AI armies. That's because the lobby service only lets each player change their own side (UpdateCurrentLobby_MySide), and lets the host change AI sides only (UpdateCurrentLobby_AISide). No call lets the host set another human's army. The button goes through the same path as picking an army from the combo box (handlePlayerTemplateSelection), so the result syncs to everyone as usual.

    If you'd prefer the host to roll every player's army online too, the server would need a call to set another player's side. The client side would then only need a small change.

Changes

  • GUIUtil.cpp/.h: moves the army combo box filtering into a shared helper. Adds GetRandomSelectableArmy, RandomizeArmies and CreateRandomArmiesButton. The button is created in code by copying the PLAY GAME button's look, so no .wnd or art changes are needed.
  • SkirmishGameOptionsMenu.cpp, LanGameOptionsMenu.cpp, WOLGameSetupMenu.cpp: create the button and handle the click.
  • SkirmishMapSelectMenu.cpp, LanMapSelectMenu.cpp, WOLMapSelectMenu.cpp: hide the button during map select.
  • The change is done for Zero Hour and repeated for Generals.
  • Button text and tooltip use GUI:RandomArmies and TOOLTIP:RandomArmies. If these strings are missing, the English text is shown instead.

Testing

  • Skirmish tested in game with a build of this change: the button shows in the right place, rolls the armies, and can't be clicked again in the same lobby.
  • This branch compiles in CI (GeneralsMD win32-vcpkg release, profile and debug).
  • Not tested: the online lobby, because a custom build can't connect to the live service. Please check this part before merging.

AI disclosure

This code was written with an AI assistant (Claude Code). I decided how the feature works and how the button looks, reviewed it through UI mockups, and tested it in game in Skirmish. The online lobby path hasn't been tested in game.

🤖 Generated with Claude Code

Screenshots

image image

Adds a "Random Armies" button between the Start and Back buttons of the
Skirmish, LAN and Online game setup screens. It gives players a random army
from the armies selectable in the army combo box, and the result is visible
to everyone in the lobby before the match starts. The button can be used
once per lobby.

In Skirmish and LAN the host rolls the armies of all players. In the
GeneralsOnline lobby the service only lets each player change their own army
(and the host the AI armies), so every player rolls their own army there.
@Amjad-Kallas

Copy link
Copy Markdown
Author

Just found out that was already created and merged in another PR

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