mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'bot-relaxer' into 'master'
Bot difficulty responds to ranking (resolves #817) Closes #817 See merge request KartKrew/Kart!1749
This commit is contained in:
commit
9ce15d3e15
2 changed files with 51 additions and 4 deletions
|
|
@ -1759,7 +1759,7 @@ void G_Ticker(boolean run)
|
||||||
{
|
{
|
||||||
if (players[i].bot == true && grandprixinfo.gp == true && grandprixinfo.masterbots == false)
|
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)
|
if (players[i].botvars.difficulty <= bot_level_decrease)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -604,11 +604,58 @@ void K_IncreaseBotDifficulty(player_t *bot)
|
||||||
disruptDelta = abs(statusQuo - bot->position);
|
disruptDelta = abs(statusQuo - bot->position);
|
||||||
|
|
||||||
increase = (beatenDelta + winnerDelta + disruptDelta - 2) / 3;
|
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.
|
||||||
|
// Average human ranks to determine general bot "rank inertia".
|
||||||
|
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;
|
||||||
|
|
||||||
if (increase <= 0)
|
if (increase <= 0)
|
||||||
{
|
{
|
||||||
// No increase...
|
// TYRON: We want to allow SMALL bot rank downs if a player gets rolled but still squeaks by.
|
||||||
return;
|
// (Think, like, dire E rank in 4th.)
|
||||||
|
// This is a deviation from SalCode™ and should be reexamined if bots get drowsy.
|
||||||
}
|
}
|
||||||
|
|
||||||
bot->botvars.diffincrease = increase;
|
bot->botvars.diffincrease = increase;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue