feat(WG): prioritize native faction, flip only the surplus at war start#164
Merged
Nyeriah merged 1 commit intoJun 10, 2026
Merged
Conversation
The greedy per-join balance flipped players based on the live in-war counts at accept time, so a minority-faction player who accepted early could be morphed unnecessarily and (with team-lock) stay that way. Add a native-priority pass: snapshot the native split from the invited maps on the first join of a war, keep the minority faction fully native, and let the majority fill its fair share (floor(total/2)) native in accept order. Players past that share -- the latest to commit -- flip to even the sides, minimizing faction changes. Gated by CFBG.Battlefield.NativePriority.Enable (default 1); disabling it falls back to the previous greedy balance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Changes Wintergrasp cross-faction team assignment to prioritize each player's native faction and morph only the surplus needed to even the teams, instead of the previous greedy per-join balance.
The greedy logic decided each player's side from the live in-war counts at accept time, before the final population was known. A minority-faction player who happened to accept the war invite early — when their side momentarily led — could be morphed unnecessarily, and with team-lock that wrong assignment stuck for the whole war.
How it works
On the first join of a war, the native split is snapshotted from
Battlefield::GetInvitedPlayersMap(valid at that point:PlayersInWaris empty and nobody is faked yet, since core erases each accepter fromInvitedPlayersonly after the join hook). Then per join:floor(total / 2)) native in accept order; everyone past that — the latest to commit — flips to the other side.Example: 30 Alliance / 10 Horde queue → all 10 Horde stay Horde, 20 Alliance stay Alliance, the last 10 Alliance accepters are faked to Horde → 20 v 20 with the minimum number of faction changes. The old logic could also flip Horde players depending on accept timing.
It composes with the existing per-war team-lock (lock is checked first, so relogs stay stable) and resets each war via
ClearWGWarAssignments().Config
New
CFBG.Battlefield.NativePriority.Enable(default1). Set to0to fall back to the previous greedy balance.Notes
PlayersInQueueis an unordered set,InvitedPlayers'time_tis the invite-expiry set in a single tick).OnBattlefieldPlayerJoinWarhook and team-lock assignment map.🤖 Generated with Claude Code