A player's performance is primarily determined by the rate at which they can get kills. We measure this rate in terms of kills per round, and then extrapolate these rates over the next n rounds to determine how strong a particular team is.
This balancer searches every possible combination of player swaps, and evaluates every possible player move. Out of these combinations, it selects the optimal choice of swap or move, and performs it.
This means that your teams have excellent balance; please give this addon a try; we think you will be very pleased with the quality of team balance you will experience.
The design of the balancer is to be as unobtrusive as possible, only balancing when needed, and being smart about the balancing such that it is not needed very often.
The overall approach is this:
- stats are accumulated for each player, so that the player kill rate (kills per round) can be calculated. These stats reflect the current performance of the player.
- every n rounds, a set of merit scores are calculated, for every possible swap of a T/CT, and for every possible move of a T or CT to the other team,
subject to a set of reasonable constraints:
1) if we move a player, we cannot throw the numerical balance too far out of alignment,
2) if a player has already been swapped, they cannot be swapped again
3) if a player is alive and the script is not configured to allow live player swaps, the player cannot participate in a swap.
- smart management of when to balance: sometimes, the balancer will detect that an exceptional condition exists...either the team numbers OR the team strengths are too far out of balance. If an off-schedule balance occurs, the next regularly scheduled balance may be skipped. Balances are also skipped if the balancer determines that the team strengths are already acceptable, or if there are no player trades or moves that will help the overall situation.
- player immunity: No one likes to be swapped over and over. Once a player is swapped, that player is immune from being swapped for the rest of the map or for 30 rounds (configurable), whatever comes first.
- Persistent storage Player killrates are stored in a database; so when that player connects again, the balancer already has a good prediction of his/her performance.
- live player swaps/moves user can select whether or not live players can be moved/swapped. If you are running mani admin, live player swaps do not cause a player death; so allowing live player swaps is highly recommended. However, if you are not running mani, a player swap will cause a death, in which case disallowing live player swaps is recommended. Also on the topic of live players swaps: if a live player is swapped, all live players are temporarily health-boosted in order to prevent cheap end-of-round kills.
- fast performance The heavy calculations involved are deferred until a second or so after round end, so that no lag occurs; in practice, the calculations have been unnoticable on a 24-player full server. Also, database writes (for the tracking of player killrates) is deferred until map change, where it occurs without any impact at all on your gaming experience.
- global player immunity If there are particular players that you want to disallow any team swapping for, just list their steam ID's; the team balancer will then ignore them.
Many thanks goes to [cC]Sparty, who came up with the original concept of this balancer and explained it in this post
. Thanks also to the rest of the [cC] guys at cans-crew.com
who have provided valuable feedback and been very patient and helpful throughout the testing process.