TA Ring Box rebalance

This commit is contained in:
AJ Martinez 2024-05-29 03:07:36 -07:00
parent af5a65440d
commit dea9054613
3 changed files with 38 additions and 17 deletions

View file

@ -10898,6 +10898,11 @@ INT32 K_GetKartRingPower(const player_t *player, boolean boosted)
return max(ringPower / FRACUNIT, 1);
}
INT32 K_GetFullKartRingPower(const player_t *player, boolean boosted)
{
return 3 + K_GetKartRingPower(player, boosted);
}
// Returns false if this player being placed here causes them to collide with any other player
// Used in g_game.c for match etc. respawning
// This does not check along the z because the z is not correctly set for the spawnee at this point
@ -13035,28 +13040,34 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
}
else if (modeattacking)
{
// At high distance values, the power of Ring Box is mainly an extra source of speed, to be
// stacked with power items (or itself!) during the payout period.
// Low-dist Ring Box follows some special rules, to somewhat normalize the reward between stat
// blocks that respond to rings differently; here, variance in payout period counts for a lot!
// TA has:
// - no one to tether from
// - no player damage
// - no player bumps
// ...which nullifies a lot of designed advantages for accel types and high-weight racers.
//
// In addition, it's at Gear 3 Thunderdome speed, which can make it hard for heavies to
// take strong lines without brakedrifting.
//
// To try and help close this gap, we fudge Ring Box payouts to allow weaker characters
// better access to things that make them go fast, without changing core handling.
UINT8 accel = 10-player->kartspeed;
UINT8 weight = player->kartweight;
UINT8 total = accel+weight;
// Fixed point math can suck a dick.
// Max possible accel+weight is 9+9=18.
// Scale from base payout at 9/1 to max payout at 1/9.
award = Easing_OutSine(FRACUNIT*total/18, award, 2*award);
if (accel > weight)
// And, because we don't have to give a damn about sandbagging, up the stakes the longer we progress!
if (gametyperules & GTR_CIRCUIT)
{
accel *= 10;
weight *= 3;
// This should be based on completion percentage, but I looked at
// the circuitlength stuff and immediately gave up
fixed_t marginTime = FixedDiv(leveltime, TICRATE*60*2);
award = Easing_Linear(min(marginTime, FRACUNIT), award, 3*award/2);
}
else
{
accel *= 3;
weight *= 10;
}
award = (110 + accel + weight) * award / 120;
}
else
{
@ -13067,6 +13078,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
award = award * (behindMulti + 10) / 10;
}
// Stacked Ring Box is good. REALLY good. "Uncapped speed that feeds into itself" good.
// Keep highly unusual values under control, using the following core rule:
// If we already have more boost than we're about to be awarded, STOP!!!
UINT32 existing = (player->ringboost / K_GetFullKartRingPower(player, true)); // How many rings (effectively) do we have boost credit for right now?
UINT32 reduction = 8*existing/10; // Take an arbitrary percentage of those rings, and...
fixed_t reductionfactor = FixedDiv(FRACUNIT*reduction, FRACUNIT*award); // ...get a ratio to compare our potential award against it. 0 = no existing boost, 1+ = existing boost comparable to our award.
reductionfactor = min(reductionfactor, FRACUNIT); // Cap for easing function, and...
award = Easing_Linear(reductionfactor, award, award/4); // ...ease between unmodified and minimum award.
K_AwardPlayerRings(player, award, true);
player->ringboxaward = 0;
}

View file

@ -192,6 +192,7 @@ void K_RepairOrbitChain(mobj_t *orbit);
void K_CalculateBananaSlope(mobj_t *mobj, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t height, boolean flip, boolean player);
mobj_t *K_FindJawzTarget(mobj_t *actor, player_t *source, angle_t range);
INT32 K_GetKartRingPower(const player_t *player, boolean boosted);
INT32 K_GetFullKartRingPower(const player_t *player, boolean boosted);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_UpdateSteeringValue(INT16 inputSteering, INT16 destSteering);
INT16 K_GetKartTurnValue(const player_t *player, INT16 turnvalue);

View file

@ -3519,7 +3519,7 @@ void A_AttractChase(mobj_t *actor)
angle_t offset = FixedAngle(18<<FRACBITS);
// Base add is 3 tics for 9,9, adds 1 tic for each point closer to the 1,1 end
actor->target->player->ringboost += K_GetKartRingPower(actor->target->player, true) + 3;
actor->target->player->ringboost += K_GetFullKartRingPower(actor->target->player, true) + 3;
S_ReducedVFXSoundAtVolume(actor->target, sfx_s1b5, actor->target->player->ringvolume, NULL);
@ -3575,7 +3575,7 @@ void A_AttractChase(mobj_t *actor)
if (actor->extravalue1 >= 16)
{
if (!P_GivePlayerRings(actor->target->player, 1)) // returns 0 if addition failed
actor->target->player->ringboost += K_GetKartRingPower(actor->target->player, true) + 3;
actor->target->player->ringboost += K_GetFullKartRingPower(actor->target->player, true) + 3;
if (actor->cvmem) // caching
S_StartSound(actor->target, sfx_s1c5);