mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-27 07:51:36 +00:00
Bots: Improve rubberbanding further
- Use easing functions for the rubberbanding values themselves, for more fine-control over the end-points and the curves. - Fixed K_UpdateRubberband being broken from using shift instead of divide. - Rename `debugbotpredict` to `debugbots`, it now displays some of the bots' botvars values as well. If the player isn't a bot, it will show them from the first place bot (for inspecting the rubberband value). - Bot turning buff was increased, from x1.25 to x2.0. Noticed that Tails bots were failing turns on Popcorn Workshop. I personally think that Tails bots shouldn't be failing very many turns unless if they're finding objects, and constant wall-bumping should be reserved for Eggman and Metal :P
This commit is contained in:
parent
5b5323226f
commit
724beb0ffe
5 changed files with 103 additions and 31 deletions
|
|
@ -449,7 +449,7 @@ consvar_t cv_kartdebugdistribution = CVAR_INIT ("debugitemodds", "Off", CV_NETVA
|
|||
consvar_t cv_kartdebughuddrop = CVAR_INIT ("debugitemdrop", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
|
||||
static CV_PossibleValue_t kartdebugwaypoint_cons_t[] = {{0, "Off"}, {1, "Forwards"}, {2, "Backwards"}, {0, NULL}};
|
||||
consvar_t cv_kartdebugwaypoints = CVAR_INIT ("debugwaypoints", "Off", CV_NETVAR|CV_CHEAT, kartdebugwaypoint_cons_t, NULL);
|
||||
consvar_t cv_kartdebugbotpredict = CVAR_INIT ("debugbotpredict", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_kartdebugbots = CVAR_INIT ("debugbots", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_kartdebugnodes = CVAR_INIT ("debugnodes", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_kartdebugcolorize = CVAR_INIT ("debugcolorize", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
consvar_t cv_kartdebugdirector = CVAR_INIT ("debugdirector", "Off", CV_CHEAT, CV_OnOff, NULL);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ extern consvar_t cv_botscanvote;
|
|||
extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugdistribution, cv_kartdebughuddrop;
|
||||
extern consvar_t cv_kartdebugnodes, cv_kartdebugcolorize, cv_kartdebugdirector;
|
||||
extern consvar_t cv_spbtest, cv_reducevfx;
|
||||
extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbotpredict;
|
||||
extern consvar_t cv_kartdebugwaypoints, cv_kartdebugbots;
|
||||
extern consvar_t cv_debugrank;
|
||||
extern consvar_t cv_battletest;
|
||||
|
||||
|
|
|
|||
58
src/k_bot.c
58
src/k_bot.c
|
|
@ -487,11 +487,19 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
|
|||
--------------------------------------------------*/
|
||||
fixed_t K_BotRubberband(player_t *player)
|
||||
{
|
||||
const fixed_t difficultyEase = ((player->botvars.difficulty - 1) * FRACUNIT) / (DIFFICULTBOT - 1);
|
||||
|
||||
// Lv. 1: x0.35 min
|
||||
// Lv. 9: x1.35 min
|
||||
const fixed_t rubbermin = Easing_Linear(difficultyEase, FRACUNIT * 35 / 100, FRACUNIT * 135 / 100);
|
||||
|
||||
// Lv. 1: x1.0 max
|
||||
// Lv. 9: x1.65 max
|
||||
const fixed_t rubbermax = Easing_Linear(difficultyEase, FRACUNIT, FRACUNIT * 165 / 100);
|
||||
|
||||
fixed_t rubberband = FRACUNIT >> 1;
|
||||
fixed_t rubbermin = FRACUNIT;
|
||||
fixed_t rubbermax = FRACUNIT;
|
||||
player_t *firstplace = NULL;
|
||||
UINT8 i;
|
||||
size_t i = SIZE_MAX;
|
||||
|
||||
if (player->exiting)
|
||||
{
|
||||
|
|
@ -513,18 +521,6 @@ 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)
|
||||
|
|
@ -548,20 +544,28 @@ fixed_t K_BotRubberband(player_t *player)
|
|||
|
||||
if (firstplace != NULL)
|
||||
{
|
||||
const UINT32 spacing = FixedDiv(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)) / FRACUNIT;
|
||||
// Lv. 1: 5120 units
|
||||
// Lv. 9: 320 units
|
||||
const fixed_t spacing = FixedDiv(
|
||||
max(
|
||||
80 * mapobjectscale,
|
||||
Easing_Linear(difficultyEase, 5120 * mapobjectscale, 320 * mapobjectscale)
|
||||
),
|
||||
K_GetKartGameSpeedScalar(gamespeed)
|
||||
) / FRACUNIT;
|
||||
const UINT32 wanteddist = firstplace->distancetofinish + K_BotRubberbandDistance(player);
|
||||
const INT32 distdiff = player->distancetofinish - wanteddist;
|
||||
|
||||
rubberband += (distdiff * (FRACUNIT >> 1)) / spacing;
|
||||
}
|
||||
rubberband = FixedDiv(distdiff + spacing, spacing * 2);
|
||||
|
||||
if (rubberband > FRACUNIT)
|
||||
{
|
||||
rubberband = FRACUNIT;
|
||||
}
|
||||
else if (rubberband < 0)
|
||||
{
|
||||
rubberband = 0;
|
||||
if (rubberband > FRACUNIT)
|
||||
{
|
||||
rubberband = FRACUNIT;
|
||||
}
|
||||
else if (rubberband < 0)
|
||||
{
|
||||
rubberband = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return Easing_Linear(rubberband, rubbermin, rubbermax);
|
||||
|
|
@ -578,7 +582,7 @@ fixed_t K_UpdateRubberband(player_t *player)
|
|||
fixed_t ret = player->botvars.rubberband;
|
||||
|
||||
// Ease into the new value.
|
||||
ret += (dest - player->botvars.rubberband) >> 3;
|
||||
ret += (dest - player->botvars.rubberband) / 8;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1732,7 +1736,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
// Free the prediction we made earlier
|
||||
if (predict != NULL)
|
||||
{
|
||||
if (cv_kartdebugbotpredict.value != 0 && player - players == displayplayers[0])
|
||||
if (cv_kartdebugbots.value != 0 && player - players == displayplayers[0])
|
||||
{
|
||||
K_DrawPredictionDebug(predict, player);
|
||||
}
|
||||
|
|
|
|||
68
src/k_hud.c
68
src/k_hud.c
|
|
@ -4994,6 +4994,73 @@ static void K_DrawWaypointDebugger(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void K_DrawBotDebugger(void)
|
||||
{
|
||||
player_t *bot = NULL;
|
||||
|
||||
if (cv_kartdebugbots.value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (stplyr != &players[displayplayers[0]]) // only for p1
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (stplyr->bot == true)
|
||||
{
|
||||
// we ARE the bot
|
||||
bot = stplyr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// get winning bot
|
||||
size_t i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
player_t *p = NULL;
|
||||
|
||||
if (playeringame[i] == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
p = &players[i];
|
||||
if (p->spectator == true || p->bot == false)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bot == NULL || p->distancetofinish < bot->distancetofinish)
|
||||
{
|
||||
bot = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bot == NULL)
|
||||
{
|
||||
// no bot exists?
|
||||
return;
|
||||
}
|
||||
|
||||
V_DrawSmallString(8, 8, 0, va("Difficulty: %d / %d", bot->botvars.difficulty, MAXBOTDIFFICULTY));
|
||||
V_DrawSmallString(8, 12, 0, va("Difficulty increase: %d", bot->botvars.diffincrease));
|
||||
V_DrawSmallString(8, 16, 0, va("Rival: %d", (UINT8)(bot->botvars.rival == true)));
|
||||
V_DrawSmallString(8, 20, 0, va("Rubberbanding: %.02f", FIXED_TO_FLOAT(bot->botvars.rubberband) * 100.0f));
|
||||
|
||||
V_DrawSmallString(8, 26, 0, va("Item delay: %d", bot->botvars.itemdelay));
|
||||
V_DrawSmallString(8, 30, 0, va("Item confirm: %d", bot->botvars.itemconfirm));
|
||||
|
||||
V_DrawSmallString(8, 36, 0, va("Turn: %d / %d / %d", -BOTTURNCONFIRM, bot->botvars.turnconfirm, BOTTURNCONFIRM));
|
||||
V_DrawSmallString(8, 40, 0, va("Spindash: %d / %d", bot->botvars.spindashconfirm, BOTSPINDASHCONFIRM));
|
||||
V_DrawSmallString(8, 44, 0, va("Respawn: %d / %d", bot->botvars.respawnconfirm, BOTRESPAWNCONFIRM));
|
||||
|
||||
V_DrawSmallString(8, 50, 0, va("Item priority: %d", bot->botvars.roulettePriority));
|
||||
V_DrawSmallString(8, 54, 0, va("Item timeout: %d", bot->botvars.rouletteTimeout));
|
||||
}
|
||||
|
||||
static void K_DrawGPRankDebugger(void)
|
||||
{
|
||||
gp_rank_e grade = GRADE_E;
|
||||
|
|
@ -5321,6 +5388,7 @@ void K_drawKartHUD(void)
|
|||
}
|
||||
|
||||
K_DrawWaypointDebugger();
|
||||
K_DrawBotDebugger();
|
||||
K_DrawDirectorDebugger();
|
||||
K_DrawGPRankDebugger();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ void K_RegisterKartStuff(void)
|
|||
CV_RegisterVar(&cv_kartdebugdistribution);
|
||||
CV_RegisterVar(&cv_kartdebughuddrop);
|
||||
CV_RegisterVar(&cv_kartdebugwaypoints);
|
||||
CV_RegisterVar(&cv_kartdebugbotpredict);
|
||||
CV_RegisterVar(&cv_kartdebugbots);
|
||||
|
||||
CV_RegisterVar(&cv_kartdebugnodes);
|
||||
CV_RegisterVar(&cv_kartdebugcolorize);
|
||||
|
|
@ -9004,7 +9004,7 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
|
|||
|
||||
if (K_PlayerUsesBotMovement(player))
|
||||
{
|
||||
turnfixed = FixedMul(turnfixed, 5*FRACUNIT/4); // Base increase to turning
|
||||
turnfixed = FixedMul(turnfixed, 2*FRACUNIT); // Base increase to turning
|
||||
}
|
||||
|
||||
if (player->drift != 0 && P_IsObjectOnGround(player->mo))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue