Freon: New team balancer code running on the server  (Read 6226 times)

Piglet

  • 1337
  • *
  • Posts: 3169
  • Country: gb
Freon: New team balancer code running on the server
« on: November 13, 2021, 12:35 »
There's new code for team balancing on the server.

The original code seemed over-complex, and we were seeing the old code would occasionally swap players which resulted in a worse balance than before the swaps took place.

People have been complaining about this, so I've written new "pick the best pair of players to swap" code from scratch.

The new code works out the difference between the total current "adjusted" PPR's on each team, the picks the two players which when swapped will result in the team total "adjusted" PPR's being the same.

I may add some more logic to check whether a single player swap from a smaller to a larger team would be "better" - if I can clearly identify what "better" means in this case.

The server is only saving PPR's for games when there are more than 12 players, as we found that players who play during the day with a few players are getting artifically low ranking when then playing in the evening. It may be possible to do something to log PPR-at-player-count in the future.

If you're interested in looking at the code, all the code for Freon is in the package:

The balancing algorithm is here: Team_GameBase::BalanceBestPair

Adjusted PPR is is calculated here: Team_GameBase::GetPlayerAutoBalancingPPR_from_PRI - PPR is averaged over the last 30 maps that qualify. The current weighting is 70% of (average of last 30 maps) and 30% your current PPR in the game currently being played, once that stabilises


Swapping is triggered by a high PPR player joining or leaving, or by an admin forcing a re-evaluation.


If you see the wrong players getting swapped, please note the date and time and post it here (in UK time please) together with the map name you saw it happen on.

I currently have debug logging of every assessment made so I will be able to check what was done and see what happened.

I've simulated the strategy used in a spreadsheet which you can download here to try it out. You can plug in PPRs for two teams and see which two players would get swapped. It will also tell you where no swap is possible.

« Last Edit: November 13, 2021, 12:37 by Piglet »

Miauz55555

  • Full MemberĀ 
  • *
  • Posts: 66
  • Country: 00
Re: Freon: New team balancer code running on the server
« Reply #1 on: November 13, 2021, 22:56 »
Would it be possible to turn it off when a team hits nine points? So from eight points up.

Piglet

  • 1337
  • *
  • Posts: 3169
  • Country: gb
Re: Freon: New team balancer code running on the server
« Reply #2 on: November 14, 2021, 10:52 »
When a 12ppr person joins the team with 9 points and the other team has no points, and the team with 0 points wins the round as the 12 point player is waiting to join...at the start of the 9-1 round the teams stay as they are including the 12ppr player on the team with 9?

holyspam

  • 1337
  • *
  • Posts: 329
  • Country: gr
Re: Freon: New team balancer code running on the server
« Reply #3 on: November 14, 2021, 14:03 »
When a 12ppr person joins the team with 9 points and the other team has no points, and the team with 0 points wins the round as the 12 point player is waiting to join...at the start of the 9-1 round the teams stay as they are including the 12ppr player on the team with 9?
If they couldn't land a single round then either
1. The balancer is completely broken or
2. They deserve a humiliating defeat :P

Would it be possible to turn it off when a team hits nine points? So from eight points up.
That's why it gets triggered only when a high PPR player joining, only when it's needed.
« Last Edit: November 14, 2021, 14:04 by holyspam »

Piglet

  • 1337
  • *
  • Posts: 3169
  • Country: gb
Re: Freon: New team balancer code running on the server
« Reply #4 on: November 14, 2021, 15:29 »
In the scenario I outlined a low-ppr player from the team with 1 point would be swapped with a high PPR player (possibly the new 12ppr player) - and have a good chance of getting a few...or more.. points with that player

Miauz55555

  • Full MemberĀ 
  • *
  • Posts: 66
  • Country: 00
Re: Freon: New team balancer code running on the server
« Reply #5 on: November 14, 2021, 19:04 »
On a 9-0 the ballancer would definitly put the new 12 ppr player on the team with 9 points. May also swap the highest ranked player from the 0 team against a player in the mid from the 9 team. =D

How about uneven numbers?

Piglet

  • 1337
  • *
  • Posts: 3169
  • Country: gb
Re: Freon: New team balancer code running on the server
« Reply #6 on: November 14, 2021, 20:19 »

I may add some more logic to check whether a single player swap from a smaller to a larger team would be "better" - if I can clearly identify what "better" means in this case.


Stealer

  • 1337
  • *
  • Posts: 277
  • Country: gb
    • 76561197992159424
    • StealerNinja
Re: Freon: New team balancer code running on the server
« Reply #7 on: November 15, 2021, 23:37 »
Seems pretty even to me. We had a match earlier that had teams at 4.5 and 5.3 Team average, or something like that, was very even, it worked ut 10-9 I think. Some tend to kill/spam more and others tend to go for thaws; it's a very tricky thing to balance!
Respect sir, seems good :)
I do have free time at the weekends if you want me to take a look at the code - I doubt I could improve the code but happy to bang heads/ideas/intellects :)

One thing I'm not quite sure about though: when someone shouts "teams" is that a command for the autobalancer or is that something that requires players to manually switch? I just leave it to the auto balancer myself. Sorry if I have misunderstood and are supposed to switch (my ppr is generally pretty low so I shouldn't make that much of a difference  :'( ::)
« Last Edit: November 16, 2021, 22:50 by Stealer »
Stealer.T32