From 2a9351f36e87cf5a2a93344fb4ef24534c192eb0 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 29 Dec 2023 18:09:13 -0700 Subject: [PATCH 1/3] Adjust bot difficulty adjustments --- src/g_game.c | 2 +- src/k_grandprix.c | 54 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 26a4249d1..cde802f76 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1759,7 +1759,7 @@ void G_Ticker(boolean run) { if (players[i].bot == true && grandprixinfo.gp == true && grandprixinfo.masterbots == false) { - const UINT8 bot_level_decrease = (grandprixinfo.gamespeed <= KARTSPEED_NORMAL) ? 3 : 2; + const UINT8 bot_level_decrease = (grandprixinfo.gamespeed == KARTSPEED_EASY) ? 3 : 2; if (players[i].botvars.difficulty <= bot_level_decrease) { diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 994ec43bf..bd4374b78 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -604,11 +604,59 @@ void K_IncreaseBotDifficulty(player_t *bot) disruptDelta = abs(statusQuo - bot->position); increase = (beatenDelta + winnerDelta + disruptDelta - 2) / 3; - increase++; // At least +1 level up. + + INT8 rankNudge = 1; // Generally, we want bots to rank up at least once, but... + + // If humans are struggling, we want to back off, or even derank if it's dire. + // + INT8 totalRank = 0; + INT8 humanPlayers = 0; + for (i = 0; i < MAXPLAYERS; i++) + { + player_t *human = NULL; + + if (playeringame[i] == false) + continue; + + human = &players[i]; + + if (human->spectator == true) + continue; + + if (human->bot == true) + continue; + + humanPlayers++; + + totalRank += human->tally.rank; + } + + INT8 averageRank = totalRank / humanPlayers; + + switch(averageRank) + { + case GRADE_E: + rankNudge = -2; + break; + case GRADE_D: + rankNudge = -1; + break; + case GRADE_C: + case GRADE_B: + rankNudge = 0; + break; + case GRADE_A: + rankNudge = 1; + } + + increase += rankNudge; + + CONS_Printf("BD %d WD %d DD %d NUDGE %d (AR %d), for final increase of %d\n", beatenDelta, winnerDelta, disruptDelta, rankNudge, averageRank, increase); + if (increase <= 0) { - // No increase... - return; + // TYRON: We want to allow SMALL bot rank downs if a player gets rolled but still squeaks by. + // This is a deviation from SalCodeā„¢ and should be reexamined if bots get drowsy. } bot->botvars.diffincrease = increase; From b90004c1a81b53d9a2eb02490ea046366499186a Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 29 Dec 2023 19:35:38 -0700 Subject: [PATCH 2/3] Extra bot difficulty docs --- src/k_grandprix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index bd4374b78..49c594842 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -608,7 +608,7 @@ void K_IncreaseBotDifficulty(player_t *bot) INT8 rankNudge = 1; // Generally, we want bots to rank up at least once, but... // If humans are struggling, we want to back off, or even derank if it's dire. - // + // Average human ranks to determine general bot "rank inertia". INT8 totalRank = 0; INT8 humanPlayers = 0; for (i = 0; i < MAXPLAYERS; i++) @@ -656,6 +656,7 @@ void K_IncreaseBotDifficulty(player_t *bot) if (increase <= 0) { // TYRON: We want to allow SMALL bot rank downs if a player gets rolled but still squeaks by. + // (Think, like, dire E rank in 4th.) // This is a deviation from SalCodeā„¢ and should be reexamined if bots get drowsy. } From a0e4c10f77281a51fc2aee788105d2a4257fc928 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Fri, 29 Dec 2023 20:05:02 -0700 Subject: [PATCH 3/3] Remove bot difficulty debug print --- src/k_grandprix.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 49c594842..77841e3ae 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -651,8 +651,6 @@ void K_IncreaseBotDifficulty(player_t *bot) increase += rankNudge; - CONS_Printf("BD %d WD %d DD %d NUDGE %d (AR %d), for final increase of %d\n", beatenDelta, winnerDelta, disruptDelta, rankNudge, averageRank, increase); - if (increase <= 0) { // TYRON: We want to allow SMALL bot rank downs if a player gets rolled but still squeaks by.