Create player count based balancer

Issue #92 open
created an issue

There should be a balancer that mimics the old player count balancing available in asss 1.4.4.

Comments (9)

  1. Justin Schwartz
    1. 79 is a separate issue, resolved by the rewrite of the new freqman (so can be closed when that code is merged) that issue was more like "balancers fail due to inexplicable miscounting" and was caused by a leak.

    Maybe it's been partially solved but there is still the issue of player counts being ignored when entering the game, even if other times it will post unevenness messages.

  2. numpf

    I guess my thinking is "fix all the balancer problems" is one issue. I'd thought the default balancer, with all metrics=1, would be subgame-compatible. Can you briefly describe the difference?

  3. Justin Schwartz

    Well if we're ready to switch to the akd branch's freqman for the core then I'd close #79 as that was the issue the rewrite of the rewrite was supposed to solve (and has, it seems.) Then this issue would still be open because it has not quite solved the default balancing behavior which the other one didn't do at all.

    Right now, there are the following problems:

    1. Consider a two-freq game (maxfrequency=2, desiredteams=2), and force even teams is disabled. If every player is on freq 0, then the next player to unspec will go to freq 1. However, if there are players on both teams, the next player to unspec will go to freq 0 unless it's full, even though it would make sense (even if not forcing balance) to put this player on freq 1, as I'm pretty sure subgame and even 1.4.4 would. find_entry_freq will try to put players on the freq with the lowest metric which means when all metrics are 0 it will just go to the first non-full freq (but it will short-circuit and go for an empty desiredteam first)

    This may have been in the original freqman rewrite too, it looks like I kind of blindly copied the idea of "if there is no balancer, the metric is 0" into "if teams are not being forced even, the metric is 0"--so that is probably a pretty obvious fix then now that I've put some more thought into it--this bug does not manifest when ForceEvenTeams is on because player metrics are non-zero. But it would also mean that the default balancer would have to find another way to honor ForceEvenTeams=0 while still assigning appropriate metrics.

    2. Consider a two-freq game, and force-even-teams is enabled. You can stack all players on freq 0 if there are no players on freq 1. This is not a bug, I believe, it's supposed to be mitigated by setting RequiredTeams=2, but this situation is not sufficient when you have a set up of multiple independent games in the same arena. There seems to be a need for certain freqs to be kept-alive in the list, but not given the special functionality of RequiredTeams (which additionally prevents people from going to a non-required team before the required teams have players, and prevents emptying a required team)

    So maybe the fixes are known.. I'll have to try it sometime (unless some else has the time), from akd branch:

    1. always set default player metric to 1, and modify default_GetMaximumDifference to honor ForceEvenTeams=0 (return INT_MAX instead of Team:GetMaximumDifference should make sense..?)

    2. create a new setting that mirrors RequiredTeams (ExpectedTeams? RememberedTeams?) that makes the teamfreq stick in the linkedlist but don't force any other special functionality to these freqs like forcing players to go there.


  4. numpf

    thanks for being brief :)

    I haven't reviewed it closely enough to know specifics, but generally I think metrics should always be maintained, but only used when forceeventeams=1 OR a player is entering the game from ship==spec && freq==spec. Your # 2 would be considered a big bug for PB. This is why we can't update. Multiple independent games in the same arena is a much bigger problem, and basically can't be supported cleanly without a major core overhaul. You'd have to have a hacky custom freqman in the meantime.

  5. Justin Schwartz

    Well, I got excited when I realized the actual problem and solution :p

    You and I are in agreement about when metrics should be used. The balancer will always be consulted, it is up to the balancer to say whether teams have to be close or not.

    Multiple independent games does not have to be supported by the core. (until #101 is resolved, which will involved overhauling this module again.) Also, a custom freqman hack is not needed either, this was half of the whole point of the new freqman paradigm. An independent I_BALANCER (hence any external module) can be used which will allow independent game's freqs to not care about each other.

    Like I said, I think both of these are relatively simple to fix now that I know what is really going on. In your case, you should be able to set RequiredTeams to 2 in PB? Or do you have multiple games going on? I mostly need that new setting I mentioned because I have multiple games.

  6. numpf

    We have 1 game with 2 freqs (). They need to be filled as evenly as possible. You shouldn't be able to get on freq 0 if it has players and freq 1 is empty. That's all that matters for us. If you fix that we can update and fix for others like chaos later. We may end up wanting multiple games, but probably not and it can wait.

  7. Log in to comment