mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-22 22:46:12 +00:00
Merge branch 'bot-game-speed' into 'master'
Bots: Rebalance rubberband speeds See merge request KartKrew/Kart!1244
This commit is contained in:
commit
15dce65efb
7 changed files with 114 additions and 43 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;
|
||||
|
||||
|
|
|
|||
68
src/k_bot.c
68
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,10 +487,19 @@ static UINT32 K_BotRubberbandDistance(player_t *player)
|
|||
--------------------------------------------------*/
|
||||
fixed_t K_BotRubberband(player_t *player)
|
||||
{
|
||||
fixed_t rubberband = FRACUNIT;
|
||||
fixed_t rubbermax, rubbermin;
|
||||
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;
|
||||
player_t *firstplace = NULL;
|
||||
UINT8 i;
|
||||
size_t i = SIZE_MAX;
|
||||
|
||||
if (player->exiting)
|
||||
{
|
||||
|
|
@ -534,43 +544,31 @@ fixed_t K_BotRubberband(player_t *player)
|
|||
|
||||
if (firstplace != NULL)
|
||||
{
|
||||
// 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;
|
||||
|
||||
if (wanteddist > player->distancetofinish)
|
||||
rubberband = FixedDiv(distdiff + spacing, spacing * 2);
|
||||
|
||||
if (rubberband > FRACUNIT)
|
||||
{
|
||||
// Whoa, you're too far ahead! Slow back down a little.
|
||||
rubberband += (DIFFICULTBOT - min(DIFFICULTBOT, player->botvars.difficulty)) * (distdiff / 3);
|
||||
rubberband = FRACUNIT;
|
||||
}
|
||||
else
|
||||
else if (rubberband < 0)
|
||||
{
|
||||
// Catch up to your position!
|
||||
rubberband += player->botvars.difficulty * distdiff;
|
||||
rubberband = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
rubberband = rubbermax;
|
||||
}
|
||||
else if (rubberband < rubbermin)
|
||||
{
|
||||
rubberband = rubbermin;
|
||||
}
|
||||
|
||||
return rubberband;
|
||||
return Easing_Linear(rubberband, rubbermin, rubbermax);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -584,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;
|
||||
}
|
||||
|
|
@ -1559,8 +1557,8 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
|
|||
if (leveltime <= starttime && finishBeamLine != NULL)
|
||||
{
|
||||
// Handle POSITION!!
|
||||
const fixed_t distBase = 384*mapobjectscale;
|
||||
const fixed_t distAdjust = 64*mapobjectscale;
|
||||
const fixed_t distBase = 480*mapobjectscale;
|
||||
const fixed_t distAdjust = 128*mapobjectscale;
|
||||
|
||||
const fixed_t closeDist = distBase + (distAdjust * (9 - player->kartweight));
|
||||
const fixed_t farDist = closeDist + (distAdjust * 2);
|
||||
|
|
@ -1738,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1394,8 +1394,8 @@ static void K_BotItemRings(player_t *player, ticcmd_t *cmd)
|
|||
--------------------------------------------------*/
|
||||
static void K_BotItemRouletteMash(player_t *player, ticcmd_t *cmd)
|
||||
{
|
||||
// 12 tics late for Lv.1, frame-perfect for Lv.MAX
|
||||
const tic_t confirmTime = (MAXBOTDIFFICULTY - player->botvars.difficulty);
|
||||
// 24 tics late for Lv.1, frame-perfect for Lv.MAX
|
||||
const tic_t confirmTime = (MAXBOTDIFFICULTY - player->botvars.difficulty) * 2;
|
||||
|
||||
if (K_ItemButtonWasDown(player) == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -989,7 +989,7 @@ INT32 K_PositionBully(player_t *player)
|
|||
anglediff = 360-(AngleFixed(angle)>>FRACBITS);
|
||||
}
|
||||
|
||||
if (anglediff < 30)
|
||||
if (abs(anglediff) < 30)
|
||||
return 0;
|
||||
|
||||
if (anglediff < 0)
|
||||
|
|
|
|||
70
src/k_hud.c
70
src/k_hud.c
|
|
@ -5012,6 +5012,75 @@ 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(16, 8, V_YELLOWMAP, va("Bot: %s", player_names[bot - players]));
|
||||
|
||||
V_DrawSmallString(8, 14, 0, va("Difficulty: %d / %d", bot->botvars.difficulty, MAXBOTDIFFICULTY));
|
||||
V_DrawSmallString(8, 18, 0, va("Difficulty increase: %d", bot->botvars.diffincrease));
|
||||
V_DrawSmallString(8, 22, 0, va("Rival: %d", (UINT8)(bot->botvars.rival == true)));
|
||||
V_DrawSmallString(8, 26, 0, va("Rubberbanding: %.02f", FIXED_TO_FLOAT(bot->botvars.rubberband) * 100.0f));
|
||||
|
||||
V_DrawSmallString(8, 32, 0, va("Item delay: %d", bot->botvars.itemdelay));
|
||||
V_DrawSmallString(8, 36, 0, va("Item confirm: %d", bot->botvars.itemconfirm));
|
||||
|
||||
V_DrawSmallString(8, 42, 0, va("Turn: %d / %d / %d", -BOTTURNCONFIRM, bot->botvars.turnconfirm, BOTTURNCONFIRM));
|
||||
V_DrawSmallString(8, 46, 0, va("Spindash: %d / %d", bot->botvars.spindashconfirm, BOTSPINDASHCONFIRM));
|
||||
V_DrawSmallString(8, 50, 0, va("Respawn: %d / %d", bot->botvars.respawnconfirm, BOTRESPAWNCONFIRM));
|
||||
|
||||
V_DrawSmallString(8, 56, 0, va("Item priority: %d", bot->botvars.roulettePriority));
|
||||
V_DrawSmallString(8, 60, 0, va("Item timeout: %d", bot->botvars.rouletteTimeout));
|
||||
}
|
||||
|
||||
static void K_DrawGPRankDebugger(void)
|
||||
{
|
||||
gp_rank_e grade = GRADE_E;
|
||||
|
|
@ -5339,6 +5408,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))
|
||||
|
|
@ -10270,7 +10270,10 @@ static void K_AirFailsafe(player_t *player)
|
|||
//
|
||||
fixed_t K_PlayerBaseFriction(player_t *player, fixed_t original)
|
||||
{
|
||||
const fixed_t factor = FixedDiv(FRACUNIT - original, FRACUNIT - ORIG_FRICTION);
|
||||
const fixed_t factor = FixedMul(
|
||||
FixedDiv(FRACUNIT - original, FRACUNIT - ORIG_FRICTION),
|
||||
K_GetKartGameSpeedScalar(gamespeed)
|
||||
);
|
||||
fixed_t frict = original;
|
||||
|
||||
if (K_PodiumSequence() == true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue