diff --git a/src/d_clisrv.c b/src/d_clisrv.c index f4203fc7d..94f4084f6 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5638,8 +5638,6 @@ static void SV_Maketic(void) // Moved here so bots and packetloss indication doesn't break.... G_MoveTiccmd(netcmds[maketic % BACKUPTICS], playercmds, MAXPLAYERS); - PS_ResetBotInfo(); - for (i = 0; i < MAXPLAYERS; i++) { packetloss[i][maketic%PACKETMEASUREWINDOW] = false; @@ -5649,13 +5647,7 @@ static void SV_Maketic(void) if (K_PlayerUsesBotMovement(&players[i])) { - const precise_t t = I_GetPreciseTime(); - K_BuildBotTiccmd(&players[i], &netcmds[maketic%BACKUPTICS][i]); - - ps_bots[i].isBot = true; - ps_bots[i].total = I_GetPreciseTime() - t; - ps_botticcmd_time += ps_bots[i].total; continue; } diff --git a/src/k_bot.cpp b/src/k_bot.cpp index 06b3a3579..483d370e7 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -1178,7 +1178,7 @@ static void K_BotStartDrift(botdata_t *bd, player_t* player) { // Randomly decide to drift based on our skill at drifting, // and how fast we're moving. - fixed_t driftpotential = P_RandomKey(MAXDRIFTSKILL); + fixed_t driftpotential = M_RandomKey(MAXDRIFTSKILL); if ((driftpotential <= player->botvars.driftskill) && (botDriftSpeed <= player->speed)) diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 993b16ab7..335d9bdbc 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -370,10 +370,14 @@ static void M_DrawTickStats(void) {0} }; + perfstatrow_t bot_time_row[] = { + {"botcmd ", "Bot logic: ", &ps_botticcmd_time}, + {0} + }; + perfstatrow_t extra_thinker_time_row[] = { {"lthinkf", "LUAh_ThinkFrame:", &ps_lua_thinkframe_time}, {"acs ", "ACS_Tick: ", &ps_acs_time}, - {"botcmd ", "Bot logic: ", &ps_botticcmd_time}, {"other ", "Other: ", &extratime}, {0} }; @@ -417,6 +421,7 @@ static void M_DrawTickStats(void) perfstatcol_t tictime_col = {20, 20, V_YELLOWMAP, tictime_row}; perfstatcol_t thinker_time_col = {24, 24, V_YELLOWMAP, thinker_time_row}; perfstatcol_t detailed_thinker_time_col = {28, 28, V_YELLOWMAP, detailed_thinker_time_row}; + perfstatcol_t bot_time_col = {24, 24, V_YELLOWMAP, bot_time_row}; perfstatcol_t extra_thinker_time_col = {24, 24, V_YELLOWMAP, extra_thinker_time_row}; perfstatcol_t thinkercount_col = {90, 115, V_BLUEMAP, thinkercount_row}; @@ -462,6 +467,8 @@ static void M_DrawTickStats(void) M_DrawPerfTiming(&tictime_col); M_DrawPerfTiming(&thinker_time_col); M_DrawPerfTiming(&detailed_thinker_time_col); + if (server) + M_DrawPerfTiming(&bot_time_col); M_DrawPerfTiming(&extra_thinker_time_col); draw_row = 10; @@ -504,7 +511,11 @@ void M_DrawPerfStats(void) } else if (cv_perfstats.value == PS_BOT) // bot ticcmd { - if (vid.width < 640 || vid.height < 400) // low resolution + if (!server) + { + V_DrawThinString(30, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Not applicable to clients"); + } + else if (vid.width < 640 || vid.height < 400) // low resolution { // it's not gonna fit very well.. V_DrawThinString(30, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, "Not available for resolutions below 640x400"); diff --git a/src/p_tick.c b/src/p_tick.c index ec780568f..c51a5aa83 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -770,9 +770,23 @@ void P_Ticker(boolean run) // run all the bot tickers if (server) + { + PS_ResetBotInfo(); for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i] && players[i].bot && players[i].mo && !P_MobjWasRemoved(players[i].mo)) - K_BotTicker(&players[i]); + { + player_t *player = &players[i]; + if (playeringame[i] && player->mo && !P_MobjWasRemoved(player->mo) && K_PlayerUsesBotMovement(player)) + { + const precise_t t = I_GetPreciseTime(); + + K_BotTicker(player); + + ps_bots[i].total = I_GetPreciseTime() - t; + ps_bots[i].isBot = true; + ps_botticcmd_time += ps_bots[i].total; + } + } + } // Bosses have a punchy start, so no position. if (bossinfo.boss == true)