mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-24 11:02:48 +00:00
Bots: Rebalance rubberband speeds
- Lv.1 has a significanty lower minimum top speed (from 75% -> 50%) - Lv.MAX has a significantly higher minimum top speed (from 112.5% -> 125%) - Every bot level has a slightly lower maximum top speed (Lv.1: 100% -> 80%, Lv.MAX: 220% -> 200%) - Uses easing functions now to make the distance rubberbanding applies to, and the rubberbanding curves, much more customizable.
This commit is contained in:
parent
7ddfddb3a8
commit
5b5323226f
1 changed files with 23 additions and 29 deletions
52
src/k_bot.c
52
src/k_bot.c
|
|
@ -30,6 +30,7 @@
|
|||
#include "m_perfstats.h"
|
||||
#include "k_podium.h"
|
||||
#include "k_respawn.h"
|
||||
#include "m_easing.h"
|
||||
|
||||
/*--------------------------------------------------
|
||||
boolean K_AddBot(UINT8 skin, UINT8 difficulty, UINT8 *p)
|
||||
|
|
@ -486,8 +487,9 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
|
|||
--------------------------------------------------*/
|
||||
fixed_t K_BotRubberband(player_t *player)
|
||||
{
|
||||
fixed_t rubberband = FRACUNIT;
|
||||
fixed_t rubbermax, rubbermin;
|
||||
fixed_t rubberband = FRACUNIT >> 1;
|
||||
fixed_t rubbermin = FRACUNIT;
|
||||
fixed_t rubbermax = FRACUNIT;
|
||||
player_t *firstplace = NULL;
|
||||
UINT8 i;
|
||||
|
||||
|
|
@ -511,6 +513,18 @@ fixed_t K_BotRubberband(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
// Lv. 1: x0.5 min
|
||||
// Lv. 5: x0.75 min
|
||||
// Lv. 9: x1.0 min
|
||||
// Lv. MAX: x1.25 min
|
||||
rubbermin = FRACUNIT - (((FRACUNIT/2) * (DIFFICULTBOT - player->botvars.difficulty)) / (DIFFICULTBOT - 1));
|
||||
|
||||
// Lv. 1: x0.8 max
|
||||
// Lv. 5: x1.2 max
|
||||
// Lv. 9: x1.4 max
|
||||
// Lv. MAX: x2.0 max
|
||||
rubbermax = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 3)) / 10);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
|
|
@ -534,43 +548,23 @@ fixed_t K_BotRubberband(player_t *player)
|
|||
|
||||
if (firstplace != NULL)
|
||||
{
|
||||
const UINT32 spacing = FixedDiv(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)) / FRACUNIT;
|
||||
const UINT32 wanteddist = firstplace->distancetofinish + K_BotRubberbandDistance(player);
|
||||
const INT32 distdiff = player->distancetofinish - wanteddist;
|
||||
|
||||
if (wanteddist > player->distancetofinish)
|
||||
{
|
||||
// Whoa, you're too far ahead! Slow back down a little.
|
||||
rubberband += (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty)) * (distdiff / 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Catch up to your position!
|
||||
rubberband += player->botvars.difficulty * distdiff;
|
||||
}
|
||||
rubberband += (distdiff * (FRACUNIT >> 1)) / spacing;
|
||||
}
|
||||
|
||||
// Lv. 1: x1.0 max
|
||||
// Lv. 5: x1.4 max
|
||||
// Lv. 9: x1.8 max
|
||||
// Lv. MAX: x2.2 max
|
||||
rubbermax = FRACUNIT + ((FRACUNIT * (player->botvars.difficulty - 1)) / 10);
|
||||
|
||||
// Lv. 1: x0.75 min
|
||||
// Lv. 5: x0.875 min
|
||||
// Lv. 9: x1.0 min
|
||||
// Lv. MAX: x1.125 min
|
||||
rubbermin = FRACUNIT - (((FRACUNIT/4) * (DIFFICULTBOT - player->botvars.difficulty)) / (DIFFICULTBOT - 1));
|
||||
|
||||
if (rubberband > rubbermax)
|
||||
if (rubberband > FRACUNIT)
|
||||
{
|
||||
rubberband = rubbermax;
|
||||
rubberband = FRACUNIT;
|
||||
}
|
||||
else if (rubberband < rubbermin)
|
||||
else if (rubberband < 0)
|
||||
{
|
||||
rubberband = rubbermin;
|
||||
rubberband = 0;
|
||||
}
|
||||
|
||||
return rubberband;
|
||||
return Easing_Linear(rubberband, rubbermin, rubbermax);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue