Repository navigation
Conversation
|
Should probably be presented differently imo, maybe as a tournament mode or something. As is it's not ideal for casual play due to host being able to re-room until they get their desired army. |
|
What are you thinking for how else it could be done? The main goal is to just skip the in-and-out. The idea was that since it just does what the game does once the match starts, you'd wait until everyone was in, hit the button, and then just play as though everyone got their factions and locations and then quit and rejoined. The host would have to either fully quit out and create a new room or set themselves to random and run again. At that point, I would think they would have just set themselves to whatever they want anyway. Happy to adjust as needed. |
Issue is that they can fill the lobby with computer slots, click random and then see how the lobby would turn out before setting everything back to "normal". Anyone who joins the lobby afterwards is none the wiser but the host has the advantage of knowing this info. |
in that case the random increment is progressed or should progress no? that way the host doesn't have information on the outcome. |
Announces each randomize to the whole lobby with a roll counter so re-rolling is visible to everyone present; the assignment itself keeps drawing from the clock-seeded CRT RNG, independent of the server-minted lobby seed that match start uses. Also clamps the start-spot tables to MAX_SLOTS, picks colors uniformly from the untaken set, null-guards the button lookups for older .wnd files, guards the auto-ready countdown reset like the other host updates, and adds the license headers and change tags.
The button text falls back to an English default when GUI:Randomize is missing from the text table, so the layout no longer depends on a .csf update.
…changed Review follow-up. Online, the lobby service owns the slots, so the roll is computed on a scratch copy of the game slots, only the slots the roll changed are sent (with the occupant's user id so the service can skip a slot that changed hands, and without the team field the roll never touches), and the announcement waits for the service to accept the update; on failure the local slots are re-synced from the lobby. Observer slots are left alone (match start resolves them), an unknown map hands out no start spots, the roll draws from a private mt19937 instead of reseeding the CRT RNG, locked generals are filtered with the same test the faction combo uses, a rolled host faction is not persisted as the preferred one, the button lookups no longer assert on older layouts, and the announcements follow the Topic: message style.
… the host Lab run: the button was disabled for the duration of the request but only re-enabled on failure, so a lobby allowed exactly one roll. It now returns to whatever state it had when the roll started, which also keeps it disabled for a guest or a stats match. The host's lobby showed a remote player's rolled colour as ???, because a slot whose colour combo is disabled is never repopulated and the new colour was missing from the stale list; the selection now rebuilds the list once and looks again. A rolled colour is no longer persisted as the host's preferred colour either, which already applied to the faction.
The lobby stored whatever the local slot happened to hold when the player left or started, so a slot the host had rolled or moved became that player's remembered preference, on guests as well as the host. The earlier guard could not work: it was cleared from the combo callback, and the service push that delivers a roll fires those callbacks exactly like a click. The repaint driven by a push is now marked as such, and only a pick made here marks the slot as chosen; nothing else is persisted.
…s apart Pass the change list by reference, pick the first start spot directly since nothing is taken yet, reset the accepted flags in the LAN caller rather than inside the roll, and drop the re-pull on a failed online roll since the scratch copy was already restored. A chosen colour no longer makes a rolled faction count as a choice, and vice versa.
That is how it works, and the update I'm pushing makes it explicit. There are two separate draws:
So filling the room with AI, pressing Randomize and setting things back teaches the host nothing about what a real random start would produce. What they get is the same thing they could get today by starting and abandoning a match, which is the in-and-out this button exists to remove. To make re-rolling visible, every press is now announced to the whole lobby as a system line, "Randomize: the host resolved the random factions, colors and start positions (roll N)". Anyone present sees the count climb. Late joiners see the current slots like any other host change; if you want the roll count visible to them too I can keep it in the lobby state so it shows on join. Online the roll is computed on a scratch copy and sent as one host action, so the service stays authoritative; the host's own client never applies it locally. GeneralsOnlineDevelopmentTeam/Services#82 Is required before the new changes will work. |
afb9942 to
695c6a3
Compare
Adds a host-only "Random" button to the LAN and Online game setup screens that assigns random factions, colors, and start positions for all players currently set to "Random" or unset values.
A common way to get random factions and start positions is the "in-and-out" method: everyone sets their faction and location to random, the host starts the game so the engine assigns them, then everyone quits, creates a new lobby, and manually sets the assigned factions and positions. This is tedious and, in online lobbies, risky since getting the same group of players back together is not guaranteed. This button lets the host resolve all random assignments directly in the lobby, removing the need for the in-and-out workaround entirely and saving considerable time since the game start, quit, and rejoin cycle is eliminated.
The randomization logic mirrors the existing
populateRandomSideAndColorandpopulateRandomStartPositionalgorithms fromGameLogic.cpp:The button is disabled for non-host players. Manually chosen factions, colors, and positions are not overwritten. Team assignments are not changed.
New files:
RandomAssign.h/RandomAssign.cpp: Shared randomization module used by both LAN and Online menusChanged files:
LanGameOptionsMenu.cpp: Hooks up the Random button for LAN lobbiesWOLGameSetupMenu.cpp: Hooks up the Random button for Online lobbiesWindow/Menus/GameSpyGameOptionsMenu.wnd: Randomize button addedWindow/Menus/LanGameOptionsMenu.wnd: Randomize button addedData/English/generals.csf: GUI:Randomize -> RANDOMIZEwnd and csf files:
https://drive.google.com/file/d/1sKVIkG2xaKD4z6PKnbosr9BV1IYMOniT/view?usp=sharing
Depends on: GeneralsOnlineDevelopmentTeam/Services#13