The most relevant parts:
Code: Select all
def GetRankThreshold(pilotSkills):
""" See fedsrv/fsmission.cpp, line 1290
"""
highest = max(pilotSkills)
average = sum(pilotSkills) / len(pilotSkills)
threshold = highest + (average * average) / (highest + average)
return threshold
# note: teams is a global list of lists of integers, where the integers are pilot ranks
# eg. teams = [ [1,2], [10,15] ] means that there's two teams, one horribly stacked
def CheckPositionRequest(nPlayerRank, wantedteam, verbose = False):
""" Called when a pilot wants to join a team. Returns False if join is blocked. See fedsrv/fsmission.cpp, line 4077
wantedteam is an index for the teams-list
"""
nRankThreshold = GetRankThreshold(concat(teams))
teamskills = map(sum, teams)
nRequestedSideRank = teamskills[wantedteam]
nLowestTeamRank, nHighestTeamRank = min(teamskills), max(teamskills)
nNewSideRank = nRequestedSideRank + nPlayerRank
#Prevent joining a team if it will put it over the threshold
if nNewSideRank - nLowestTeamRank > nRankThreshold:
#fixed: if nNewSideRank - nLowestTeamRank > nRankThreshold and nRequestedSideRank != nLowestTeamRank:
if verbose:
print "joining team %d would unbalance sides Rank=%d, NewSideRank=%d, RequestedSideRank=%d, LowestTeamRank=%d, RankThreshold=%d" % \
(wantedteam, nPlayerRank,nNewSideRank,nRequestedSideRank,nLowestTeamRank,nRankThreshold)
return False
# Prevent joining a team if a newbie is trying to newbstack
if nPlayerRank <= 8 and nRequestedSideRank == nLowestTeamRank:
#fixed: if nPlayerRank <= 8 and nRequestedSideRank == nLowestTeamRank and not nLowestTeamRank == nHighestTeamRank:
nDifference = nHighestTeamRank - nRequestedSideRank
if verbose:
print "joining team %d blocked (newbstack) Rank=%d, Difference=%d, RequestedSideRank=%d, HighestTeamRank=%d, RankThreshold=%d" % \
(wantedteam, nPlayerRank,nDifference,nRequestedSideRank,nHighestTeamRank,nRankThreshold)
return False
return TrueI have found a few different cases when pilots are unable to join any of the teams:A newbie tries to join when all teams have the same HELO scoreA pilot who has a higher rank than nRankThreshold tries to join (fix: always allow people to join the team with the lowest score)These cases are relatively easy to fix (see the #fixed: comments in the code). However, there's another more hairy case. Newbies who can't join one team for newbie-stacking, and can't join the other team for balance reasons. Example:
QUOTE No teams accepting! Pilot skill: 8. Threshold: 26
Teams:
Team 0: 20 pilots. Sum of skills: 223.
Team 1: 20 pilots. Sum of skills: 198.
Reasons:
joining team 0 would unbalance sides Rank=8, NewSideRank=231, RequestedSideRank=223, LowestTeamRank=198, RankThreshold=26
joining team 1 blocked (newbstack) Rank=8, Difference=25, RequestedSideRank=198, HighestTeamRank=223, RankThreshold=26
testcase: (8, [[6, 15, 7, 14, 12, 3, 9, 11, 3, 14, 13, 16, 11, 10, 1, 24, 10, 16, 17, 11], [6, 1, 12, 10, 1, 17, 1, 9, 12, 4, 23, 17, 6, 11, 12, 13, 13, 9, 9, 12]]),[/quote]
In this situation, where should we direct the (8)? I seem to remember that there has been proposals to always let newbies join the underdog team. And that seems to be how it works before launching the game...?
Or should the (8) join Team 0, to try and lessen the stack? And how can we detect that? Should we look at the average skill of the teams, and see if it moves towards balance or not (a bit of hand-waving there, I know...) ? Maybe we should just always let newbies join a "stacked" team?
Note: I didn't participate in the discussions during the design of the auto-balance systems. I apologize if I'm just beating a dead horse.
EDIT:
Another thing I find questionable is this line from CFSMission::GetRankThreshold
Code: Select all
iAverageRank = iAverageRank / plistShip->n();



