Author Topic: Team Balancer  (Read 4148 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Team Balancer
« on: April 18, 2008, 04:00:29 pm »
Script Name: Team Balancer
Script Description: Balances teams
Original Author: Curt
Core Version: 2.6.3

Features:
  • Team ratios; Ex: Setting alpha and bravo to 1, everything else to 0 will force people to be evenly distributed between Alpha and Bravo
  • Maximum number of players on a team
  • If maximum number of players on a team makes it so no teams are available, you can re-enable some teams
  • Priority of the teams
  • Disabling specified teams to not be randomly selected when trying to select a random team to join
Setting it Up:
Looking at an example:
Quote from: data.ini
[Team0]
Balance=0
Priority=0
MaxPlayers=0

[Team1]
Balance=1
Priority=2
MaxPlayers=5+

[Team2]
Balance=2
Priority=1
MaxPlayers=10

[Team3]
Balance=0
Priority=0
MaxPlayers=0

[Team4]
Balance=0
Priority=0
MaxPlayers=0

[Team5]
Balance=0-
Priority=0
MaxPlayers=32
Team 0 is the deathmatch team.
Team 5 is for spectators.
As you can tell, there are the 6 teams, including deathmatch team and spectators. The first thing you should do is disable all teams you do not want allowed. To do this, just set all values for that team to 0 (as you can see in teams 0, 3, and 4). The next thing to do is to allow people to join in and spectate or play; despite how many people are on that team or any other team. To do this, you set Balance for that team to 0, as well as priority for that team to 0 (seen in team 5). Now lets say we are making a zombie server, and we want the zombie team (bravo) to have twice as many people as the human team; to do this, we need to put in the balance numbers for those teams. Any number (integer) between 0 and 255 works for either of them, as long as you set bravo's balance number twice as much as alpha's. I usually use 1 and 2, sense they are the smallest. Now lets think for a second. The first person joining has a choice of alpha or bravo team, and lets say we don't want that, we want it so if a player has a choice, we will take it away and force them to be on a team, let say bravo team. To do this, we need to make bravo the highest priority (lowest number larger than 1), so set bravo's priority to 1, and alpha's priority to 2. Now lets say we want to put a limit to the number of players that are on a team, you can easily do that by setting MaxPlayers in that category to whatever number as you please. Its usually best to put the MaxPlayers for spectators to 32, sense that is the largest number of players that can be in a game at one time, although larger numbers may be used, as well as lower numbers. After you finish putting in all the numbers, you may have noticed some +s and -s. I'll start off with the plus'. When you put a + at the end of MaxPlayers, that means that after the script goes through every team, and determines no teams may be used because of the number of players on that team, the plus will tell the script to re-enable that team for the player. Pretty nifty, huh? Now for the -s. Minuses are put at the end of Balance, and are used for determining which team to set a player to be forced to if the team he tries joining is not available. When there is a minus, it tells the script not to choose this team. So the minus on spectators on the example means that if alpha is full, and a player tries joining alpha, the only other team that the script will choose the player to be forced to is bravo, not spectator team.
I hope that helped.

Quote from: Changelog
Sunday, April 20, 2008
Fixed bug relating to the number of players on the leaving person's team

Saturday, April 19, 2008
ActivateServer (on recompile, and on server start) balances teams
Can either balance by random players or by lowest score first (except when a person joins a team, then they are balanced)

Friday, April 18, 2008 (latter)
Now MaxPlayers takes in effect before the balancing numbers to fix what could be called a bug

Friday, April 18, 2008
Released the script

Please note of any bugs, or suggestions
« Last Edit: April 20, 2008, 07:49:04 am by DorkeyDear »

Offline Leo

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1011
Re: Team Balancer
« Reply #1 on: April 19, 2008, 03:08:46 am »
That look interesting, we'll talk at channel Curt :)

Offline rumpel

  • Camper
  • ***
  • Posts: 410
Re: Team Balancer
« Reply #2 on: April 19, 2008, 02:49:35 pm »
yay gj dorkeh
banned.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Team Balancer
« Reply #3 on: April 19, 2008, 07:42:17 pm »
Things to be changed in next version:
-Balancing on ActivateServer (recompile)
-Lowest scored players are balance checked first, then higher scored players
-Balance after survival round, not during (when a person leaves the game) (maybe if i find the time)

Update
-ActivateServer balancing
-Lowest score balancing

Update
-Fixed bug relating to number of players on a leaving person's team
« Last Edit: April 20, 2008, 07:50:05 am by DorkeyDear »

Offline Noober

  • Major(1)
  • Posts: 5
Re: Team Balancer
« Reply #4 on: April 30, 2008, 04:56:34 pm »
Realy nice one team balancing ..i'll use it ;)

Offline Sir Jeremy

  • Flagrunner
  • ****
  • Posts: 691
  • Eurolicous!
Re: Team Balancer
« Reply #5 on: April 30, 2008, 10:57:20 pm »
GOOD JOB we Love u!!!

Keep up the great work! Ure da best!

No sarcasm.

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Team Balancer
« Reply #6 on: May 25, 2008, 05:35:29 am »
Bug: Not Linux compatible, said "data.ini not found". I edited the script a bit, entered the full path, so that it should work on Linux. but then it always said "xxxxx is not an integer".... someone knows how to fix this?! I already converted the ini into the linux format.

On Windows this script works fine.

Offline JFK

  • Camper
  • ***
  • Posts: 255
    • My TraxInSpace Account
Re: Team Balancer
« Reply #7 on: May 25, 2008, 09:55:59 am »
Code: [Select]
Balance := ReadData('scripts/' + ScriptName + '/data.ini')
should be:
Code: [Select]
Balance := ReadData('./scripts/' + ScriptName + '/data.ini')

AFAIK this will work on both linux and windows. Actually all scripters should refer to their paths like this :/
Also, i don't think you'll have to convert the .ini file.
Come join: EliteCTF
Listen to: My Music

Offline pico

  • Major(1)
  • Posts: 6
Re: Team Balancer
« Reply #8 on: May 31, 2008, 03:26:37 pm »
hey nice script :D

Offline zop

  • Major
  • *
  • Posts: 81
Re: Team Balancer
« Reply #9 on: May 31, 2008, 11:39:51 pm »
this is great! thanks!

http://122.116.167.31:23238:23238/galavela/?inc=player&name=%5BTomato+Bird%5D+Cibo[/size=1]