BotPlayerBalance~DynamicBotCount

Search, find and discuss about Mutators!
User avatar
Que
Inhuman
Posts: 812
Joined: Mon Dec 09, 2019 5:49 am
Personal rank: ...

BotPlayerBalance~DynamicBotCount

Post by Que »

We have a problem on server in team games this is where teams are unbalanced 3/4 , 5/6 , 7/8 ... 31/32 human players.

What is needed is a mod which automatically adds a bot if teams are uneven... Or removes the bot if another player enters making teams even again.

If 3 players add bot making 4 players.
Player joins.. remove bot totaling 4 players.

-=[Edit]=-

Have been sent a mod made by Sp0ngeB0b which does exactly this.Thank you Assosed! Attached.

Added another balancer by Proasm.
You do not have the required permissions to view the files attached to this post.
Last edited by Que on Tue Mar 09, 2021 10:55 am, edited 7 times in total.
*Join our Discord Here.*
Our mods - MVX , SSB , SmartWFL , UTCmds , BotCommands , Smart Stats , join/leave announcer , NoSmoke , UTLogin , BrightSkins , Server Tran…
*Our Servers
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

BotsBalanceTeams

Post by sektor2111 »

Que wrote: Sun Mar 07, 2021 9:27 am All these years on these forums and I think I seen maybe 2 mods you have built.
Because you did not read forum(/s) :sleep: to not forget that I promised decreasing activity leaving geniuses grinding teeth at me (about those "GoTo" stuff) to post their amazing codes and crapped maps, for showing their How To (not do)... As for my codes - I think I can write simple flexible things, which amazingly nobody was writing so far such as: BotyMan, MHBotyMan(X), DynAI, NavAdder, MapGarbage, PathLinker, etc and so on. The rest of my toys are not for public... Then I have all rights to complain - even about myself, I don't see why not.
Que wrote: Sun Mar 07, 2021 9:27 am What is needed is a mod which automatically adds a bot if teams are uneven... Or removes the bot if another player enters making teams even again.

If 3 players add bot making 4 players.
Player joins.. remove bot totaling 4 players.
This starts with comparing teams wrapped under a "bTeamGame" check - and Level.Game.NumPlayers > 0.
When Teams[0].Size == 3 < Teams[1].Size == 4 or Teams[0].Size > Teams[1].Size - I think it's time for setting up Level.Game.MinPlayers = Teams[0].Size +Teams[1].Size + 1, syntax helper

Code: Select all

TeamGamePlus(Level.Game).Teams[0].Size
TeamGamePlus(Level.Game).Teams[1].Size
probably DeathMatchPlus root will do the job itself or else something must be called from there - I think it works by itself in timer, letting TeamGamePlus to balance Bot entrance itself - testing "bPlayersBalanceTeams" what does it do and if it's not needed some more timing with MaxTeamSize, MaxPlayers - probably not. Either way, perhaps you can quit thinking at adding any Bot when map has under 10 navigation points or navigation chain is screwed up - you don't want a Bot to crash game because "mapper" had a poor amount of intelligence.
Next, when a Player joins miss-balancing teams I think Bot is leaving when is getting killed itself - due to TeamGamePlus settings, else it needs a timed check for teams and if exist a Bot causing damage at balancing decrease Level.Game.MinPlayers and destroy Bot (or only destroy Bot) - keeping a pair number for MinPlayers.
Perhaps this can be a ServerActor working in a state code using Sleep cycles taking in account real-time out of GameSpeed settings. As alternate solution, never reverting back MinPlayers before ending game. If game was running with 8 "Players" at a moment, let it be ended by 8 "Players", just track teams if are miss-balanced in two cycles using a bool. If in the second cycle of check game still runs miss-balanced (TeamGamePlus did nothing) adjust MinPlayers+1.

Right now I'm not very sure if TeamGamePlus it's not adding Bots if you are using MaxPlayers = 8, MinPlayers = 8 and MaxTeamSize = 4, balancing game itself without external support based on pair numbers chosen. As far as I recall I can play Team Games always balanced by TeamGamePlus itself. You can imagine that I don't play alone CTFGame - server adds "Players" itself balancing everything (a single enemy Bot it's not what I want to see), unless something else is needed for a smaller number of players per team and here it needs indeed an extra control concerning MinPlayers value.
Last edited by sektor2111 on Sun Mar 07, 2021 11:00 am, edited 1 time in total.
User avatar
Que
Inhuman
Posts: 812
Joined: Mon Dec 09, 2019 5:49 am
Personal rank: ...

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by Que »

:tu:

Perhaps a good little project to build up.
Iam sure several other admins would like to use this mod as well.
*Join our Discord Here.*
Our mods - MVX , SSB , SmartWFL , UTCmds , BotCommands , Smart Stats , join/leave announcer , NoSmoke , UTLogin , BrightSkins , Server Tran…
*Our Servers
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by sektor2111 »

Yeah, if it would be some interest, last time when I asked for testers toward "HalfCTFTime" whatever tool which I wrote (a sort of CTF Bases Switcher), I did not see any interest and then... I did not release anything if nobody cares.
ProAsm
Skilled
Posts: 230
Joined: Sun Sep 29, 2013 7:12 am

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by ProAsm »

@Sektor
Let me try and explain the requirement here as I see it.
The Admin first sets MaxPlayers=12, MinPlayers=2
Now when 1 Player joins, because MinPlayers=2 a bot joins and all is fair.
Now another Player joins and that Bot leaves, all is fair.
Next another Player joins so you now have 3 Players and because MinPlayers=2 so a Bot will not join.
This is where you need to either set MinPlayers=4 (if possible) or ForceAdd a Bot.
Correct me if I'm wrong here but I think setting MinPlayers= during a game has no effect and that is the problem ?
So your mod needs to ForceAdd a Bot when there are odd Players, and kill a bot when there are even Players up to Maxplayers.
At the end of the day, there must never be more than 1 Bot in the game :)
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by sektor2111 »

Yep, first is comparing teams and then increasing MinPlayers, this should be done anytime when it's needed (might join 2-3 Players during a few seconds...).
Here I think is indeed required a double check letting TeamGamePlus to deal first...
User avatar
Que
Inhuman
Posts: 812
Joined: Mon Dec 09, 2019 5:49 am
Personal rank: ...

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by Que »

sektor2111 wrote: Sun Mar 07, 2021 11:06 am Yeah, if it would be some interest, last time when I asked for testers toward "HalfCTFTime" whatever tool which I wrote (a sort of CTF Bases Switcher), I did not see any interest and then... I did not release anything if nobody cares.
This one sounds interesting .. what did it do? Switch red team to blue team and vice versa? At 1/2 time?.
What we need and I think someone did already make this is a tie game countdown for CTF.

Once the timer has ended and if the scores are tied then a preset countdown timer is started. Say 5 mins.
If still the match is not won during this 5 mins and the game is still tied then end the match with no winner 🏆
*Join our Discord Here.*
Our mods - MVX , SSB , SmartWFL , UTCmds , BotCommands , Smart Stats , join/leave announcer , NoSmoke , UTLogin , BrightSkins , Server Tran…
*Our Servers
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by sektor2111 »

HalfCTFtime was initial idea, I decided later to use more time intervals. What's happening in game ? At server-level - automatically replicated to clients, Bases are switched, RedFlag goes to BlueBase which from no on will have Flag sent at RedBase - including defenses, AlternatePaths and PlayerStarts. These changes are recommended based on uneven number 1,3,5 for getting timers 2,4,6 - eg: 1 change = two timers for playing in both bases, 1 half in RedBase and second half in Bluebase. Each team will play in Both bases because Places are swapped. Doesn't matter "overtime", Bases are switched until game is ended more or less controlled by other tools, it won't take control over the rest of game factors.
Why this tool ? Because:
- somebody asked a way for balancing already made maps ugly miss-balanced;
- Epic themselves have miss-balanced CTF maps (CTF-Command, CTF-Gauntlet, CTF-EternalCave, ...).
Then I decided that I want more balancing finding that idea as a good one which I wrote later and adjusting codes as configurable (more flexible).

The most entertaining and "heat" moment it's when both defenders are taking both Flags :lol2: ... helping here when map is also very balanced and not many captures can be seen due to defending options and environment.

I don't know if codes here are operated concerning whatever "constants" - I removed those craps some time ago, but I'll send you some prototype which I'm using and you can even setup some HUD info around this subject...
User avatar
Que
Inhuman
Posts: 812
Joined: Mon Dec 09, 2019 5:49 am
Personal rank: ...

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by Que »

I'd be kean to test this mod if you still have it.
Is it in beta form?. Is there a forum thread here at ut99.org for this mod?
Interesting.

Edit: how about player starts are they also swapped over?
*Join our Discord Here.*
Our mods - MVX , SSB , SmartWFL , UTCmds , BotCommands , Smart Stats , join/leave announcer , NoSmoke , UTLogin , BrightSkins , Server Tran…
*Our Servers
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ★ Smart Scoreboard 102f ★ [Updated 07/03/21]

Post by sektor2111 »

Read PM !... Yes, all are swapped except those TeamTriggers which probably in future versions are going to be ruined as long as they do damage at games with monsters. Don't look in forum, it wasn't shared anywhere so far - I did not have testers...
User avatar
papercoffee
Godlike
Posts: 10507
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.

Re: BotsBalanceTeams

Post by papercoffee »

By request from the thread starter got this new discussion split from "Smart Scoreboard".
User avatar
EvilGrins
Godlike
Posts: 10158
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: BotsBalanceTeams~DynamicBotCount

Post by EvilGrins »

UT already has that option built into it, it's in game selection. Both when you pick total number of players/minimal number... if human players drop out then bots replace them, and also the "balance teams" option which shuffles bots around to do that.
You do not have the required permissions to view the files attached to this post.
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: BotsBalanceTeams~DynamicBotCount

Post by sektor2111 »

To me it looks a very smart thing except... that Destroy() when DM is missing. I'm disagree with that in a mutator. Does it break mutators chain or not ? I would setup an option for self disabling or deactivating tick instead. In other hand this can be ServerActor leaving mutators alone, my two cents.
ProAsm
Skilled
Posts: 230
Joined: Sun Sep 29, 2013 7:12 am

Re: BotsBalanceTeams~DynamicBotCount

Post by ProAsm »

LOL... I actually asked Que on Discord what happened to our threads :)

Anyways, at EvelGrins, thats not quite what we want.
Sektor, I have put together a quick mod that surprisingly works but it gives an idea of what we're looking for.
You can elaborate on it if you wish.

Code (what there is) is intact.
BotPlayerBalance.zip
You do not have the required permissions to view the files attached to this post.
User avatar
sektor2111
Godlike
Posts: 6433
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: BotsBalanceTeams~DynamicBotCount

Post by sektor2111 »

Let me share what I was thinking...

Code: Select all


...
var bool bInactive;

function PreBeginPlay()
{
	DMGame = DeathMatchPlus(Level.Game);

	if (DMGame == none)
	{
//		destroy(); //Nah
		Disable('Tick');
		bInactive = True;
	}
	else
		DMGame.MinPlayers = 0;
}

function Tick(float DeltaTime)
{
  local int a, b;

	if ( bInactive ) //Completion - fast enough
		return;

//	if (DMGame == none)
//	DMGame = DeathMatchPlus(Level.Game);

	a = DMGame.NumPlayers;    //1 4 5 //Accessed None each tick if DM it's missing - check added in PreBeginPlay
	b = a / 2;                //0 2 2
	a = a - b;                //1 2 3
	if (a == b)
		DMGame.MinPlayers = a;
	else
		DMGame.MinPlayers = a + 1;
}
Nice code anyway. Greetings for this !

Edit: On the other side...
I'll drop a bit of love at previous code by Sp0ngeb0b. I'll use a configurable check-rate, as ServerActor because it doesn't need any mutator specific function, and code will setup MinPlayers only if this is needed and not in each tick. This will work by spoofing a sort of configurable Timed check inside Tick.
It goes latent if DM it's missing - I won't use "Destroy" here.