EvenMatchOmni

Discuss and provide feedback on Maps.
Post Reply
User avatar
captainsnarf
Posts: 2705
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: EvenMatchOmni

Post by captainsnarf »

I'm really not sure why it did that. I think maybe my change to support balancing even number teams broke some of the logic? I can put that part back the way it was.

EvenMatchOmni_1.3.zip

- revert change that allowed teams command on even number of players
- teams are considered balanced if total PPH difference is less than 200
- add some 'None' checks
User avatar
McLovin
Posts: 1194
Joined: Sat Apr 03, 2021 12:54 pm
Location: Salt Lake City, Utah
Server Sponsor: Yes
Server Admin: Yes

Re: EvenMatchOmni

Post by McLovin »

pooty wrote: Sat Jan 29, 2022 8:26 am Someone did type the UAdminMod teams at nearly the same time, so might have been an interaction. I'll dig up the log later today.
Somebody didn't put a mutex around a shared resource in the software is my guess. When 2 threads are competing, I'd get these race conditions all the time. Semaphores are your friend.
User avatar
captainsnarf
Posts: 2705
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: EvenMatchOmni

Post by captainsnarf »

I think it's just Wormbo's code. His code is...great in some areas, but then he'll do stupid shit like

Code: Select all

switch(int(bIsEnabled == false) * 4 + Offset && NeedsRebalancing(Offset2,temp) * int(bShouldSwap) > 3) {
case -6:
    ...
    break;
case -5:
    break;

What happens if I change 'NeedsRebalancing'? Who the fuck knows, lol. If I asked Wormbo today he probably wouldn't know either without going through it all over again.
User avatar
pooty
Posts: 4521
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: EvenMatchOmni

Post by pooty »

Yikes. Not even sure where to start to pick that one apart, there's many places....

So one thing I need to look into is the new players joining and which mutator is actually doing the team selection. It seems like from the logs it EvenMatch so it sould be looking at PPH totals correct? I don't think it is?

Code: Select all

ScriptLog: Securing new player...
EvenMatch: Overriding player team preference team=255 with team=1
ScriptLog: Found new security actor ONS-Dria-Randomizer-V18.AntiTCCSecurity for ONS-Dria-Randomizer-V18.ONSPlusxPlayer
ScriptLog: New Player shango_support id=REDACTED
PlayerJoinLog: [PLAYER_JOIN] 2022/1/27 20:34:59	shango_support	REDACTED:51371	10000	REDACTED
I think getting the player joins right would help quite a bit.
User avatar
captainsnarf
Posts: 2705
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: EvenMatchOmni

Post by captainsnarf »

I was thinking I need to add a bunch of logging for the new stuff I added, so we can see what the balance actually is and what the PPH values are.

Here is the function that affects new players joining:

Code: Select all

function ModifyLogin(out string Portal, out string Options)
{
	local int RequestedTeam;
	local float Progress;
	local byte BiggerTeam, NewTeam;

	Super.ModifyLogin(Portal, Options);

	if (!bAssignConnectingPlayerTeam && !bIgnoreConnectingPlayerTeamPreference)
		return;

	RequestedTeam = Game.GetIntOption(Options, "team", 255);
	if (bAssignConnectingPlayerTeam) {
	
		if (!RebalanceNeeded(0, Progress, BiggerTeam) && !bIgnoreConnectingPlayerTeamPreference)
			return;
		
		if (BiggerTeam == 255)
			BiggerTeam = int(Progress >= 0.5);

		// force player to join the weaker team
		NewTeam = (1 - BiggerTeam);
	}
	else {
		// override team preference of the joining player
		NewTeam = 255;
	}
	
	if (RequestedTeam != NewTeam)
		log("Overriding player team preference team=" $ RequestedTeam $ " with team=" $ NewTeam, 'EvenMatch');
	
	// disable the player's team preference
	if (InStr(Locs(Options), "team="$RequestedTeam) != -1)
		Options = Repl(Options, "team="$RequestedTeam, "team="$NewTeam);
	else
		Options $= "?team="$NewTeam;
}

Looks like it only works with these config values:

Code: Select all

bAssignConnectingPlayerTeam=true
bIgnoreConnectingPlayerTeamPreference=true

I changed what 'progress' means. If BiggerTeam == 255 then the teams have the same number of players. In that case, look at the progress variable to see which team is 'bigger'.

Code: Select all

if (BiggerTeam == 255)
    BiggerTeam = int(Progress >= 0.5);

    // force player to join the weaker team
    NewTeam = (1 - BiggerTeam);
Progress is based on team PPH now. If players are always ending up on red when teams are even, it might mean blue is always ending up with more PPH. I think it will take some observations to know for sure what it's doing. I can add some logging also.
User avatar
captainsnarf
Posts: 2705
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: EvenMatchOmni

Post by captainsnarf »

New version! Download here EvenMatchOmni_1.4.zip

Changes

- Show the balance values during match start, teams call, and shuffle calls

Code: Select all

QuickRoundBalanceString = "Mulligan!!! Restarting with balanced teams"
PrevMatchBalanceString  = "Teams have been balanced based on skill: Red(%r) Blue(%b)"
ForcedBalanceString     = "Teams rebalanced, new balance: Red(%r) Blue(%b)"
NoCallForBalanceEvenString = "Teams look even already: Red(%r) Blue(%b), not re-balancing."
User avatar
McLovin
Posts: 1194
Joined: Sat Apr 03, 2021 12:54 pm
Location: Salt Lake City, Utah
Server Sponsor: Yes
Server Admin: Yes

Re: EvenMatchOmni

Post by McLovin »

What are the commands for the admins to initiate this again?

> mutate shuffle
or
> mutate balance
User avatar
captainsnarf
Posts: 2705
Joined: Tue Jul 06, 2021 1:51 pm
Location: Washington
Server Sponsor: Yes
Server Admin: Yes
Contact:

Re: EvenMatchOmni

Post by captainsnarf »

Code: Select all

mutate shuffle 
mutate teams (this is the same as saying teams in chat)
'Mutate teams' exist so that only admins can call the teams command, but we allow anybody to call teams so it's kind of redundant.

'mutate shuffle' is the new thing I added.

The teams command might not always work and it will say "teams are already balanced", even for admins. The shuffle command will always shuffle teams immediately.
User avatar
pooty
Posts: 4521
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: EvenMatchOmni

Post by pooty »

'Mutate teams' exist so that only admins can call the teams command, but we allow anybody to call teams so it's kind of redundant.
Those are two different commands.
mutate teams as an admin calls EvenMatchOmni to balance the teams...but even so not 100% it doesn't pick up the one below. Maybe we need a different command that mutate teams to know which one we are calling.

The player called 'teams' calls UAdminMod95b to balance the teams numerically switching whomever joined last.

mutate shuffle always calls EvenMatchOmni
User avatar
pooty
Posts: 4521
Joined: Sat Apr 03, 2021 10:22 am
Location: Michigan
Server Sponsor: Yes
Server Admin: Yes

Re: EvenMatchOmni

Post by pooty »

Just tried mutate teams as admin and it didn't do anything at least according to the messages/server log.

mutate shuffle, killed all the bots and me, and reassembled the team. It did look like while that was happening there was some conflict with UAdminMod:

Code: Select all

EvenMatch: Shuffling teams based on previous known PPH...
EvenMatchDebug: p)o(Oty 312.08 PPH, currently on Red
EvenMatchDebug: 1 players, combined PPH 312.08, balance target PPH per team 156.04
EvenMatchDebug: Balancing team sizes and PPH...
EvenMatchDebug: Odd player count, randomly assigning p)o(Oty to blue (312.08 PPH)
EvenMatchDebug: Red team size 0, combined PPH 0.00
EvenMatchDebug: Blue team size 1, combined PPH 312.08
EvenMatchDebug: Applying team changes...
EvenMatchDebug: Moving p)o(Oty to blue
EvenMatchDebug: Teams shuffled.
Warning: EvenMatchRules ONS-Torlan_WinterC)o(mbat.EvenMatchRules (Function EvenMatchOmni.EvenMatchRules.ShuffleTeams:0B33) Accessed None 'retval'
Warning: EvenMatchRules ONS-Torlan_WinterC)o(mbat.EvenMatchRules (Function EvenMatchOmni.EvenMatchRules.ShuffleTeams:0B3B) Attempt to assign variable through None
Warning: EvenMatchRules ONS-Torlan_WinterC)o(mbat.EvenMatchRules (Function EvenMatchOmni.EvenMatchRules.ShuffleTeams:0B47) Accessed None 'retval'
Warning: EvenMatchRules ONS-Torlan_WinterC)o(mbat.EvenMatchRules (Function EvenMatchOmni.EvenMatchRules.ShuffleTeams:0B4F) Attempt to assign variable through None
Warning: UnevenMessage None (Function EvenMatchOmni.UnevenMessage.GetString:0126) Accessed None 'OptionalObject'
Warning: UnevenMessage None (Function EvenMatchOmni.UnevenMessage.GetString:0142) Accessed None 'OptionalObject'
Warning: UnevenMessage None (Function EvenMatchOmni.UnevenMessage.GetString:0126) Accessed None 'OptionalObject'
Warning: UnevenMessage None (Function EvenMatchOmni.UnevenMessage.GetString:0142) Accessed None 'OptionalObject'
ScriptLog: START MATCH
EvenMatch: Moving p)o(Oty from voice chat room Team (team 0) to Team (team 1)
ScriptLog: p)o(Oty logged in as p00ty.
Log: Opening user log ..\UserLogs\AntiTCC_2022-02-06_00-37_ONSOnslaughtGame_ONS-Torlan_WinterC)o(mbat.log
EvenMatchDebug: Removing 5 bots for shuffling
Warning: UAMGameRules ONS-Torlan_WinterC)o(mbat.UAMGameRules (Function UAdminModV095b.UAMGameRules.PreventDeath:002F) Accessed None 'Controller'
Warning: UAMGameRules ONS-Torlan_WinterC)o(mbat.UAMGameRules (Function UAdminModV095b.UAMGameRules.PreventDeath:002F) Accessed
Mostly based on warnings for at the end of the above log.... I am guessing probably the EvenMatchOmni warnings are because of bots.
Post Reply