From b9f91cb7ecadafef72117d417146c3123fe33ee1 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 30 Mar 2022 15:25:55 -0400 Subject: [PATCH] Increase bot difficulty range to 13 While I finally pushed to do this because of the epic Blue Sphere reference, I was kinda thinking about doing this for a while, because it gives more room for bots to level up during Hard GP. I thought about just making the new level cap go up normally, but I decided on keeping the bots' passive buffs (like top speed & ring boosts) go up linearly, while rubberbanding range is kept the same. I don't think I can properly explain it, but this basically means level 13s are a touch harder than old level 9s before, and new level 9s are touch easier than old level 9s. Basically think of it as more level range than actually making the bots harder. The expanded range means that Hard GP can start off easier, but end harder. (And of course, Master is even more ridiculous c:) --- src/d_clisrv.c | 2 +- src/d_netcmd.c | 6 +++++- src/k_bot.c | 30 ++++++++++++++++++++---------- src/k_bot.h | 5 ++++- src/k_kart.c | 4 ++-- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 7f6e6f287..f56e07777 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3413,7 +3413,7 @@ static void Got_AddBot(UINT8 **p, INT32 playernum) { INT16 newplayernum; UINT8 skinnum = 0; - UINT8 difficulty = MAXBOTDIFFICULTY; + UINT8 difficulty = DIFFICULTBOT; if (playernum != serverplayer && !IsPlayerAdmin(playernum)) { diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 51b6b97d6..855353d9f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -399,9 +399,13 @@ static CV_PossibleValue_t kartbot_cons_t[] = { {7, "Lv.7"}, {8, "Lv.8"}, {9, "Lv.9"}, + {10,"Lv.10"}, + {11,"Lv.11"}, + {12,"Lv.12"}, + {13,"Lv.MAX"}, {0, NULL} }; -consvar_t cv_kartbot = CVAR_INIT ("kartbot", "0", CV_NETVAR|CV_CHEAT, kartbot_cons_t, NULL); +consvar_t cv_kartbot = CVAR_INIT ("kartbot", "0", CV_NETVAR, kartbot_cons_t, NULL); consvar_t cv_karteliminatelast = CVAR_INIT ("karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL, CV_YesNo, KartEliminateLast_OnChange); diff --git a/src/k_bot.c b/src/k_bot.c index f31317546..7715cec90 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -477,24 +477,34 @@ fixed_t K_BotRubberband(player_t *player) if (wanteddist > player->distancetofinish) { // Whoa, you're too far ahead! Slow back down a little. - rubberband += (MAXBOTDIFFICULTY - player->botvars.difficulty) * (distdiff / 3); + rubberband += (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty)) * (distdiff / 3); } else { // Catch up to your position! - rubberband += (2*player->botvars.difficulty) * distdiff; + rubberband += player->botvars.difficulty * distdiff; } } - // Lv. 1: x1.0 max - // Lv. 5: x1.5 max - // Lv. 9: x2.0 max +#if 0 + // Lv. 1: x1.0 max + // Lv. 5: x1.5 max + // Lv. 9: x2.0 max + // Lv. MAX: x2.5 max + max = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / (DIFFICULTBOT - 1)); +#else + // Lv. 1: x1.0 max + // Lv. 5: x1.333 max + // Lv. 9: x1.667 max + // Lv. MAX: x2.0 max max = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / (MAXBOTDIFFICULTY - 1)); +#endif - // Lv. 1: x0.75 min - // Lv. 5: x0.875 min - // Lv. 9: x1.0 min - min = FRACUNIT - (((FRACUNIT/4) * (MAXBOTDIFFICULTY - player->botvars.difficulty)) / (MAXBOTDIFFICULTY - 1)); + // Lv. 1: x0.75 min + // Lv. 5: x0.875 min + // Lv. 9: x1.0 min + // Lv. MAX: x1.0 min + min = FRACUNIT - (((FRACUNIT/4) * (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty))) / (DIFFICULTBOT - 1)); if (rubberband > max) { @@ -851,7 +861,7 @@ static UINT8 K_TrySpindash(player_t *player) { INT32 boosthold = starttime - K_GetSpindashChargeTime(player); - boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty) * difficultyModifier; + boosthold -= (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty)) * difficultyModifier; if (leveltime >= (unsigned)boosthold) { diff --git a/src/k_bot.h b/src/k_bot.h index a04d5c174..be0242449 100644 --- a/src/k_bot.h +++ b/src/k_bot.h @@ -18,7 +18,10 @@ #include "r_defs.h" // Maximum value of botvars.difficulty -#define MAXBOTDIFFICULTY 9 +#define MAXBOTDIFFICULTY 13 + +// Level of a "difficult" bot. The max bot level was increased, but this keeps all of the same calculations. +#define DIFFICULTBOT 9 // How many tics in a row do you need to turn in this direction before we'll let you turn. // Made it as small as possible without making it look like the bots are twitching constantly. diff --git a/src/k_kart.c b/src/k_kart.c index 58cb6fe31..c2f53632c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2982,7 +2982,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) if (K_PlayerUsesBotMovement(player)) { // Increase bot speed by 1-10% depending on difficulty - fixed_t add = (player->botvars.difficulty * (FRACUNIT/10)) / MAXBOTDIFFICULTY; + fixed_t add = (player->botvars.difficulty * (FRACUNIT/10)) / DIFFICULTBOT; finalspeed = FixedMul(finalspeed, FRACUNIT + add); if (player->botvars.rival == true) @@ -7849,7 +7849,7 @@ INT32 K_GetKartRingPower(player_t *player, boolean boosted) if (boosted == true && K_PlayerUsesBotMovement(player)) { // Double for Lv. 9 - ringPower += (player->botvars.difficulty * ringPower) / MAXBOTDIFFICULTY; + ringPower += (player->botvars.difficulty * ringPower) / DIFFICULTBOT; } return ringPower;