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.
Context
Many people want a balance algorithm that keeps parties together more often. This algorithm goes through every possible combination and picks the best combination. The original idea was from Suuwassea here: https://discord.com/channels/549281623154229250/855772061095559179/1235344149713260584
Conditions the algorithm will run
If any of these conditions aren't met, the default balancer will be called instead
Scoring each combination
Each combination will be given a score as follows:
rating_diff_penalty is just the difference in team ratings
broken_party_penalty is the number of broken parties * broken_party_multiplier
broken_party_multiplier = 3
Pick the combination that scores the lowest.
Test Steps
Go to to any match on integration server. Preferably find one where parties got split e.g.
https://server5.beyondallreason.info/battle/2092529/players
You can see the parties as they are represented by same coloured dice in the player list. In this case kyutoryu and fbots1998 got split.
Go to balance tab and check brute_force algo. You should see broken party penalty of 0 meaning parties weren't split.
In lobby if you do
It will give you a warning and tell you the allowed balance algo. brute_force will not be listed as I have restricted it to mod only.