AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   CS:S Team Balance (https://forums.alliedmods.net/showthread.php?t=59234)

dalto 08-10-2007 11:35

CS:S Team Balance
 
2 Attachment(s)
CS:S Team Balance

Current Version: 2.2.2

Description:
This is an advanced team balancer for Counter Strike:Source. I built this after trying a lot of team balancers and none of them really meeting my team balancing needs. It has the following features.
  • Uses separate algorithms for determining team imbalances and for restructuring teams.
  • Supports servers of all sizes. The balancing is based on the number of players.
  • Tracks long term kdr in a sqllite or mysql database.
  • Team balancing parameters are controllable through CVAR's
  • All text announcements are configurable and can are available for translations.
  • Includes a command to display it's internal statistics !tbstats
  • Has a team management menu sm_team_menu or !team_menu
Planned Features:
  • None, make a request!
CVar's:
For full descriptions of the CVAR's check the cfg/sm_teambalance.cfg file

Commands:
!tbmenu: Opens the team management menu(admin only)
!tbstats: Displays the internal stats of the plugin
!tbswitchnow: Switches a player to the other team(admin only)
!tbswitchatstart: Switches a player at the beginning of the next round(admin only)
!tbdump: Dumps the team balance settings(admin only)
!tbset: Sets a players stats(admin only)
!tbswap: Swaps the teams(admin only)

Special Thanks:
Extreme One, Teknigal: For their assistance with testing and debugging

Changelog:
2.2.2: Fixed admin immunity, updated tbdump spelling
2.2: Cfg autoloaded, admin flags support, lock teams, stop spec
2.1.3: Fixed another bug with admin immunity
2.1.2: Fixed a bug with admin immunity
2.1.1: Added better navigation to tbstats
2.1: Renamed commands, fixed player switch bug, added switch next round
2.0: Too numerous to list, see the announce below or the source file
1.1: Added team management menu, stats command
1.0: bug fixes, changed ROUNDS_TO_SAVE to 6, added join control
0.9: fixed big winning team problem, added support maintain size, added green text
0.8: Added more SQL error handling, added sm_teamswitch and sm_swapteam
0.7: Switched to threaded SQL calls, added german and russian translations
0.6: Added more flexible announcement preferences and changed defaults
0.5: Initial Release

Languages supported:

English
German courtesy of -<[PAGC]>- Isias
Russian courtesy of Exvel

Installation Notes:

Copy ALL the files to the root mod directory of your server. Edit cfg/sourcemod/sm_teambalance.cfg to suit your needs. Thats it!

J@y-R 08-10-2007 12:35

Re: SM CS:S Team Balance
 
!!!! mp_autoteambalance 1 !!!!!

or is this a Source Version from PTB's Team Balancer from CS 1.6 ???

Extreme_One 08-10-2007 12:37

Re: SM CS:S Team Balance
 
Awesome plugin.

The best team Balancer I've seen by far.

Thank you dalto

dalto 08-10-2007 12:43

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by J@y-R (Post 515882)
!!!! mp_autoteambalance 1 !!!!!

or is this a Source Version from PTB's Team Balancer from CS 1.6 ???

Neither.

mp_autoteambalance is not terribly useful. It seems to just keep the teams the same size.

This is a skill based team balancer based on my own experiences of trying to keep teams balanced on a recreational server.

Tekniqal 08-11-2007 02:47

Re: SM CS:S Team Balance
 
cool imma install this and give it a try, ill post back

Isias 08-11-2007 12:47

Re: SM CS:S Team Balance
 
1 Attachment(s)
German Translation

dalto 08-11-2007 12:49

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by -<[PAGC]>- Isias (Post 516457)
German Translation

Thanks!

Extreme_One 08-11-2007 15:49

Re: SM CS:S Team Balance
 
We're noticing some small game pauses when players (and even BOTs) leave the game and I *think* (guessing) this could be due to data being written to the database.

If this is the case is there any chance that this could somehow be cached until round end or map change?

dalto 08-11-2007 16:37

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by Extreme_One (Post 516532)
If this is the case is there any chance that this could somehow be cached until round end or map change?

I can.

Extreme_One 08-11-2007 23:49

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by dalto (Post 516557)
I can.

cool.

How about not writing data about BOTs to the database?
Can you ignore them altogether (in the database) whilst still maintaining Team Balancing when BOTs are active?

dalto 08-11-2007 23:52

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by Extreme_One (Post 516721)
cool.

How about not writing data about BOTs to the database?
Can you ignore them altogether (in the database) whilst still maintaining Team Balancing when BOTs are active?

I can add that as an option. That is what it used to do but I was having problems with the bots. Probably only an issue on extremely small servers.

Extreme_One 08-12-2007 00:10

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by dalto (Post 516722)
I can add that as an option. That is what it used to do but I was having problems with the bots. Probably only an issue on extremely small servers.

OK cool.

It's just that we noticed the freezing when a BOT left as well as when a human player left and I noticed that data for the BOTs was also being written to the database.

Whatever it takes to stop the freezing and maintain the integrity of the Team Balancing algorithm.

pRED* 08-12-2007 00:50

Re: SM CS:S Team Balance
 
Dalto you should use the threaded sql natives. Would get rid of the pauses.

dalto 08-12-2007 00:51

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by pRED* | NZ (Post 516746)
Dalto you should use the threaded sql natives. Would get rid of the pauses.

Thanks, I will take a look at it.

exvel 08-12-2007 02:01

Re: SM CS:S Team Balance
 
1 Attachment(s)
Russian translation

Shadowdogg 08-12-2007 14:16

Re: SM CS:S Team Balance
 
Whats this about pausing? I can't have distrubtions on our server.

dalto 08-12-2007 20:24

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by Shadowdogg (Post 517019)
Whats this about pausing? I can't have distrubtions on our server.

Some people are seeing small pauses when people leave. I have made some changes which I believe will fix the problem. It is in testing now.

As soon as I am comfortable it has been tested I will release it.

The team balancer is a lot more complicated than any of my other plugins and I like to run it for at least a couple days to make sure we have an adequate test.

[Arnold] 08-13-2007 02:46

Re: SM CS:S Team Balance
 
Thanks for your plugin, it made a good job at first sight, especially considering it's early stage! Could you perhaps post some details on the algorithm you used?

dalto 08-13-2007 12:33

Re: SM CS:S Team Balance
 
Motivation:
My motivation for doing this was that I had tried several team balancers and none of them were doing a very good job balancing the teams. As I run a small recreational server this was very frustrating.


As I started to look at why this was I realized that it was primarily because a few key reasons.
  • Some team balancers look at team strength to determine if the teams should be balanced. This means that there were cases where it was deciding the losing team was too strong and taking away key players.
  • The balancing algorithms were often looking at things like the real delta between kills and deaths or just the total number of kills. When players join mid-round these stats can be misleading.
  • The most critical problem that seemed to plague almost all team balancers was that they were looking at round statistics to evaluate player strength. Unless you have exceptionally long rounds with a fairly stable player base, this just does not work.
It was this which motivated me to get into Sourcemod scripting in the first place. I knew that a team balancer was not a good first project though so I did some other things first.


Vision:
With a couple of plugins under my belt I began working on the team balancer. Taking from the above, there were three principles which guided my development.
  • I decided that the evaluation of determining when the teams should be balanced would be based on short term team performance rather than strength. Balancing on performance means that we take strong players away from the team who wins too much regardless of the existing team strength.
  • I decided to use the kill/death ratio (kdr) as the primary measure of player strength.
  • Most importantly, I decided to track long-term kdr. This gives me a longer-term view of player strength.
There are two main components of the team balancer. They are the evaluation algorithm which determines when the teams should be balanced and the balancer which moves the players around. Of the two, the evaluation algorithm is far simpler than the balancer.


Evaluation:
As discussed above the evaluation algorithm is performance based. The evaluation function can return three possible states. Balanced, Pending or Unbalanced. There are three CVAR’s that control evaluation.
  • sm_team_balance_min_rounds is the number of rounds a map will run before balancing starts. This is because the first couple of rounds are often not a good indicator of performance because of the pistol round and people joining late.
  • sm_team_balance_new_join_rounds is the number of rounds to wait before balancing when a new player joins the losing team. This allows us to account for recent changes and ensures that we don’t balance too often.
  • sm_team_balance_consecutive_wins is the number of straight wins required to immediately declare the teams unbalanced.
  • sm_team_balance_wlr is the win/loss ratio needed to declare the teams unbalanced. It is computed by dividing the losing team’s wins by the winning team’s wins.
Using the above, the evaluation algorithm does the following.
  1. Checks to see if the current round is less than the minimum number or rounds. If it is the balance is Pending.
  2. Checks to see if a player has joined the losing team in new_join_rounds rounds. If one has, the balance is Pending.
  3. Check to see if the winning team has won at least consecutive_wins times. If they have the teams are Unbalanced.
  4. Check to see if the win/loss ratio of the losing team is less than wlr. If it is then the teams are Unbalanced.
  5. If none of the above are true than the teams are considered balanced.
As you can see, the evaluation algorithm prioritizes pending conditions over unbalancing conditions.



The Balancer:
Coming soon....

dalto 08-13-2007 12:35

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by [Arnold] (Post 517343)
Thanks for your plugin, it made a good job at first sight, especially considering it's early stage! Could you perhaps post some details on the algorithm you used?

Thanks, it should get better as it builds up kdr statistics for your regular players.

I started to post some details above. I will keep working on it.

tcviper 08-13-2007 13:30

Re: SM CS:S Team Balance
 
Try adding immunity for admins ;)

dalto 08-13-2007 13:32

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by tcviper (Post 517552)
Try adding immunity for admins ;)

You don't like getting team switched, eh?

Extreme_One 08-13-2007 13:39

Re: SM CS:S Team Balance
 
I sincerely hope if you do give admin immunity you add a custom flag.

If you just use the generic "a" flag you will (IMO) ruin this plugin.

dalto 08-13-2007 13:43

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by Extreme_One (Post 517558)
I sincerely hope if you do give admin immunity you add a custom flag.

If you just use the generic "a" flag you will (IMO) ruin this plugin.

I agree, it needs to be very optional.

Lindgren 08-13-2007 16:33

Re: SM CS:S Team Balance
 
Great plugin! Any chance you could add a optional delay for the teamswitch? Ie so the players get switched 0.5 seconds after round_end event fires so events like autoslay can do there job before the new player join the team.
Or possibly a movedeadonly option. that never move alive players. First alternative would be best though.

dalto 08-13-2007 16:46

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by Lindgren (Post 517615)
Great plugin! Any chance you could add a optional delay for the teamswitch? Ie so the players get switched 0.5 seconds after round_end event fires so events like autoslay can do there job before the new player join the team.
Or possibly a movedeadonly option. that never move alive players. First alternative would be best though.

The teamswitch happens at round_start. Any round_end events should work fine.

GyroTarzan 08-13-2007 18:52

Re: SM CS:S Team Balance
 
Do you have any plans to make this plugin work for DOD:s ?

dalto 08-13-2007 18:55

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by GyroTarzan (Post 517671)
Do you have any plans to make this plugin work for DOD:s ?

It could be made to work on DOD:S, but it would be a LOT of work. I would want to make sure there was a good amount of demand for it.

I would also need to talk through with someone how the evaluation function should work. The current one would not be suitable for DOD:S.

dalto 08-14-2007 00:37

Re: SM CS:S Team Balance
 
New release: Version 0.7

Changes:
* Added checks of relative strength prior to switching
* Removed the insert statement on player join
* Made the SQL calls threaded
* Added german translation courtesy of -<[PAGC]>- Isias
* Added russian translation courtesy of exvel

tcviper 08-14-2007 04:50

Re: SM CS:S Team Balance
 
Ofcourse not dalto i wanna be immune :P

dubbeh 08-14-2007 05:24

Re: SM CS:S Team Balance
 
Really nice plugin dalto

Should get it running for CSS:DM & give users a much more intelligent balancer - the only thing i intended with mine was having a working mp_autoteambalance for dm :wink:

[Arnold] 08-14-2007 08:38

Re: SM CS:S Team Balance
 
L 08/14/2007 - 14:36:30: [SM] Plugin encountered error 4: Invalid parameter or parameter type
L 08/14/2007 - 14:36:30: [SM] Native "PrintToChat" reported: Language phrase "unbalanceable" not found
L 08/14/2007 - 14:36:30: [SM] Debug mode is not enabled for "teambalance.smx"
L 08/14/2007 - 14:36:30: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 10 on

Arnold 8)

dalto 08-14-2007 10:16

Re: SM CS:S Team Balance
 
1 Attachment(s)
Quote:

Originally Posted by [Arnold] (Post 517906)
L 08/14/2007 - 14:36:30: [SM] Plugin encountered error 4: Invalid parameter or parameter type
L 08/14/2007 - 14:36:30: [SM] Native "PrintToChat" reported: Language phrase "unbalanceable" not found
L 08/14/2007 - 14:36:30: [SM] Debug mode is not enabled for "teambalance.smx"
L 08/14/2007 - 14:36:30: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 10 on

Arnold 8)

Oops, I forgot to update the translations file.

Attached is a working copy.

Isias 08-14-2007 12:20

Re: SM CS:S Team Balance
 
Translation (german)
Code:

        "unbalanceable"

        {

                "en"                "The teams cannot be balanced"
                "de"            "Die Teams konnten nicht ausgeglichen werden"

        }


dalto 08-14-2007 12:25

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by -<[PAGC]>- Isias (Post 517981)
Translation (german)

Thanks again Isias

rishi211 08-14-2007 18:08

Re: SM CS:S Team Balance
 
Does the plugin currently move alive players if needed (and if it does, does it kill them?)

dalto 08-14-2007 18:10

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by rishi211 (Post 518204)
Does the plugin currently move alive players if needed (and if it does, does it kill them?)

Yes, it moves alive players. No, it does not kill them.

rishi211 08-14-2007 18:20

Re: SM CS:S Team Balance
 
Great thanks, just added it to my server. thanks for the quick response!

dalto 08-14-2007 18:26

Re: SM CS:S Team Balance
 
Quote:

Originally Posted by rishi211 (Post 518211)
Great thanks, just added it to my server. thanks for the quick response!

No problem, let me know how it works for you.

Tekniqal 08-14-2007 20:49

Re: SM CS:S Team Balance
 
One thing that I sort of think needs to be done is somehow make the plugin a little 'smarter' when the server has 4 or less players. I was playing 2v2 for a while today and noticed it kept swapping players. The teams weren't gonna be even no matter what it did because there was one really good player. I think sometimes it just needs to make the best swap and then leave it be.


All times are GMT -4. The time now is 13:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.