Repository navigation
feat(gui): Add Random Armies button to game setup lobbies - #675
Closed
Amjad-Kallas wants to merge 1 commit into
Closed
Amjad-Kallas wants to merge 1 commit into
Amjad-Kallas wants to merge 1 commit into
Conversation
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.
Author
|
Just found out that was already created and merged in another PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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. AddsGetRandomSelectableArmy,RandomizeArmiesandCreateRandomArmiesButton. The button is created in code by copying the PLAY GAME button's look, so no.wndor 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.GUI:RandomArmiesandTOOLTIP:RandomArmies. If these strings are missing, the English text is shown instead.Testing
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