Optimized the firstRandomize, increase pressure when balancing, lower pressue completed

This commit is contained in:
bash
2024-09-27 09:33:05 +00:00
parent df341cf4d9
commit e7f11f9bdb
3 changed files with 18 additions and 12 deletions

View File

@@ -728,7 +728,7 @@ AiPlayerbot.FastReactInBG = 1
#
# All In seconds
AiPlayerbot.RandomBotUpdateInterval = 1
AiPlayerbot.RandomBotUpdateInterval = 10
AiPlayerbot.RandomBotCountChangeMinInterval = 1800
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
AiPlayerbot.MinRandomBotInWorldTime = 3600

View File

@@ -156,7 +156,7 @@ bool PlayerbotAIConfig::Initialize()
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);
maxRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBots", 200);
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 1);
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 10);
randomBotCountChangeMinInterval =
sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE);
randomBotCountChangeMaxInterval =

View File

@@ -320,7 +320,10 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
if (onlineBotCount < (uint32)(sPlayerbotAIConfig->minRandomBots * 90 / 100))
onlineBotFocus = 25;
SetNextCheckDelay(sPlayerbotAIConfig->randomBotUpdateInterval * (onlineBotFocus + 25) * 10);
// when server is balancing bots then boost (decrease value of) the nextCheckDelay till
// onlineBotCount reached the AllowedBotCount.
uint32 updateIntervalTurboBoost = onlineBotCount < maxAllowedBotCount ? 1 : sPlayerbotAIConfig->randomBotUpdateInterval;
SetNextCheckDelay(updateIntervalTurboBoost * (onlineBotFocus + 25) * 10);
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
PERF_MON_TOTAL,
@@ -961,8 +964,6 @@ void RandomPlayerbotMgr::CheckPlayers()
void RandomPlayerbotMgr::ScheduleRandomize(uint32 bot, uint32 time)
{
SetEventValue(bot, "randomize", 1, time);
// SetEventValue(bot, "logout", 1, time + 30 + urand(sPlayerbotAIConfig->randomBotUpdateInterval,
// sPlayerbotAIConfig->randomBotUpdateInterval * 3));
}
void RandomPlayerbotMgr::ScheduleTeleport(uint32 bot, uint32 time)
@@ -1018,24 +1019,29 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
if (!player)
{
AddPlayerBot(botGUID, 0);
SetEventValue(bot, "login", 1,
std::max(1, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.2)));
randomTime = urand(1, 2);
SetEventValue(bot, "login", 1, randomTime);
randomTime = urand(std::max(5, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval)),
std::max(15, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2.2)));
randomTime = urand(
std::max(5, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5)),
std::max(12, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2)));
SetEventValue(bot, "update", 1, randomTime);
// do not randomize or teleport immediately after server start (prevent lagging)
if (!GetEventValue(bot, "randomize"))
{
ScheduleRandomize(bot, std::max(3, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5)));
randomTime = urand(
3,std::max(4, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.4)));
ScheduleRandomize(bot, randomTime);
}
if (!GetEventValue(bot, "teleport"))
{
randomTime = urand(std::max(7, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.8)),
std::max(14, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2)));
randomTime = urand(
std::max(7, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.7)),
std::max(14, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 1.4)));
ScheduleTeleport(bot, randomTime);
}
return true;
}