mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
More corrective bot friction on tighter waypoints
This commit is contained in:
parent
219f8d74a0
commit
9c7061aa0c
2 changed files with 15 additions and 4 deletions
|
|
@ -1430,6 +1430,7 @@ static INT32 K_HandleBotTrack(const player_t *player, ticcmd_t *cmd, botpredicti
|
||||||
moveangle = player->mo->angle + K_GetUnderwaterTurnAdjust(player);
|
moveangle = player->mo->angle + K_GetUnderwaterTurnAdjust(player);
|
||||||
anglediff = AngleDeltaSigned(moveangle, destangle);
|
anglediff = AngleDeltaSigned(moveangle, destangle);
|
||||||
|
|
||||||
|
// predictionerror
|
||||||
cmd->angle = std::min(destangle - moveangle, moveangle - destangle) >> TICCMD_REDUCE;
|
cmd->angle = std::min(destangle - moveangle, moveangle - destangle) >> TICCMD_REDUCE;
|
||||||
|
|
||||||
if (anglediff < 0)
|
if (anglediff < 0)
|
||||||
|
|
@ -1725,7 +1726,7 @@ static void K_BuildBotTiccmdNormal(player_t *player, ticcmd_t *cmd)
|
||||||
UINT8 spindash = 0;
|
UINT8 spindash = 0;
|
||||||
INT32 turnamt = 0;
|
INT32 turnamt = 0;
|
||||||
|
|
||||||
cmd->angle = 0; // For bots, this is used to transmit prediction error to gamelogic.
|
cmd->angle = 0; // For bots, this is used to transmit predictionerror to gamelogic.
|
||||||
// Will be overwritten by K_HandleBotTrack if we have a destination.
|
// Will be overwritten by K_HandleBotTrack if we have a destination.
|
||||||
|
|
||||||
if (!(gametyperules & GTR_BOTS) // No bot behaviors
|
if (!(gametyperules & GTR_BOTS) // No bot behaviors
|
||||||
|
|
|
||||||
16
src/k_kart.c
16
src/k_kart.c
|
|
@ -13017,8 +13017,8 @@ fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original)
|
||||||
}
|
}
|
||||||
else if (K_PlayerUsesBotMovement(player) == true)
|
else if (K_PlayerUsesBotMovement(player) == true)
|
||||||
{
|
{
|
||||||
const fixed_t speedPercent = min(FRACUNIT, FixedDiv(player->speed, K_GetKartSpeed(player, false, false)));
|
// const fixed_t speedPercent = min(FRACUNIT, FixedDiv(player->speed, K_GetKartSpeed(player, false, false)));
|
||||||
const fixed_t extraFriction = FixedMul(FixedMul(FRACUNIT >> 5, factor), speedPercent);
|
// const fixed_t extraFriction = FixedMul(FixedMul(FRACUNIT >> 5, factor), speedPercent);
|
||||||
|
|
||||||
// A bit extra friction to help them without drifting.
|
// A bit extra friction to help them without drifting.
|
||||||
// Remove this line once they can drift.
|
// Remove this line once they can drift.
|
||||||
|
|
@ -13027,13 +13027,23 @@ fixed_t K_PlayerBaseFriction(const player_t *player, fixed_t original)
|
||||||
angle_t MAXERROR = 45*ANG1;
|
angle_t MAXERROR = 45*ANG1;
|
||||||
fixed_t errorfrict = Easing_Linear(min(FRACUNIT, FixedDiv(player->botvars.predictionError, MAXERROR)), 0, FRACUNIT>>2);
|
fixed_t errorfrict = Easing_Linear(min(FRACUNIT, FixedDiv(player->botvars.predictionError, MAXERROR)), 0, FRACUNIT>>2);
|
||||||
|
|
||||||
|
if (player->currentwaypoint && player->currentwaypoint->mobj)
|
||||||
|
{
|
||||||
|
fixed_t myradius = FixedInt(FixedDiv(player->currentwaypoint->mobj->radius, mapobjectscale));
|
||||||
|
|
||||||
|
if (myradius < 400)
|
||||||
|
errorfrict += errorfrict/100 * (300 - myradius);
|
||||||
|
}
|
||||||
|
|
||||||
|
errorfrict = min(errorfrict, frict/4);
|
||||||
|
|
||||||
frict -= errorfrict;
|
frict -= errorfrict;
|
||||||
|
|
||||||
// Bots gain more traction as they rubberband.
|
// Bots gain more traction as they rubberband.
|
||||||
const fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier()));
|
const fixed_t traction_value = FixedMul(player->botvars.rubberband, max(FRACUNIT, K_BotMapModifier()));
|
||||||
if (traction_value > FRACUNIT)
|
if (traction_value > FRACUNIT)
|
||||||
{
|
{
|
||||||
const fixed_t traction_mul = traction_value - FRACUNIT;
|
//const fixed_t traction_mul = traction_value - FRACUNIT;
|
||||||
// frict -= FixedMul(extraFriction, traction_mul);
|
// frict -= FixedMul(extraFriction, traction_mul);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue