From dea9054613f0379477d8e71f331ef94253d6a2a2 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Wed, 29 May 2024 03:07:36 -0700 Subject: [PATCH] TA Ring Box rebalance --- src/k_kart.c | 50 +++++++++++++++++++++++++++++++++++--------------- src/k_kart.h | 1 + src/p_enemy.c | 4 ++-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d1c957d81..1f12c5eed 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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; } diff --git a/src/k_kart.h b/src/k_kart.h index 81bb5c9a4..68eba6287 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -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); diff --git a/src/p_enemy.c b/src/p_enemy.c index 13a7e5cda..2a6c19f5c 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3519,7 +3519,7 @@ void A_AttractChase(mobj_t *actor) angle_t offset = FixedAngle(18<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);