Merge pull request #594 from hermensbas/feature/autoscale_last_feature_latency_scaling

[performance] Autoscale latency scaling
This commit is contained in:
bash
2024-10-11 23:24:38 +02:00
committed by GitHub
5 changed files with 27 additions and 34 deletions

View File

@@ -1263,11 +1263,6 @@ Playerbots.Updates.EnableDatabases = 1
# Command server port, 0 - disabled # Command server port, 0 - disabled
AiPlayerbot.CommandServerPort = 8888 AiPlayerbot.CommandServerPort = 8888
# Diff with/without player in server. The server will tune bot activity to reach the desired server tick speed (in ms).# PLAYERBOT SYSTEM SETTINGS #
AiPlayerbot.EnablePrototypePerformanceDiff = 0
AiPlayerbot.DiffWithPlayer = 100
AiPlayerbot.DiffEmpty = 200
# #
# #
# #
@@ -1464,11 +1459,14 @@ AiPlayerbot.BotActiveAlone = 100
# Specify smart scaling is enabled or not. # Specify smart scaling is enabled or not.
# The default is 1. When enabled (smart) scales the 'BotActiveAlone' value. # The default is 1. When enabled (smart) scales the 'BotActiveAlone' value.
# Only when botLevel is between WhenMinLevel and WhenMaxLevel.
AiPlayerbot.botActiveAloneSmartScale = 1 AiPlayerbot.botActiveAloneSmartScale = 1
# Only when botLevel is between WhenMinLevel and WhenMaxLevel.
AiPlayerbot.botActiveAloneSmartScaleWhenMinLevel = 1 AiPlayerbot.botActiveAloneSmartScaleWhenMinLevel = 1
AiPlayerbot.botActiveAloneSmartScaleWhenMaxLevel = 80 AiPlayerbot.botActiveAloneSmartScaleWhenMaxLevel = 80
# The server will tune bot activity to reach the desired server tick speed (in ms)
# bots will only join battleground when there is no lag based on latency diffs below
AiPlayerbot.botActiveAloneSmartScaleDiffWithPlayer = 100
AiPlayerbot.botActiveAloneSmartScaleDiffEmpty = 200
# Premade spell to avoid (undetected spells) # Premade spell to avoid (undetected spells)
# spellid-radius, ... # spellid-radius, ...

View File

@@ -466,12 +466,14 @@ bool PlayerbotAIConfig::Initialize()
disableDeathKnightLogin = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableDeathKnightLogin", 0); disableDeathKnightLogin = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableDeathKnightLogin", 0);
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 100); botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 100);
botActiveAloneSmartScale = sConfigMgr->GetOption<bool>("AiPlayerbot.botActiveAloneSmartScale", 1); botActiveAloneSmartScale = sConfigMgr->GetOption<bool>("AiPlayerbot.botActiveAloneSmartScale", 1);
botActiveAloneSmartScaleWhenMinLevel = sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleWhenMinLevel", 1); botActiveAloneSmartScaleWhenMinLevel =
botActiveAloneSmartScaleWhenMaxLevel = sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleWhenMaxLevel", 80); sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleWhenMinLevel", 1);
botActiveAloneSmartScaleWhenMaxLevel =
enablePrototypePerformanceDiff = sConfigMgr->GetOption<bool>("AiPlayerbot.EnablePrototypePerformanceDiff", false); sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleWhenMaxLevel", 80);
diffWithPlayer = sConfigMgr->GetOption<int32>("AiPlayerbot.DiffWithPlayer", 100); botActiveAloneSmartScaleDiffWithPlayer =
diffEmpty = sConfigMgr->GetOption<int32>("AiPlayerbot.DiffEmpty", 200); sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleDiffWithPlayer", 100);
botActiveAloneSmartScaleDiffEmpty =
sConfigMgr->GetOption<uint32>("AiPlayerbot.botActiveAloneSmartScaleDiffEmpty", 200);
randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false); randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false);
randombotsWalkingRPGInDoors = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG.InDoors", false); randombotsWalkingRPGInDoors = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG.InDoors", false);

View File

@@ -266,10 +266,8 @@ public:
bool botActiveAloneSmartScale; bool botActiveAloneSmartScale;
uint32 botActiveAloneSmartScaleWhenMinLevel; uint32 botActiveAloneSmartScaleWhenMinLevel;
uint32 botActiveAloneSmartScaleWhenMaxLevel; uint32 botActiveAloneSmartScaleWhenMaxLevel;
uint32 botActiveAloneSmartScaleDiffWithPlayer;
uint32 enablePrototypePerformanceDiff; uint32 botActiveAloneSmartScaleDiffEmpty;
uint32 diffWithPlayer;
uint32 diffEmpty;
bool freeMethodLoot; bool freeMethodLoot;
int32 lootRollLevel; int32 lootRollLevel;

View File

@@ -292,12 +292,8 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
if (!sPlayerbotAIConfig->randomBotAutologin || !sPlayerbotAIConfig->enabled) if (!sPlayerbotAIConfig->randomBotAutologin || !sPlayerbotAIConfig->enabled)
return; return;
if (sPlayerbotAIConfig->enablePrototypePerformanceDiff) if (sPlayerbotAIConfig->botActiveAloneSmartScale)
{ {
LOG_INFO("playerbots", "---------------------------------------");
LOG_INFO("playerbots",
"PROTOTYPE: Playerbot performance enhancements are active. Issues and instability may occur.");
LOG_INFO("playerbots", "---------------------------------------");
ScaleBotActivity(); ScaleBotActivity();
} }
@@ -414,8 +410,9 @@ void RandomPlayerbotMgr::ScaleBotActivity()
// max/min activity // max/min activity
// % increase/decrease wanted diff , avg diff // % increase/decrease wanted diff , avg diff
float activityPercentageMod = pid.calculate( float activityPercentageMod = pid.calculate(sRandomPlayerbotMgr->GetPlayers().empty() ?
sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer, sPlayerbotAIConfig->botActiveAloneSmartScaleDiffEmpty :
sPlayerbotAIConfig->botActiveAloneSmartScaleDiffWithPlayer,
sWorldUpdateTime.GetAverageUpdateTime()); sWorldUpdateTime.GetAverageUpdateTime());
activityPercentage = activityPercentageMod + 50; activityPercentage = activityPercentageMod + 50;

View File

@@ -234,16 +234,15 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
return false; return false;
TeamId teamId = bot->GetTeamId(); TeamId teamId = bot->GetTeamId();
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ?
? sPlayerbotAIConfig->diffEmpty sPlayerbotAIConfig->botActiveAloneSmartScaleDiffEmpty :
: sPlayerbotAIConfig->diffWithPlayer) * sPlayerbotAIConfig->botActiveAloneSmartScaleDiffWithPlayer) * 1.1;
1.1;
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2; uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
uint32 TeamSize = bg->GetMaxPlayersPerTeam(); uint32 TeamSize = bg->GetMaxPlayersPerTeam();
// If performance diff is enabled, only queue if there is no lag // If performance diff is enabled, only queue if there is no lag
if (sPlayerbotAIConfig->enablePrototypePerformanceDiff && !noLag) if (sPlayerbotAIConfig->botActiveAloneSmartScale && !noLag)
return false; return false;
// If the bot is in a group, only the leader can queue // If the bot is in a group, only the leader can queue
@@ -578,16 +577,15 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
return false; return false;
TeamId teamId = bot->GetTeamId(); TeamId teamId = bot->GetTeamId();
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ?
? sPlayerbotAIConfig->diffEmpty sPlayerbotAIConfig->botActiveAloneSmartScaleDiffEmpty :
: sPlayerbotAIConfig->diffWithPlayer) * sPlayerbotAIConfig->botActiveAloneSmartScaleDiffWithPlayer) * 1.1;
1.1;
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2; uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
uint32 TeamSize = bg->GetMaxPlayersPerTeam(); uint32 TeamSize = bg->GetMaxPlayersPerTeam();
// If performance diff is enabled, only queue if there is no lag // If performance diff is enabled, only queue if there is no lag
if (sPlayerbotAIConfig->enablePrototypePerformanceDiff && !noLag) if (sPlayerbotAIConfig->botActiveAloneSmartScale && !noLag)
return false; return false;
// If the bot is in a group, only the leader can queue // If the bot is in a group, only the leader can queue