mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Optimized the firstRandomize, increase pressure when balancing, lower pressue completed
This commit is contained in:
@@ -728,7 +728,7 @@ AiPlayerbot.FastReactInBG = 1
|
|||||||
#
|
#
|
||||||
|
|
||||||
# All In seconds
|
# All In seconds
|
||||||
AiPlayerbot.RandomBotUpdateInterval = 1
|
AiPlayerbot.RandomBotUpdateInterval = 10
|
||||||
AiPlayerbot.RandomBotCountChangeMinInterval = 1800
|
AiPlayerbot.RandomBotCountChangeMinInterval = 1800
|
||||||
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
|
AiPlayerbot.RandomBotCountChangeMaxInterval = 7200
|
||||||
AiPlayerbot.MinRandomBotInWorldTime = 3600
|
AiPlayerbot.MinRandomBotInWorldTime = 3600
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ bool PlayerbotAIConfig::Initialize()
|
|||||||
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
|
randomBotAutologin = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotAutologin", true);
|
||||||
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);
|
minRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MinRandomBots", 50);
|
||||||
maxRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBots", 200);
|
maxRandomBots = sConfigMgr->GetOption<int32>("AiPlayerbot.MaxRandomBots", 200);
|
||||||
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 1);
|
randomBotUpdateInterval = sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotUpdateInterval", 10);
|
||||||
randomBotCountChangeMinInterval =
|
randomBotCountChangeMinInterval =
|
||||||
sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE);
|
sConfigMgr->GetOption<int32>("AiPlayerbot.RandomBotCountChangeMinInterval", 30 * MINUTE);
|
||||||
randomBotCountChangeMaxInterval =
|
randomBotCountChangeMaxInterval =
|
||||||
|
|||||||
@@ -320,7 +320,10 @@ void RandomPlayerbotMgr::UpdateAIInternal(uint32 elapsed, bool /*minimal*/)
|
|||||||
if (onlineBotCount < (uint32)(sPlayerbotAIConfig->minRandomBots * 90 / 100))
|
if (onlineBotCount < (uint32)(sPlayerbotAIConfig->minRandomBots * 90 / 100))
|
||||||
onlineBotFocus = 25;
|
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(
|
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
|
||||||
PERF_MON_TOTAL,
|
PERF_MON_TOTAL,
|
||||||
@@ -961,8 +964,6 @@ void RandomPlayerbotMgr::CheckPlayers()
|
|||||||
void RandomPlayerbotMgr::ScheduleRandomize(uint32 bot, uint32 time)
|
void RandomPlayerbotMgr::ScheduleRandomize(uint32 bot, uint32 time)
|
||||||
{
|
{
|
||||||
SetEventValue(bot, "randomize", 1, 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)
|
void RandomPlayerbotMgr::ScheduleTeleport(uint32 bot, uint32 time)
|
||||||
@@ -1018,24 +1019,29 @@ bool RandomPlayerbotMgr::ProcessBot(uint32 bot)
|
|||||||
if (!player)
|
if (!player)
|
||||||
{
|
{
|
||||||
AddPlayerBot(botGUID, 0);
|
AddPlayerBot(botGUID, 0);
|
||||||
SetEventValue(bot, "login", 1,
|
randomTime = urand(1, 2);
|
||||||
std::max(1, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.2)));
|
SetEventValue(bot, "login", 1, randomTime);
|
||||||
|
|
||||||
randomTime = urand(std::max(5, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval)),
|
randomTime = urand(
|
||||||
std::max(15, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2.2)));
|
std::max(5, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.5)),
|
||||||
|
std::max(12, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2)));
|
||||||
SetEventValue(bot, "update", 1, randomTime);
|
SetEventValue(bot, "update", 1, randomTime);
|
||||||
|
|
||||||
// do not randomize or teleport immediately after server start (prevent lagging)
|
// do not randomize or teleport immediately after server start (prevent lagging)
|
||||||
if (!GetEventValue(bot, "randomize"))
|
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"))
|
if (!GetEventValue(bot, "teleport"))
|
||||||
{
|
{
|
||||||
randomTime = urand(std::max(7, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.8)),
|
randomTime = urand(
|
||||||
std::max(14, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 2)));
|
std::max(7, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 0.7)),
|
||||||
|
std::max(14, static_cast<int>(sPlayerbotAIConfig->randomBotUpdateInterval * 1.4)));
|
||||||
ScheduleTeleport(bot, randomTime);
|
ScheduleTeleport(bot, randomTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user