mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Slow down bots on straightaways (reinventing the accel wheel)
This commit is contained in:
parent
53129a6b73
commit
a8ef3d0204
5 changed files with 18 additions and 1 deletions
|
|
@ -430,6 +430,7 @@ struct botvars_t
|
|||
tic_t rouletteTimeout; // If it takes too long to decide, try lowering priority until we find something valid.
|
||||
|
||||
angle_t predictionError; // How bad is our momentum angle relative to where we're trying to go?
|
||||
INT16 straightawayTime; // How long have we been going straight? (See k_bot.h)
|
||||
};
|
||||
|
||||
// player_t struct for round-specific condition tracking
|
||||
|
|
|
|||
|
|
@ -823,6 +823,7 @@ fixed_t K_BotRubberband(const player_t *player)
|
|||
fixed_t K_UpdateRubberband(player_t *player)
|
||||
{
|
||||
fixed_t dest = K_BotRubberband(player);
|
||||
dest = (player->botvars.straightawayTime > 0) ? FixedMul(BOTSTRAIGHTSTRENGTH, dest) : dest;
|
||||
fixed_t ret = player->botvars.rubberband;
|
||||
|
||||
UINT8 ease_soften = 8;
|
||||
|
|
@ -2123,6 +2124,14 @@ void K_UpdateBotGameplayVars(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->botvars.predictionError <= BOTSTRAIGHTANGLE)
|
||||
player->botvars.straightawayTime++;
|
||||
else
|
||||
player->botvars.straightawayTime -= 5;
|
||||
|
||||
player->botvars.straightawayTime = std::min<INT16>(player->botvars.straightawayTime, BOTSTRAIGHTTIME);
|
||||
player->botvars.straightawayTime = std::max<INT16>(player->botvars.straightawayTime, -1 * BOTSTRAIGHTTIME);
|
||||
|
||||
const botcontroller_t *botController = K_GetBotController(player->mo);
|
||||
if (K_TryRingShooter(player, botController) == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ extern "C" {
|
|||
// How long it takes for a Lv.1 bot to decide to pick an item.
|
||||
#define BOT_ITEM_DECISION_TIME (2*TICRATE)
|
||||
|
||||
#define BOTSTRAIGHTTIME (TICRATE/2)
|
||||
#define BOTSTRAIGHTSTRENGTH (85*FRACUNIT/100)
|
||||
#define BOTSTRAIGHTANGLE (ANG10)
|
||||
|
||||
// Point for bots to aim for
|
||||
struct botprediction_t
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7096,6 +7096,7 @@ static void K_DrawBotDebugger(void)
|
|||
V_DrawSmallString(8, 70, 0, va("Bot modifier: %.2f", FixedToFloat(K_BotMapModifier())));
|
||||
|
||||
V_DrawSmallString(8, 76, 0, va("Prediction error: %d", bot->botvars.predictionError));
|
||||
V_DrawSmallString(8, 80, 0, va("Straight: %d", bot->botvars.straightawayTime));
|
||||
}
|
||||
|
||||
static void K_DrawGPRankDebugger(void)
|
||||
|
|
|
|||
|
|
@ -756,7 +756,8 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
WRITEUINT32(save->p, players[i].botvars.spindashconfirm);
|
||||
WRITEUINT32(save->p, players[i].botvars.respawnconfirm);
|
||||
WRITEUINT8(save->p, players[i].botvars.roulettePriority);
|
||||
WRITEUINT32(save->p, players[i].botvars.rouletteTimeout);
|
||||
WRITEINT32(save->p, players[i].botvars.rouletteTimeout);
|
||||
WRITEINT16(save->p, players[i].botvars.straightawayTime);
|
||||
|
||||
// itemroulette_t
|
||||
WRITEUINT8(save->p, players[i].itemRoulette.active);
|
||||
|
|
@ -1409,6 +1410,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
players[i].botvars.respawnconfirm = READUINT32(save->p);
|
||||
players[i].botvars.roulettePriority = READUINT8(save->p);
|
||||
players[i].botvars.rouletteTimeout = READUINT32(save->p);
|
||||
players[i].botvars.straightawayTime = READINT16(save->p);
|
||||
|
||||
// itemroulette_t
|
||||
players[i].itemRoulette.active = (boolean)READUINT8(save->p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue