From 8eee6bd87c840547cfd0c0529d5ba22137b49dc7 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 27 Apr 2024 20:55:01 -0400 Subject: [PATCH 01/11] Tripwire requires more speed if rubberbanding --- src/k_kart.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fba7c2f99..126063d80 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2967,10 +2967,32 @@ boolean K_SlopeResistance(const player_t *player) return false; } +fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player) +{ + fixed_t required_speed = 2 * K_GetKartSpeed(player, false, false); // 200% + + if (player->offroad && K_ApplyOffroad(player)) + { + // Increase to 300% if you're lawnmowering. + required_speed = (required_speed * 3) / 2; + } + + if (player->botvars.rubberband > FRACUNIT && K_PlayerUsesBotMovement(player) == true) + { + // Make it harder for bots to do this when rubberbanding. + + // This is actually biased really hard against the bot, + // because the bot rubberbanding speed increase is + // decreased with other boosts. + + required_speed = FixedMul(top_speed, player->botvars.rubberband); + } + + return required_speed; +} + tripwirepass_t K_TripwirePassConditions(const player_t *player) { - UINT8 tripwirereq = player->offroad ? 3 : 2; - if ( player->invincibilitytimer || player->sneakertimer @@ -2979,7 +3001,7 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player) if ( player->flamedash || - (player->speed > (tripwirereq * K_GetKartSpeed(player, false, false)) && player->tripwireReboundDelay == 0) + (player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0) ) return TRIPWIRE_BOOST; @@ -3053,7 +3075,7 @@ boolean K_WaterRun(mobj_t *mobj) return K_IsHoldingDownTop(mobj->player) == false; } - minspeed = 2 * K_GetKartSpeed(mobj->player, false, false); // 200% + minspeed = K_PlayerTripwireSpeedThreshold(player); if (mobj->player->speed < minspeed / 5) // 40% { @@ -4851,7 +4873,7 @@ void K_ApplyTripWire(player_t *player, tripwirestate_t state) } if (state == TRIPSTATE_PASSED && player->spinouttimer && - player->speed > 2 * K_GetKartSpeed(player, false, true)) + player->speed > K_PlayerTripwireSpeedThreshold(player)) { K_TumblePlayer(player, NULL, NULL); } @@ -14144,7 +14166,7 @@ boolean K_PlayerCanPunt(player_t *player) return true; } - if (player->tripwirePass >= TRIPWIRE_BLASTER && player->speed >= 2 * K_GetKartSpeed(player, false, false)) + if (player->tripwirePass >= TRIPWIRE_BLASTER && player->speed >= K_PlayerTripwireSpeedThreshold(player)) { return true; } From b70e72fc75387b399a01f7a70fa7f58397815e03 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 27 Apr 2024 20:59:30 -0400 Subject: [PATCH 02/11] Higher bot level decrease on retry --- src/g_game.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 6bf730f24..079b7bbab 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1813,14 +1813,20 @@ void G_Ticker(boolean run) { if (playeringame[i]) { - if (players[i].bot == true && grandprixinfo.gp == true && grandprixinfo.masterbots == false) + if (players[i].bot == true + && grandprixinfo.gp == true + && grandprixinfo.masterbots == false) { - UINT8 bot_level_decrease = 2; + UINT8 bot_level_decrease = 3; if (grandprixinfo.gamespeed == KARTSPEED_EASY) - bot_level_decrease = 3; + { + bot_level_decrease++; + } else if (grandprixinfo.gamespeed == KARTSPEED_HARD) - bot_level_decrease = 1; + { + bot_level_decrease--; + } if (players[i].botvars.difficulty <= bot_level_decrease) { From b97c6e34c269fffc2b7e0b902068674e8bb37c79 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sat, 27 Apr 2024 23:46:30 -0700 Subject: [PATCH 03/11] Fix K_PlayerTripwireSpeedThreshold breakage --- src/k_kart.c | 8 ++++---- src/k_kart.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 126063d80..9eae4da16 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2982,10 +2982,10 @@ fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player) // Make it harder for bots to do this when rubberbanding. // This is actually biased really hard against the bot, - // because the bot rubberbanding speed increase is + // because the bot rubberbanding speed increase isgit buil // decreased with other boosts. - required_speed = FixedMul(top_speed, player->botvars.rubberband); + required_speed = FixedMul(required_speed, player->botvars.rubberband); } return required_speed; @@ -3001,7 +3001,7 @@ tripwirepass_t K_TripwirePassConditions(const player_t *player) if ( player->flamedash || - (player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0) + ((player->speed > K_PlayerTripwireSpeedThreshold(player)) && player->tripwireReboundDelay == 0) ) return TRIPWIRE_BOOST; @@ -3075,7 +3075,7 @@ boolean K_WaterRun(mobj_t *mobj) return K_IsHoldingDownTop(mobj->player) == false; } - minspeed = K_PlayerTripwireSpeedThreshold(player); + minspeed = K_PlayerTripwireSpeedThreshold(mobj->player); if (mobj->player->speed < minspeed / 5) // 40% { diff --git a/src/k_kart.h b/src/k_kart.h index eec786f93..09c2d46d4 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -201,6 +201,7 @@ void K_StripOther(player_t *player); void K_MomentumToFacing(player_t *player); boolean K_ApplyOffroad(const player_t *player); boolean K_SlopeResistance(const player_t *player); +fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player); tripwirepass_t K_TripwirePassConditions(const player_t *player); boolean K_TripwirePass(const player_t *player); boolean K_MovingHorizontally(mobj_t *mobj); From 8e6ae6179de8c260516cf52e13a66f841b59982e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 28 Apr 2024 00:12:24 -0700 Subject: [PATCH 04/11] Slower level ups for Easy GP bots --- src/k_grandprix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 297d5d3ed..677d29469 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -642,7 +642,11 @@ void K_IncreaseBotDifficulty(player_t *bot) rankNudge = 0; break; case GRADE_A: - rankNudge = 1; + if (grandprixinfo.gp && grandprixinfo.gamespeed == KARTSPEED_EASY) + rankNudge = 0; + else + rankNudge = 1; + break; } increase += rankNudge; From e287474ef12fc7190654975293e5f2112dc18d55 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 29 Apr 2024 01:35:29 -0400 Subject: [PATCH 05/11] Slowest bot rubberbanding at the end of maps --- src/k_bot.cpp | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/k_bot.cpp b/src/k_bot.cpp index be054fa15..6ee701c62 100644 --- a/src/k_bot.cpp +++ b/src/k_bot.cpp @@ -649,6 +649,18 @@ static UINT32 K_BotRubberbandDistance(const player_t *player) --------------------------------------------------*/ fixed_t K_BotRubberband(const player_t *player) { + if (player->exiting) + { + // You're done, we don't need to rubberband anymore. + return FRACUNIT; + } + + const botcontroller_t *botController = K_GetBotController(player->mo); + if (botController != nullptr && (botController->flags & TMBOT_NORUBBERBAND) == TMBOT_NORUBBERBAND) // Disable rubberbanding + { + return FRACUNIT; + } + const fixed_t difficultyEase = ((player->botvars.difficulty - 1) * FRACUNIT) / (MAXBOTDIFFICULTY - 1); // Lv. 1: x0.65 avg @@ -682,18 +694,6 @@ fixed_t K_BotRubberband(const player_t *player) player_t *firstplace = nullptr; size_t i = SIZE_MAX; - if (player->exiting) - { - // You're done, we don't need to rubberband anymore. - return FRACUNIT; - } - - const botcontroller_t *botController = K_GetBotController(player->mo); - if (botController != nullptr && (botController->flags & TMBOT_NORUBBERBAND) == TMBOT_NORUBBERBAND) // Disable rubberbanding - { - return FRACUNIT; - } - for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || players[i].spectator) @@ -751,6 +751,20 @@ fixed_t K_BotRubberband(const player_t *player) } } + UINT32 scaled_dist = player->distancetofinish; + if (mapobjectscale != FRACUNIT) + { + // Bring back to normal scale. + scaled_dist = FixedDiv(scaled_dist, mapobjectscale); + } + + constexpr UINT32 END_DIST = 2048 * 14; + if (scaled_dist < END_DIST) + { + // At the end of tracks, start slowing down. + rubberband = FixedMul(rubberband, FixedDiv(scaled_dist, END_DIST)); + } + return Easing_Linear(rubberband, rubberSlow, rubberFast); } From eb94b9e6b005f6377028c5bde0f8e197869b3541 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 29 Apr 2024 01:48:47 -0400 Subject: [PATCH 06/11] Fix bot modifier not nerfing rings --- src/k_kart.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 9eae4da16..d066a53df 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10279,12 +10279,7 @@ static void K_UpdatePlayerWaypoints(player_t *const player) INT32 K_GetKartRingPower(const player_t *player, boolean boosted) { fixed_t ringPower = ((9 - player->kartspeed) + (9 - player->kartweight)) * (FRACUNIT/2); - fixed_t basePower = ringPower; - // FIXME: Bot ringboost adjustments can award negative ringboost per ring, which seems bad. - // Revisit these values if bot ringboost needs to respond to low-complexity maps better, - // but for now we're just lazily making sure that bots never have their ringboost "boosted" - // below the value that a player would have when playing the same stat combo. if (boosted == true && K_PlayerUsesBotMovement(player)) { // x2.0 for Lv. 9 @@ -10299,7 +10294,7 @@ INT32 K_GetKartRingPower(const player_t *player, boolean boosted) } } - return max(ringPower, basePower) / FRACUNIT; + return max(ringPower / FRACUNIT, 1); } // Returns false if this player being placed here causes them to collide with any other player From 3d74f386dcbf68c58baa63bd5dc3aff30e48e391 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 29 Apr 2024 03:15:15 -0400 Subject: [PATCH 07/11] Cap bot level increases --- src/k_grandprix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 677d29469..1eefac99c 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -542,9 +542,9 @@ void K_IncreaseBotDifficulty(player_t *bot) bot->botvars.diffincrease = 0; - if (bot->botvars.difficulty >= MAXBOTDIFFICULTY) + if (grandprixinfo.masterbots == true) { - // Already at max difficulty, don't need to increase + // Master bot difficulty is not dynamic. return; } @@ -657,6 +657,11 @@ void K_IncreaseBotDifficulty(player_t *bot) // (Think, like, dire E rank in 4th.) // This is a deviation from SalCodeā„¢ and should be reexamined if bots get drowsy. } + else if (increase > 2) + { + // Hard cap difficulty increase between rounds + increase = 2; + } bot->botvars.diffincrease = increase; } From fb954490c16c56d4248c6c99c0ab3350af4f4a4b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 29 Apr 2024 03:25:11 -0400 Subject: [PATCH 08/11] Fix comment typo --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index d066a53df..64901ac40 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2982,7 +2982,7 @@ fixed_t K_PlayerTripwireSpeedThreshold(const player_t *player) // Make it harder for bots to do this when rubberbanding. // This is actually biased really hard against the bot, - // because the bot rubberbanding speed increase isgit buil + // because the bot rubberbanding speed increase is // decreased with other boosts. required_speed = FixedMul(required_speed, player->botvars.rubberband); From d1001ccc60d2f55773c6097be973e99c610b6a69 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Mon, 29 Apr 2024 20:21:37 -0700 Subject: [PATCH 09/11] Weak bots don't whip --- src/k_botitem.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/k_botitem.cpp b/src/k_botitem.cpp index 4c2c14837..056c0d4aa 100644 --- a/src/k_botitem.cpp +++ b/src/k_botitem.cpp @@ -1497,6 +1497,13 @@ static void K_BotItemInstashield(const player_t *player, ticcmd_t *cmd) return; } + if (player->botvars.difficulty <= 7) + { + // Weak players don't whip. + // Weak bots don't either. + return; + } + // Find players within the instashield's range. for (i = 0; i < MAXPLAYERS; i++) { From 0438dfa770aad93bfd326a487f27455f5cbc20a4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 30 Apr 2024 14:22:56 -0400 Subject: [PATCH 10/11] Revert "Cap bot level increases" This reverts commit 3d74f386dcbf68c58baa63bd5dc3aff30e48e391. --- src/k_grandprix.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 1eefac99c..677d29469 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -542,9 +542,9 @@ void K_IncreaseBotDifficulty(player_t *bot) bot->botvars.diffincrease = 0; - if (grandprixinfo.masterbots == true) + if (bot->botvars.difficulty >= MAXBOTDIFFICULTY) { - // Master bot difficulty is not dynamic. + // Already at max difficulty, don't need to increase return; } @@ -657,11 +657,6 @@ void K_IncreaseBotDifficulty(player_t *bot) // (Think, like, dire E rank in 4th.) // This is a deviation from SalCodeā„¢ and should be reexamined if bots get drowsy. } - else if (increase > 2) - { - // Hard cap difficulty increase between rounds - increase = 2; - } bot->botvars.diffincrease = increase; } From 632872dca47732f4a64c1e52726cdc787c9f7217 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 30 Apr 2024 14:24:12 -0400 Subject: [PATCH 11/11] Fix Lv.MAX bots not being allowed to rank down --- src/k_grandprix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 677d29469..8991a9606 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -542,9 +542,9 @@ void K_IncreaseBotDifficulty(player_t *bot) bot->botvars.diffincrease = 0; - if (bot->botvars.difficulty >= MAXBOTDIFFICULTY) + if (grandprixinfo.masterbots == true) { - // Already at max difficulty, don't need to increase + // Master bot difficulty is not dynamic. return; }