Skip to content
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

Add brute force balance algo #362

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

jauggy
Copy link
Member

@jauggy jauggy commented Jul 14, 2024

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

  1. Team count must equal 2
  2. Player count must be <= 16
  3. Even number of players

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:

    score = rating_diff_penalty + broken_party_penalty

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.

1
2

In lobby if you do

$balancemode x

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.

@jauggy jauggy force-pushed the jauggy/brute-force-algo branch from 3194e6e to 345edc5 Compare July 14, 2024 11:11
Undo add combination library
@jauggy jauggy force-pushed the jauggy/brute-force-algo branch from 345edc5 to 2a13a77 Compare July 14, 2024 11:15
Fix unused imports
@jauggy
Copy link
Member Author

jauggy commented Jul 14, 2024

From my testing on integration server, the time taken for this algo on a 16 player game takes between 20-40ms. Seems longer when there is a large party.
Screenshot 2024-07-15 at 8 41 08 AM

@jauggy
Copy link
Member Author

jauggy commented Jul 18, 2024

7v7 takes 5 ms
Screenshot 2024-07-18 at 4 50 20 PM

6v6 takes 3 ms
Screenshot 2024-07-18 at 4 51 38 PM

5v5 takes 0.5 ms
Screenshot 2024-07-18 at 4 53 08 PM

@jauggy
Copy link
Member Author

jauggy commented Jul 18, 2024

Summary of how long balancer takes to complete
8v8: 20-40ms
7v7: 5ms
6v6: 3ms
5v5: 0.5ms

Based on this data, maybe I have to limit it to 7v7 or less.

@jauggy jauggy marked this pull request as ready for review August 2, 2024 11:21
@jauggy jauggy marked this pull request as draft August 5, 2024 08:27
@jauggy jauggy marked this pull request as ready for review August 6, 2024 07:01
@jauggy
Copy link
Member Author

jauggy commented Aug 6, 2024

I'm going to update this so it is restricted to moderator or tester role due to it being slow with 16 players.

@jauggy jauggy force-pushed the jauggy/brute-force-algo branch from d792c5c to 7eb9450 Compare August 6, 2024 07:47
@jauggy
Copy link
Member Author

jauggy commented Aug 6, 2024

Updated so it's no longer selectable by regular players. It exists so that it can be called by split_noobs.

@L-e-x-o-n L-e-x-o-n merged commit b5b4807 into beyond-all-reason:master Aug 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants