add autobalance to ingame lobby

Moderator: keyser

add autobalance to ingame lobby

Postby Anihilnine » 02 Nov 2019, 05:58

instead of manually balancing a game it would be cool if

1. the host would choose the team for each slot

2. the host would click an autobalance button, which moves players around between slots to get the best % game quality score. It could just brute force all permutations

bonus features:

the host could lock players to certain slots (this guy is air spot for this team)

the host could lock players together

players in the same clan start autolocked together

the program could balance the slots as well as the teams, by which i mean on setons it would make sure the middle is balanced, the air slots are balance, etc. not just that the teams are balanced. this would require some additional information to be added to each map. at the moment maps dont know which slots corrospond to which teams. maps dont know what slots corrospond to each other. someone could take the 200 most played maps and create this information. the information could also be displayed in on the map preview for easier manual balancing

Image
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Re: add autobalance to ingame lobby

Postby thecore » 15 Nov 2019, 09:39

It could just brute force all permutations

https://github.com/FAForever/fa/pull/2887

It is a work in progress, though need more skilled coders to help with it.
thecore
Crusader
 
Posts: 18
Joined: 11 Dec 2018, 04:46
Has liked: 0 time
Been liked: 0 time
FAF User Name: thecore

Re: add autobalance to ingame lobby

Postby Anihilnine » 15 Nov 2019, 12:53

isn't there already an autobalancer? if you make the teams "random" or something and hit start it autodoes it. The code is already there.

you just need to change when it runs, to be before you launch the game
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Re: add autobalance to ingame lobby

Postby Anihilnine » 15 Nov 2019, 13:40

I knocked up an algorithm that does the job without brute force. It looks solely at rating. I think it is good enough to put straight into the lobby.

How it works:
Code: Select all
Foreach player ordered by rating descending
Put them in the team with the lowest total rating (that is not full)


You can see what it does for these 12 players when put into 2, 3, 4, 6 teams...
Code: Select all
Players: 1200, 1100, 900, 900, 800, 800, 700, 700, 500, 500, 500, 300

          Team 1  Team 2
   Total    4400    4500
-----------------------------------------------------------------------------
  Slot 1    1200    1100
  Slot 2     900     900
  Slot 3     800     800
  Slot 4     700     700
  Slot 5     500     500
  Slot 6     300     500

          Team 1  Team 2  Team 3
   Total    3000    2900    3000
-----------------------------------------------------------------------------
  Slot 1    1200    1100     900
  Slot 2     800     800     900
  Slot 3     500     700     700
  Slot 4     500     300     500

          Team 1  Team 2  Team 3  Team 4
   Total    2200    2300    2200    2200
-----------------------------------------------------------------------------
  Slot 1    1200    1100     900     900
  Slot 2     700     700     800     800
  Slot 3     300     500     500     500

          Team 1  Team 2  Team 3  Team 4  Team 5  Team 6
   Total    1500    1600    1400    1400    1500    1500
-----------------------------------------------------------------------------
  Slot 1    1200    1100     900     900     800     800
  Slot 2     300     500     500     500     700     700


Here's how it handles 4 imbalanced players
Code: Select all
Players: 2000, 900, 900, 50

          Team 1  Team 2
   Total    2050    1800
-----------------------------------------------------------------------------
  Slot 1    2000     900
  Slot 2      50     900



This is 4 balanceable players

Code: Select all
Players: 2000, 1800, 1200, 1150

          Team 1  Team 2
   Total    3150    3000
-----------------------------------------------------------------------------
  Slot 1    2000    1800
  Slot 2    1150    1200



Lets do an experiment. I am about to change the rating of the 1700 player in this example.
Code: Select all
Players: 2000, 1800, 1800, 1700, 1200, 10

          Team 1  Team 2
   Total    3710    4800
-----------------------------------------------------------------------------
  Slot 1    2000    1800
  Slot 2    1700    1800
  Slot 3      10    1200



When he is 1600 it forces the 1200 and 10 to swap teams
Code: Select all
Players: 2000, 1800, 1800, 1600, 1200, 10

          Team 1  Team 2
   Total    4800    3610
-----------------------------------------------------------------------------
  Slot 1    2000    1800
  Slot 2    1600    1800
  Slot 3    1200      10



When he is 100 there is no further rffect
Code: Select all
Players: 2000, 1800, 1800, 1200, 100, 10

          Team 1  Team 2
   Total    3300    3610
-----------------------------------------------------------------------------
  Slot 1    2000    1800
  Slot 2    1200    1800
  Slot 3     100      10



So the player is considered "balanced with 2000 and 1200 against 1800 1800 10" until the player is 1700. Once he hits that threshold the teams are all rejigged so the player is no longer with the 1200. At that point it is more balanced for him to be with 2000 and 10

Here is my C# script which should be renamed to "auto faf teams.linq" then opened in linqpad
Attachments
auto faf teams.txt
(3.32 KiB) Downloaded 11 times
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Re: add autobalance to ingame lobby

Postby Anihilnine » 15 Nov 2019, 13:50

real world examples show its not perfect

Image

Image

Image
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Re: add autobalance to ingame lobby

Postby thecore » 15 Nov 2019, 14:03

You use Trueskill.computeQuality(teams) to get the quality.

The issue with brute force is it can only really be used for about 10 payers MAX or else it takes too long.

Brute force finds the perfect balance as it goes through all combination. However more than 10 players and it is too slow.

So what would be better is use the Brute force method for up to 8 players and this method for more than 8 players

Update:
you cannot calculate on just rating, e.g.
Player 1
ratting 700
Games player 1000

Player 2 800
Games player 5

Player 1 could be the better player
thecore
Crusader
 
Posts: 18
Joined: 11 Dec 2018, 04:46
Has liked: 0 time
Been liked: 0 time
FAF User Name: thecore

Re: add autobalance to ingame lobby

Postby Anihilnine » 15 Nov 2019, 14:09

That is true but for me acceptable.
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Re: add autobalance to ingame lobby

Postby thecore » 15 Nov 2019, 14:15

It is much better then what we have at the moment. Just use Trueskill instead of rating and we should be good to go. We can play around with the brute force method at a later time.
thecore
Crusader
 
Posts: 18
Joined: 11 Dec 2018, 04:46
Has liked: 0 time
Been liked: 0 time
FAF User Name: thecore

Re: add autobalance to ingame lobby

Postby keyser » 15 Nov 2019, 14:20

do you take deviation into account at any extend ?
Zockyzock:
VoR is the clan of upcoming top players now
keyser
Site Admin
 
Posts: 1756
Joined: 17 May 2013, 14:27
Has liked: 412 times
Been liked: 497 times
FAF User Name: keyser

Re: add autobalance to ingame lobby

Postby Anihilnine » 15 Nov 2019, 14:23

my belief is the true skill scoring method does that
Anihilnine
Moderator
 
Posts: 2310
Joined: 16 Apr 2013, 10:10
Has liked: 275 times
Been liked: 409 times
FAF User Name: Anihilnine

Next

Return to FAF Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest