KitsuneLab-Development / K4-System

K4-Systems is a plugin that enhances the server with features such as a playtime tracker, statistical records, and player ranks. Additionally, it includes VIP functions and admin commands for added functionality.
GNU General Public License v3.0
104 stars 35 forks source link

[ENHANCEMENT] Team Balance Improvement? #201

Closed NotJustin closed 1 month ago

NotJustin commented 1 month ago

Describe the enhancement I was wondering if you'd make a team balance eventually. I looked at what you have and figure, in case you want a possible improvement on it, I'll link what I wrote in csgo for an idea/reference. https://github.com/NotJustin/SkillAutoBalance/blob/master/scripting/sab-ctps.sp

Problem and motivation From looking at your current implementation, you repeatedly move the "highest player" from the team that has the highest sum to the opposite team. If that player's points is higher than the max difference, and is also high enough so that the other team becomes the higher amount, it will swap this one player back and forth until you reach maxSwitches.

Suggested solution Instead, rebuild the teams from scratch. Approximate what the "best" arrangement of players could be, so that the sum of the points of players on each team is about as close to each other as you can make it after one try.

That reference I link has comments explaining, but in short, you put all the players into one list in descending order, pop the first one out and put them on one team, then pop the next player(s) out and put them on the opposite team until the other team's sum is higher, and keep going back and forth like this.

Alternatives / Additional context What you currently have is good enough to be fair. This is probably a suggestion you can ignore because ultimately, balancing teams is really really hard to do, especially automatically. The plugin I linked is one part of a plugin (skillautobalance) I made for csgo several years ago and was too lazy to try making it in counterstrikesharp.

K4ryuu commented 1 month ago

No, currently I dont update it on purpose, as I focused to do this instead when I have freetime: #183

I want to give the project my new structural and functional standards that I use in my paid plugins.

But thanks for the feedback!