New Algorithm for "Force Even Teams" for the next build.

moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
edited September 2014 in NS2 General Discussion
@remi.D and I have implemented a brand new algorithm for "Force Even Teams" for the next build!

We determined two problems with the previous implementation.
1. It used last round's kills as much as the skill values, which breaks for players that were commanding or joined late.
2. It reassigned all the players whether it was necessary to do so or not. This lead to people switching their team right back after being reassigned because they really wanted to play marines, or aliens, or they really wanted to play with their friends.

We fixed #1 by switching over to using the values from Hive entirely. These certainly aren't perfect yet, but they have the nice property that if they are wrong, they won't be wrong for long. The fastest way to make them better is to play games that hive thinks are balanced, and hive will learn from each game what each player's actual skill is.

To fix #2, Initially we thought about restricting team switching for 2 minutes after a force even teams vote, but we came up with a better idea.
NK2eU2l.png

The new algorithm takes the teams as they are, and tries to swap players until they are even. However, it does a few clever things to swap as few players as possible.
1. It starts by trying to even the teams using only the players in the readyroom which we interpret to be players who have no preference for team.
2. When looking for players to swap, it finds the pair that makes the skill difference as close to 0 as possible, and repeats this process until there are no available swaps that reduce the skill difference.

The nice thing about #2 is that it tries to make big swaps (best player for worst player if necessary) so it doesn't have to make too many of them.

Finding the optimal team balance is NP-Complete in general, but we think we've found a nice balance that finds a local optimum without disturbing people too much.

Comments

  • ns2isgoodns2isgood Join Date: 2013-04-16 Member: 184847Members
    Sounds great on paper, but the rate of these votes passing on pubs is very low on NA servers. The votes typically only get brought up after 3+ matches of continuous stacking and people finally get fed up. I don't see this affecting pub play much and still think stacking will run rampant as it has for a while now.

    A server mod where every round is randomized using this system would be very nice though. Have it account for players preferred side and even allow an option to set pre-select a team. If a slot is open on the preferred or pre-selected side and is deemed balanced by the algorithm, you will be placed there.

    And have you guys fixed the "force" part of this vote? You aren't forcing anyone to do anything if they can switch out of the team they were placed on and stack to the team they want by simply pressing f4.
  • NordicNordic Long term camping in Kodiak Join Date: 2012-05-13 Member: 151995Members, NS2 Playtester, NS2 Map Tester, Reinforced - Supporter, Reinforced - Silver, Reinforced - Shadow
    Don't get me started on the death panels... I mean... oops wrong forum. :p
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    edited September 2014
    @ns2isgood, we're hoping that people aren't deliberately stacking, that they are either doing it by accident or just have a preference for race and the teams end up stacked as a result. I'm hoping that if this vote is a little less disruptive, and more reliable, then people will have good experiences and it will pass more often.
  • lwflwf Join Date: 2006-11-03 Member: 58311Members, Constellation
    Brilliant, this can solve real problems. Random ready room is already back to being used as a substitute for force even teams and many servers that had it disabled before has it disabled again, due to it's reputation being tarnished.

    The common complaint is "I am always being switched" and "I want to play X but it has made me Y for the last 5 rounds" (as well as "It makes it worse", but that is almost never true, although it sure could be better). Random ready room solves this problem for that player but unfortunately will make the most unbalanced teams since it will keep the stack intact and then just randomly assign the other half. But this just shifts the complains towards the end of the game ("How was that a gg!?"). This can make force even effective against this, on the other hand there may be a few players whose "always me" complaint would be valid! If needed perhaps the hive could also keep internal stats on how often the player has recently been swapped and the algorithm prefer to switch someone that has been switched less often. Probably isn't needed.

    I would suggest keeping assigning late connecting players for the first 5 or so minutes of the game (optionally wait sign of life or team join attempt since they may be AFK from not looking at the loading screen). It's very common that the presumably highest ranking player if there is one above most others, will leave before the start, leaving the teams unbalanced. A high ranking player could also join late and offset the balance. It's also common that a vote is simply initiating too early, while a good chunk of players are still loading the map.

    Never assume players are not deliberately stacking. A few minutes of no team switching (sans F4?) could still be beneficial, but maybe for the next patch. F4 could still be useful since it's better to have no player than a useless player that doesn't want to play taking up a slot. Having a free slot means you might get a player that want to play on the next join, or if the teams become significantly unbalanced player count wise, auto balance will kick in and fix it.

    There is also a problem with how votes are being handled in general. A single player has too much power over what to vote for. It's enough for a single player to initiate a random rr vote to block out the possibility of a force even vote. I don't know how to solve this. A simple fix would be to not allow random rr votes until the game has started or players has been waiting for a com for a while, but this problem extends beyond team balance and random rr votes, which map to change to also comes to mind.
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    We're discussing other options to extend this if it works well. One easy option is to bias the random gate toward making balanced teams. This won't be super effective, but should be a strict improvement without any downside.
  • MrFangsMrFangs Join Date: 2013-03-27 Member: 184474Members, Reinforced - Shadow
    Give that man a medal CDT badge!
  • MartigenMartigen Australia Join Date: 2002-11-01 Member: 2714Members, NS1 Playtester, Contributor, Reinforced - Onos
    MrFangs wrote: »
    Give that man a medal CDT badge!
    This ^

    Also, this sounds great Moultano! My 2c of input:

    * Force Even Teams does have a bad rap at the moment, so I hope 269 includes some education and promotion of this change (In Super Effective's video changelog, for eg?). Make it known that using it should = better balanced teams = better games.

    * I agree that it perhaps it should even be a default, toggle-able by a server admin. Something like 2-3 mins to allow people to join their preferred team, then at game start the algorithm kicks in. This way, presumably, most people still get to play on their preferred team, but the teams are balanced and RR players are allocated.

    * Agree with lwf's suggestions to a) only assign RR where there's signs of life for a player and b) keep assigning players who join for 5 odd minutes after game starts. Especially true for votes that pass while players are still joining.

    * I know there is a divisive opinion, so I leave it here as just that, an opinion: but I see merits in forcing players to stay on their allocated teams, at least again for 5 minutes or so, where upon if they stay they may now be invested. Is forcing a player to stay on a team a good thing? Probably not, but then assigning 'balanced' teams and having people F4 or switch defeats the whole purpose of voting for Force Even in the first place, and then the game ends and people complain about imbalanced teams *facepalm*. The predicted skill balance allocation of teams from Hive only works if people stick to it. Hence having it as a modus operandi is probably a good thing, especially if people can still choose their 'preferred' side by joining a side before the algorithm kicks in.


  • meatmachinemeatmachine South England Join Date: 2013-01-06 Member: 177858Members, NS2 Playtester, NS2 Map Tester, Reinforced - Shadow, WC 2013 - Supporter
    ^^^ Agree, the wording of FET should probably be changed to something more appropriate for the twofold purpose of communicating that changes have been made, and making it's name fit the function more accurately.

    I propose the tentative name "Skill Balance"

    Or, if you will, "Moultano for president" :D
  • UncleCrunchUncleCrunch Mayonnaise land Join Date: 2005-02-16 Member: 41365Members, Reinforced - Onos

    IMO :

    Make it kick in when game starts for all active players in RR (not AFK).
    ___Maybe some ppl will ask for a "AFK status" to avoid joining and idle. Depends on what is decided for Spectate mode. Disable F4 at the moment for 1 minute or until both teams have a commander.

    Make it be used when a player go in "random" during the game.
    ___So everybody have the same process.

    Disable other forms of vote about random/even teams.
    ___That would be the tricky part. I can't help thinking about the 'RTV' vote and official change map vote that sometimes are thrown at the same time.
  • MartigenMartigen Australia Join Date: 2002-11-01 Member: 2714Members, NS1 Playtester, Contributor, Reinforced - Onos
    edited September 2014
    ^^^ Agree, the wording of FET should probably be changed to something more appropriate for the twofold purpose of communicating that changes have been made, and making it's name fit the function more accurately.

    I propose the tentative name "Skill Balance"
    Second this. Call it 'Skill Balanced Teams' for next build @WasabiOne‌

    Edit: it also currently says '(this will reassign all players)' which of course it won't now.
  • CmdrKeenCmdrKeen Join Date: 2013-05-21 Member: 185321Members, Reinforced - Shadow
    edited September 2014
    I, too, think that using the "Force even teams" - vote is still pretty far away from the optimal solution. The major concerns I have seen here and agree with:

    1. People have switched teams after the vote in the past, people will keep switching teams if you do not enforce it

    2. Taking people from the Ready Room is assuming that they will be playing the next round, which is very often not the case

    3. The vote is often made too early (before leaving players have left and connecting players are done loading)

    4. The vote is highly unpopular AFAIK, so it may take a while to get used, if at all (some sort of re-naming might help a lot - "Make teams using Skill-Ranks" or something like that)

    Zek wrote: »
    For instance, by default let people fill the teams manually, and have the autobalancer kick in automatically if a significant skill gap is detected.

    I would like something like that much more. Some kind of system where the team skill-scores are monitored (maybe also displayed somewhere so people can keep track of them as teams are forming) and something happens when a round is starting with a high skill gap.

    For example there could be an automatic vote to "Force even teams" when the skill-gap exceeds a certain threshold. (Note that the players could still vote "No").

    This should happen when the round is starting (both teams have a comm), because this is the best possible moment to balance without disrupting a running game.

    The vote should leave the players in the Ready Room untouched. The problem of players being afk there for long times can be fixed with the AFK-kick functions.

    What could be done though is that players who want to join a running round (which had a passed skill-vote), do not have the freedom of race-choice anymore, but get automatically sorted into a team in order to minimize the skill gap. This would only be possible if both teams have the same amount of players at that time I suppose.

    If something like that would be implemented and found to be working as intended, I would be in favor of getting rid of the "Force even team"/"Randomize RR" votes completely.



  • cooliticcoolitic Right behind you Join Date: 2013-04-02 Member: 184609Members
    FINALLY.

    Lets hope this will work.
  • WobWob Join Date: 2005-04-08 Member: 47814Members, NS2 Map Tester, Reinforced - Shadow, WC 2013 - Shadow
    moultano wrote: »
    One easy option is to bias the random gate toward making balanced teams.

    I would definitely random everytime if it meant I get 3-5 extra pres >:)
  • It's Super Effective!It's Super Effective! Join Date: 2012-08-28 Member: 156625Members, NS2 Playtester, Squad Five Blue, Reinforced - Shadow
    @moultano‌ How do you determine who are "friends" in order to keep them together? If a group of friends has mediocre players and say 1 great player, he'll more than often get swapped away. Sorry if I missed where it was explained,
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    @It's Super Effective!‌ That's true. It just tries to minimize the number of swaps. It doesn't know who friends are. It tries very hard to avoid swapping any players that have already joined a team if it can though, so if you want to stick together you have a decent shot if you join a team before the vote succeeds, so long as there are still players in the readyroom.
  • MrFangsMrFangs Join Date: 2013-03-27 Member: 184474Members, Reinforced - Shadow
    CmdrKeen wrote: »
    2. Taking people from the Ready Room is assuming that they will be playing the next round, which is very often not the case

    The proper solution would be that players can signal that they are ready to play, but don't care in which team.

    In the current 3D ready room metaphor, players could (for example) start in a new first room called "Lobby". From there, they step through doors labeled "Marines", "Aliens", or "Ready Room". This new "Ready Room" would be where team balance draws players from. After a match ends, all players are returned to the Lobby instead of the Ready Room, so only players that want to play will enter the Ready Room. Players detected to be AFK are automatically moved to the Lobby.

    However, reworking the ready rooms on all maps would probably be too much work (assuming the door naming like "Random" etc. is built into the map, and not generated). So maybe some kind of "ready to play" flag could solve this without map changes? Maybe automatically set by player movement - assuming that most players that want to leave don't run around in the ready room? :)
  • It's Super Effective!It's Super Effective! Join Date: 2012-08-28 Member: 156625Members, NS2 Playtester, Squad Five Blue, Reinforced - Shadow
    Don't really need to rework the ready rooms.

    Simply create a mod where people can press F1 or F2 to flag themselves.

    Because we all know how we like to chill out, go to secret rooms, jump around and get comfy.

    Better yet if this was built into a pleasing UI:

    Force Even Teams? (12 seconds to vote) Yes - F1 / No - F2

    then if the vote passes, it presents people with X seconds to "Choose preferred side for balancing" Marine - F1, Alien - F2

    Then perhaps after the second countdown, it assigns with weighted consideration on people's preferences.

    If you never played Evolve, you do NOT have a choice what side to play on, instead you have a dropdown box in your options. (support, assault, medic, tracker, goliath, kraken, ???) but it can help more often than not to get the side you are itching for. It may also help the "force even team" A.I. create balanced teams that also appeases preference.
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    CmdrKeen wrote: »
    For example there could be an automatic vote to "Force even teams" when the skill-gap exceeds a certain threshold. (Note that the players could still vote "No").

    This should happen when the round is starting (both teams have a comm), because this is the best possible moment to balance without disrupting a running game.
    I really like this idea. We could start by setting the threshold high enough that it only fires in really extreme cases and gradually lower it if it's popular without too much risk of annoying people.
  • skulkgatoskulkgato Join Date: 2013-03-03 Member: 183645Members, Reinforced - Gold
    ns2isgood wrote: »
    Sounds great on paper, but the rate of these votes passing on pubs is very low on NA servers. The votes typically only get brought up after 3+ matches of continuous stacking and people finally get fed up. I don't see this affecting pub play much and still think stacking will run rampant as it has for a while now.
    We call this vote "Autostack" after most of the server sits in the ready room wondering if they can survive the psychological abuse of another game.
    Function fails to fit description again.
    When we tried it the other night it seemed to work toward making a more pleasant experience. I am excited about this, thanks.

  • lwflwf Join Date: 2006-11-03 Member: 58311Members, Constellation
    Just noticed the vote still says "Force even teams? (this will reassign all players)". That should probably be changed! Especially since there's now some players loudly complains about how it doesn't seem to do anything because they don't understand what it does...
  • GalapagOGalapagO Florida Join Date: 2014-01-14 Member: 193121Members
    @moultano‌
    This is awesome work. Thank you!
    Sorry to spoil the praise but I would like to suggest something: Take into account those who entered through the door, "Random". People who entered through random clearly do not mind what team they are on and should be ranked higher than those who are in the lobby, as they could possibly be afk. Sorry for the suggestion, but I hope it helps. (Also in my personal and humble opinion I think the Random "door" should be the main/biggest/and centered door rather than the team doors; from there you can walk to the specific door you want if you really don't want to go random)
Sign In or Register to comment.