Repository navigation
Conversation
…m cap BackfillSlotsForTeam now fills toward MaxPlayersPerTeam — the retail behavior: an in-progress battleground keeps accepting joiners while a team is below the cap. The old cap at the opposite team's headcount made a balanced match mathematically unable to grow: a player queuing against a balanced 6v6 could never enter, and a match could never reach 10v10. Arenas are unaffected (min == max).
There was a problem hiding this comment.
🟢 Approval recommended
The logic change is small and cohesive, and the accompanying tests were updated to cover the new retail-aligned backfill behavior.
Pull request overview
This PR updates battleground backfill logic so running battlegrounds can continue to accept queued players up to MaxPlayersPerTeam (instead of being capped by the opposite team’s current headcount), matching retail behavior and allowing balanced in-progress matches to grow to full team caps.
Changes:
- Adjust
BackfillSlotsForTeamto targetMaxPlayersPerTeamregardless of current team balance. - Update battleground queue tests to assert groups backfill into an in-progress battleground instead of staying queued.
- Update battleground backfill unit tests to reflect the new “fill toward max” behavior and invited-player accounting.
File summaries
| File | Description |
|---|---|
| apps/matchmakingserver/service/battleground-queue_test.go | Updates queue tests to expect backfill into in-progress battlegrounds toward team cap. |
| apps/matchmakingserver/battleground/battleground.go | Changes backfill slot calculation to be based on MaxPlayersPerTeam only. |
| apps/matchmakingserver/battleground/battleground_test.go | Updates unit tests for backfill semantics and invited-player slot handling under the new rules. |
Review details
Suppressed comments (1)
apps/matchmakingserver/battleground/battleground.go:114
- BackfillSlotsForTeam now computes the exact same value as FreeSlotsForTeam (max minus active+invited). Keeping two implementations for the same logic risks them drifting over time; consider delegating BackfillSlotsForTeam to FreeSlotsForTeam to keep behavior consistent in one place.
// BackfillSlotsForTeam returns how many players the team can accept from the
// queue: up to MaxPlayersPerTeam, the retail behavior — a battleground in
// progress keeps accepting joiners while a team is below the cap, regardless
// of the balance (joining a losing match is allowed on retail too).
func (b *Battleground) BackfillSlotsForTeam(team PVPTeam) uint8 {
teamCount := len(b.ActivePlayersPerTeam[team]) + len(b.InvitedPlayersPerTeam[team])
r := int(b.MaxPlayersPerTeam) - teamCount
if r < 0 {
return 0
}
return uint8(r)
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+155
to
+156
| invited := false | ||
| mockService.On("InviteGroups", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Run(func(mock.Arguments) { invited = true }).Return(nil) |
Review follow-up: assert exactly one InviteGroups call, for the queued group's team, carrying exactly the one queued group - instead of a boolean that would also pass on duplicate or mistargeted invites.
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.
BackfillSlotsForTeam capped invites at the opposite team's headcount, so a balanced in-progress match was mathematically unable to grow: someone queuing against a balanced 6v6 could never enter, and a battleground could never reach 10v10 through backfill.
Retail keeps accepting joiners while a team is below MaxPlayersPerTeam, so the target is now the team cap. Arenas are unaffected since their min equals max. Existing tests adjusted to the retail expectation; verified live (a running WSG grows to full through the queue).