-
Notifications
You must be signed in to change notification settings - Fork 9
Fix/loadout handling #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/loadout handling #248
Conversation
The matchmaker creates balanced teams using array position: - Indices [0:teamSize] = Blue team - Indices [teamSize:] = Orange team The buildMatch function was using i/teamSize to re-split players, which broke team assignments when array order changed, causing 5v0 scenarios. Fixed by: - Using array slicing to preserve matchmaker's team assignments - Adding validation to ensure even entrant count - Removing naive i/teamSize calculation - Added clarifying comments about team assignment contract
Tests verify: - Even split validation (rejects odd numbers) - Matchmaker ordering preservation (first half = team 0, second half = team 1) - Party cohesion across teams - No team reassignment using buggy i/teamSize approach - Correct team index assignment to EntrantPresenceFromSession - Performance benchmarks for slicing vs loop approach These tests ensure the fix prevents 5v0 scenarios by validating that the lobby builder preserves the matchmaker's balanced team assignments.
The backfill logic had issues when selecting teams: 1. When teams were equal size, it only considered blue team 2. The fallback logic only triggered when NO teams were added 3. This could lead to consistently filling one team first Fixed by: - Use strict < comparison instead of <= to identify smaller team - When teams are equal, consider BOTH teams for better match quality - Fallback only triggers when smaller team is full - Add comprehensive tests for all team balance scenarios This prevents backfill from creating unbalanced teams (e.g., 5v1, 4v0) and ensures the scoring function can choose the best team assignment when teams are balanced.
Signed-off-by: Andrew Bates <a@sprock.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces comprehensive support for game server-initiated loadout save requests and improves team balancing logic in the matchmaker backfill system. The changes enable players' cosmetic customizations to be persisted when updated from the game server, and ensures more balanced team assignments during match backfilling.
- Adds new
GameServerSaveLoadoutRequestmessage type and complete handling pipeline for loadout persistence - Refines matchmaker backfill logic to prioritize smaller teams and handle equal team scenarios more intelligently
- Includes comprehensive test coverage for team assignment and backfill balancing behavior
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/evr/gameserver_save_loadout.go | Defines the new GameServerSaveLoadoutRequest message structure with binary encoding/decoding support |
| server/evr/core_packet_types.go | Registers the new loadout message type in the message factory |
| server/evr/core_hash_lookup.go | Adds symbol cache entry for the loadout request message type |
| server/evr_pipeline_gameserver_loadout.go | Implements handler for processing loadout save requests including user lookup, profile updates, and error handling |
| server/evr_pipeline.go | Integrates loadout handler into the main EVR pipeline message processing flow |
| server/evr_lobby_builder.go | Replaces loop-based team splitting with array slicing to preserve matchmaker-determined team assignments |
| server/evr_lobby_backfill.go | Refines team selection logic to prioritize smaller teams with fallback handling |
| server/evr_lobby_builder_team_assignment_test.go | Adds comprehensive tests for team assignment logic with benchmarks |
| server/evr_lobby_backfill_team_balance_test.go | Adds tests verifying team balancing behavior in various scenarios |
This pull request introduces two major improvements: it adds support for handling loadout save requests sent from the game server, and it refines the team balancing logic in the matchmaker backfill process. The changes include new message types, message handling, robust processing and updating of player loadouts, as well as improved and thoroughly tested logic for assigning parties to teams to maintain match balance.
Game server loadout save support:
GameServerSaveLoadoutRequestto represent loadout updates sent from the game server, including parsing and streaming logic inserver/evr/gameserver_save_loadout.go.core_hash_lookup.go,core_packet_types.go). [1] [2]GameServerSaveLoadoutRequestin the pipeline, including robust parsing, user lookup, profile updating, and error handling inserver/evr_pipeline_gameserver_loadout.goand the main pipeline logic (evr_pipeline.go). [1] [2]Matchmaker team balancing improvements:
evr_lobby_backfill.go).evr_lobby_backfill_team_balance_test.go).evr_lobby_builder.go).