diff --git a/conf/playerbots.conf.dist b/conf/playerbots.conf.dist index a05eb533..248dc3fa 100644 --- a/conf/playerbots.conf.dist +++ b/conf/playerbots.conf.dist @@ -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 diff --git a/src/PlayerbotAIConfig.cpp b/src/PlayerbotAIConfig.cpp index 272bcc81..f16f7dfc 100644 --- a/src/PlayerbotAIConfig.cpp +++ b/src/PlayerbotAIConfig.cpp @@ -156,7 +156,7 @@ bool PlayerbotAIConfig::Initialize() randomBotAutologin = sConfigMgr->GetOption("AiPlayerbot.RandomBotAutologin", true); minRandomBots = sConfigMgr->GetOption("AiPlayerbot.MinRandomBots", 50); maxRandomBots = sConfigMgr->GetOption("AiPlayerbot.MaxRandomBots", 200); - randomBotUpdateInterval = sConfigMgr->GetOption("AiPlayerbot.RandomBotUpdateInterval", 1); + randomBotUpdateInterval = sConfigMgr->GetOption("AiPlayerbot.RandomBotUpdateInterval", 10); randomBotCountChangeMinInterval = sConfigMgr->GetOption("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE); randomBotCountChangeMaxInterval = diff --git a/src/RandomPlayerbotMgr.cpp b/src/RandomPlayerbotMgr.cpp index 3db15397..ec249c0c 100644 --- a/src/RandomPlayerbotMgr.cpp +++ b/src/RandomPlayerbotMgr.cpp @@ -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(sPlayerbotAIConfig->randomBotUpdateInterval * 0.2))); + randomTime = urand(1, 2); + SetEventValue(bot, "login", 1, randomTime); - randomTime = urand(std::max(5, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval)), - std::max(15, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 2.2))); + randomTime = urand( + std::max(5, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5)), + std::max(12, static_cast(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(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5))); + randomTime = urand( + 3,std::max(4, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 0.4))); + ScheduleRandomize(bot, randomTime); } if (!GetEventValue(bot, "teleport")) { - randomTime = urand(std::max(7, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 0.8)), - std::max(14, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 2))); + randomTime = urand( + std::max(7, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 0.7)), + std::max(14, static_cast(sPlayerbotAIConfig->randomBotUpdateInterval * 1.4))); ScheduleTeleport(bot, randomTime); } + return true; }