Files
Project-M/Assets/_Project/Scripts/Client/Presentation/FeelConfig.cs
T
kronic 0ff11fe2a9 Enemy hit-reacts: React/Stagger anim tiers off Health-drop edges (the Rukhanka-safe flinch)
SwordCombat React (1.4x, 0.3s pulse) + Stagger (1.2x, 0.55s) as Any-State
states on AC_EnemyTopDown via EnemyRigTools.WireEnemyHitReacts; driven by
EnemyAnimationDriveSystem's cache (now Pos/Hp/ReactUntil/Heavy) off
replicated Health drops. Windup-honesty gate: light reacts require
!IsAttacking (a sub-poise hit never visually cancels a live windup);
the heavy tier tracks the server's B2 poise break (stagger threshold 50
= finisher staggers, light flinches at the locked tuning). Knobs:
HitReactSeconds (0=off) / HitStaggerSeconds / HitReactStaggerDamage.
Replaces the review-cut positional vibrate (Rukhanka inverse-fold no-op).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 00:28:11 -07:00

334 lines
20 KiB
C#

using UnityEngine;
namespace ProjectM.Client
{
/// <summary>
/// Live-tunable knobs for the client-only COMBAT-FEEL slice (Stage E). A static bridge — mirrors
/// <see cref="AimPresentation"/> — so values can be poked at runtime via MCP <c>execute_code</c>
/// (e.g. <c>ProjectM.Client.FeelConfig.HitShakeLocal = 0.4f;</c>) WITHOUT a recompile, for interactive
/// tuning. Read ONLY by client-presentation systems (<see cref="CombatFeedbackSystem"/>,
/// <see cref="AimReticleSystem"/>) and the <see cref="PrototypeCameraRig"/> MonoBehaviour — all non-Burst,
/// main-thread. NEVER read these from a <c>[BurstCompile]</c> system (managed-static + Color/enum-in-Burst
/// hazards); they are presentation-only and never touch the deterministic simulation.
/// <para>
/// Defaults match the values previously hardcoded in CombatFeedbackSystem so behaviour is byte-identical
/// until a knob is poked. <see cref="ResetDefaults"/> re-stamps every field on play-enter via
/// <c>[RuntimeInitializeOnLoadMethod(SubsystemRegistration)]</c> because statics survive fast-enter-playmode
/// domain reloads — without it a poked value would leak across play-enters and flash stale feel (the exact
/// bug <see cref="AimPresentation"/>'s reset prevents).
/// </para>
/// </summary>
public static class FeelConfig
{
// ---- Feature 1: hit camera punch + (camera-only) hit-stop ----
/// <summary>Camera shake when the LOCAL player is hit (fed to PrototypeCameraRig.AddShake, clamp 0.8).</summary>
public static float HitShakeLocal;
/// <summary>Camera shake when a remote player / Husk is hit.</summary>
public static float HitShakeRemote;
/// <summary>Hit-spark particle burst count (procedural fallback path).</summary>
public static int HitBurstCount;
/// <summary>Hit SFX volume.</summary>
public static float HitSfxVolume;
/// <summary>Degrees of transient FOV "kick" on a LOCAL hit — the netcode-safe hit-stop (NEVER Time.timeScale). 0 = off.</summary>
public static float HitStopFovKick;
/// <summary>Milliseconds the FOV kick eases back to base.</summary>
public static float HitStopDurationMs;
// ---- MC-3: player-dealt-hit punch (magnitude-scaled) + deferred enemy flash ----
/// <summary>Min FOV kick (deg) when the LOCAL player lands a hit on an enemy (chip damage).</summary>
public static float HitStopFovKickMin;
/// <summary>Max FOV kick (deg) on a heavy player-dealt hit (delta >= HitStopRefDamage).</summary>
public static float HitStopFovKickMax;
/// <summary>Reserved cap for the (deferred) true freeze-frame, in fixed frames.</summary>
public static int HitStopMaxFrames;
/// <summary>Damage delta that saturates the player-dealt punch to HitStopFovKickMax.</summary>
public static float HitStopRefDamage;
/// <summary>Tint for the (deferred) enemy material hit-flash — exposed now, wired in the ShaderGraph slice.</summary>
public static Color HitFlashColor;
/// <summary>Master gate for the (deferred) true freeze-frame hit-stop. FALSE for v1 (camera-punch only).</summary>
public static bool HitStopFreezeEnabled;
// ---- Feature 1/2: death camera punch ----
/// <summary>Camera shake on LOCAL player death (loudest event by design).</summary>
public static float PlayerDeathShake;
/// <summary>Camera shake on a remote player's death.</summary>
public static float RemotePlayerDeathShake;
/// <summary>Base death-burst particle count (player death + Husk-death base).</summary>
public static int DeathBurstCount;
// ---- Feature 2: kill-shot fanfare (Husk death) ----
/// <summary>Camera shake on a Husk kill (nudged above a glancing hit, kept under PlayerDeathShake).</summary>
public static float KillShake;
/// <summary>Multiplier on DeathBurstCount for a Husk kill (result clamped by MaxActiveVfx).</summary>
public static float KillBurstScale;
/// <summary>Optional FOV kick on a kill (degrees). 0 = off.</summary>
public static float KillFovKick;
/// <summary>Husk-death SFX volume.</summary>
public static float KillSfxVolume;
// ---- Feature 3: respawn shimmer / fade-in (local player recovery) ----
/// <summary>Master gate for the local-player respawn shimmer.</summary>
public static bool RespawnShimmerEnabled;
/// <summary>Particle burst count for the recovery shimmer.</summary>
public static int RespawnShimmerBurst;
/// <summary>Light camera punch on recovery so respawn reads as "reinforcing".</summary>
public static float RespawnShimmerShake;
// ---- Feature 4: reticle lock-on tether (cosmetic aim HINT) ----
/// <summary>Master gate for the lock-on tether.</summary>
public static bool LockOnEnabled;
/// <summary>Show the tether only on the Gamepad scheme (mirrors the server's gamepad-only auto-target assist).</summary>
public static bool LockOnGamepadOnly;
/// <summary>Max world distance from the player to a tethered Husk.</summary>
public static float LockOnRange;
/// <summary>Forward half-arc (degrees) around PlayerFacing within which a Husk is eligible.</summary>
public static float LockOnArcDegrees;
/// <summary>Tether line tint (subtle highlight, not a laser).</summary>
public static Color LockOnLineColor;
/// <summary>Tether line width (world units).</summary>
public static float LockOnLineWidth;
// ---- Feature B: enemy health bars (Slice 1) ----
/// <summary>Squared world-distance beyond which a bar is hidden when the pool cap is reached (default 400 = 20m).</summary>
public static float HealthBarMaxDistSq;
// ---- Feature 5 (MC-1): dash juice ----
/// <summary>Camera shake on the local player's dash start.</summary>
public static float DashShake;
/// <summary>Transient FOV punch (degrees) on dash start — the "lurch" read (camera punch, never Time.timeScale).</summary>
public static float DashFovKick;
/// <summary>Afterimage/whoosh particle burst count at dash start.</summary>
public static int DashBurstCount;
/// <summary>Dash whoosh SFX volume.</summary>
public static float DashSfxVolume;
/// <summary>Particles emitted per frame while the local i-frame window is active (the shimmer trail).</summary>
public static int DashShimmerPerFrame;
/// <summary>Suppress local hit-feedback during the local i-frame window (masks the prediction-reconciliation
/// Health flicker on a clean dodge — the documented acceptable-not-a-bug interaction).</summary>
public static bool DashHitSuppress;
// ---- Combat feel pass (2026-06): connect cue, hit-flash, kill pop, footsteps, rumble, telegraph beep ----
/// <summary>Hit-flash puff density (a colored particle burst in HitFlashColor on an enemy damage edge).</summary>
public static int HitFlashBurstCount;
/// <summary>Extra FOV punch (deg) when the LOCAL melee cleave is confirmed to connect (vs a whiff).</summary>
public static float MeleeConnectFovKick;
/// <summary>Volume of the meaty melee connect "thunk".</summary>
public static float MeleeConnectVolume;
/// <summary>Kill-pop colored flash density on an enemy death.</summary>
public static int KillFlashBurstCount;
/// <summary>Footstep SFX volume (07-15: deep muffled underwater thud).</summary>
public static float FootstepVolume;
/// <summary>Planar meters travelled per footstep — stride-DISTANCE stepping, so cadence tracks the
/// real (drifting) velocity instead of a fixed timer (07-15 underwater feel).</summary>
public static float FootstepStrideMeters;
/// <summary>Local player speed (u/s) above which footsteps play.</summary>
public static float FootstepMinSpeed;
/// <summary>Per-step random volume jitter (±fraction) — breaks the metronome read.</summary>
public static float FootstepJitter;
/// <summary>Silt-puff particles per footstep (0 = off).</summary>
public static int FootstepPuffCount;
// ---- 07-16 underwater feel (gap-list): bubbles, ambience, camera weight, banking ----
/// <summary>Seconds between dome bubble-exhaust puffs (0 = off).</summary>
public static float BubbleIntervalSec;
/// <summary>Bubbles per exhaust puff.</summary>
public static int BubbleBurstCount;
/// <summary>Underwater ambience bed volume (Music bus).</summary>
public static float AmbienceVolume;
/// <summary>Mean seconds between distant groans (0 = off; ±40% jitter).</summary>
public static float GroanIntervalSec;
/// <summary>Distant-groan volume (Music bus).</summary>
public static float GroanVolume;
/// <summary>Camera follow-sharpness multiplier (&lt;1 = the camera drags through the water).</summary>
public static float CameraDragMult;
/// <summary>The facing turn rate (deg/s) at which the additive body bank reaches full (±1).</summary>
public static float BankFullTurnDegPerSec;
/// <summary>The WALK ring's natural travel speed (u/s; measured off the pack's root-motion variant).
/// StrideScale fine-corrects playback against the walk→run blended natural (07-16b/e).</summary>
public static float TrudgeNaturalSpeed;
/// <summary>The RUN ring's natural travel speed (u/s; measured).</summary>
public static float RunNaturalSpeed;
/// <summary>Shoulder-lamp spot intensity (0 = lamp off). LANTERN: light is territory — the suit lamp CASTS.</summary>
public static float ShoulderLampIntensity;
/// <summary>Shoulder-lamp beam range (m).</summary>
public static float ShoulderLampRange;
/// <summary>Seconds the Menacing01 combat idle (CombatIdle state) holds after the last melee swing (0 = off).</summary>
public static float CombatIdleHoldSec;
/// <summary>Melee slash-arc brightness multiplier (07-19 LANTERN retone: the WEAPON is the read, the arc is a water wake).</summary>
public static float MeleeArcIntensity;
/// <summary>Bubbles shed along a melee cleave (0 = off).</summary>
public static int MeleeArcBubbles;
/// <summary>Camera hold frames when the melee FINISHER lands (07-20 G5 impact ladder; light hits use HitStopMaxFrames).</summary>
public static int FinisherHoldFrames;
// ---- 07-21 enemy hit-reacts (G5; the Rukhanka-safe flinch that replaced the cut vibrate) ----
/// <summary>Seconds the light flinch pulse holds (0 = hit-reacts OFF).</summary>
public static float HitReactSeconds;
/// <summary>Seconds the heavy stagger pulse holds.</summary>
public static float HitStaggerSeconds;
/// <summary>Health drop at/above which the react upgrades to the STAGGER tier (keep aligned with the
/// server's B2 poise math: the finisher should stagger, a light hit should not).</summary>
public static float HitReactStaggerDamage;
/// <summary>Master gate for gamepad rumble (no-op on KBM).</summary>
public static bool RumbleEnabled;
/// <summary>Rumble strength on a local hit taken / dealt.</summary>
public static float RumbleHit;
/// <summary>Rumble strength on a kill.</summary>
public static float RumbleKill;
/// <summary>Seconds a rumble pulse lasts before it auto-stops.</summary>
public static float RumbleDurationSec;
// ---- Deferred-items pass (2026-06): true body hit-flash, remote co-op swings, near-impact strike beep ----
/// <summary>Master gate for the enemy material BODY hit-flash (drives URPMaterialPropertyBaseColor on render children).</summary>
public static bool BodyFlashEnabled;
/// <summary>Peak _BaseColor the enemy body flashes to on a hit (HDR; lerps from the baked white base and decays back).</summary>
public static Color BodyFlashColor;
/// <summary>C2: player-body HURT flash tint (hot red-orange) — distinct from the enemy white overdrive so
/// 'you got hit' reads differently from 'you hit them'. Multiplies the Synty atlas base map like BodyFlashColor.</summary>
public static Color PlayerHurtFlashColor;
/// <summary>Seconds the body flash decays from peak back to the baked white base.</summary>
public static float BodyFlashDurationSec;
/// <summary>Master gate for rendering REMOTE teammates' melee cleave arcs (co-op readability).</summary>
public static bool RemoteSwingEnabled;
/// <summary>Tint of a remote teammate's slash arc (cooler/friendlier than the local warm arc).</summary>
public static Color RemoteSlashColor;
/// <summary>Master gate for the near-impact \"dodge NOW\" strike beep on a winding-up enemy.</summary>
public static bool StrikeBeepEnabled;
/// <summary>Volume of the near-impact strike beep.</summary>
public static float StrikeBeepVolume;
/// <summary>Ticks before the strike lands that the beep fires (the dodge-reaction lead).</summary>
public static int StrikeBeepLeadTicks;
/// <summary>Squared world-distance from the local player beyond which the strike beep is suppressed (avoids a distant cacophony).</summary>
public static float StrikeBeepMaxDistSq;
// ---- Enemy visibility markers (EnemyMarkerSystem: off-screen edge arrows + on-screen overhead pips) ----
/// <summary>Master gate for the enemy visibility markers.</summary>
public static bool EnemyMarkerEnabled;
/// <summary>Only mark living enemies within this world distance of the local player (scopes to the current room; avoids cross-region arrow spam).</summary>
public static float EnemyMarkerRange;
/// <summary>On-screen enemy count above which the overhead pips fade toward EnemyMarkerMinAlpha (declutter a swarm; off-screen arrows stay full).</summary>
public static int EnemyMarkerFadeStartCount;
/// <summary>Faded pip alpha once the on-screen count is well past EnemyMarkerFadeStartCount.</summary>
public static float EnemyMarkerMinAlpha;
/// <summary>Marker tint (pip + off-screen arrow).</summary>
public static Color EnemyMarkerColor;
/// <summary>Marker glyph font size (px).</summary>
public static float EnemyMarkerSize;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void ResetDefaults()
{
// Feature 1
HitShakeLocal = 0.32f;
HitShakeRemote = 0.10f;
HitBurstCount = 10;
HitSfxVolume = 0.70f;
HitStopFovKick = 1.5f;
HitStopDurationMs = 90f;
HitStopFovKickMin = 0.6f;
HitStopFovKickMax = 2.2f;
HitStopMaxFrames = 2; // C4: a 2-frame (~33ms) camera hold reads as crunch, not a lag-y stutter
HitStopRefDamage = 30f;
HitFlashColor = new Color(1f, 0.85f, 0.55f, 1f);
HitStopFreezeEnabled = true; // C4: enable the finisher hit-stop hold (presentation-only camera freeze, bounded below)
// Feature 1/2 death
PlayerDeathShake = 0.50f;
RemotePlayerDeathShake = 0.25f;
DeathBurstCount = 28;
// Feature 2 kill-shot
KillShake = 0.20f;
KillBurstScale = 1.5f;
KillFovKick = 1.0f;
KillSfxVolume = 0.75f;
// Feature 3 respawn
RespawnShimmerEnabled = true;
RespawnShimmerBurst = 24;
RespawnShimmerShake = 0.12f;
// Feature 4 tether
LockOnEnabled = true;
LockOnGamepadOnly = true;
LockOnRange = 9.0f;
LockOnArcDegrees = 60f;
LockOnLineColor = new Color(0.55f, 0.9f, 1f, 0.35f);
LockOnLineWidth = 0.05f;
// Feature B health bars (Slice 1)
HealthBarMaxDistSq = 400f; // 20 m radius
// Feature 5 dash (MC-1)
DashShake = 0.18f;
DashFovKick = 1.2f;
DashBurstCount = 14;
DashSfxVolume = 0.55f;
DashShimmerPerFrame = 2;
DashHitSuppress = true;
// Combat feel pass (2026-06)
HitFlashBurstCount = 16;
MeleeConnectFovKick = 1.1f; // 07-21 HEAVY LOCK: meatier bite
MeleeConnectVolume = 0.55f;
KillFlashBurstCount = 20;
FootstepVolume = 0.30f; // 07-15: heavier, more present underwater thud
FootstepStrideMeters = 1.5f; // one step per ~1.5m of planar travel
FootstepMinSpeed = 1.0f;
FootstepJitter = 0.12f;
FootstepPuffCount = 5;
BubbleIntervalSec = 1.6f; // 07-16: dome bubble exhaust cadence
BubbleBurstCount = 2;
AmbienceVolume = 0.14f; // underwater bed (Music bus)
GroanIntervalSec = 24f; // distant groans, ±40% jitter
GroanVolume = 0.35f;
CameraDragMult = 0.8f; // heavier camera through the water (multiplies FollowSharpness)
BankFullTurnDegPerSec = 270f;
TrudgeNaturalSpeed = 1.46f; // measured: A_Walk_FwdStrafeF_RootMotion_Masc averageSpeed (walk ring)
RunNaturalSpeed = 2.6f; // measured: A_Run_FwdStrafeF_RootMotion_Masc averageSpeed (run ring)
ShoulderLampIntensity = 8f; // 07-16e: the suit lamp actually lights (3 got lost in the murk ambient)
ShoulderLampRange = 12f;
CombatIdleHoldSec = 4f; // 07-18: Menacing01 combat-idle hold after the last swing
MeleeArcIntensity = 0.8f; // 07-21 HEAVY LOCK: the weapon is the read, the arc recedes further
MeleeArcBubbles = 6;
FinisherHoldFrames = 7; // 07-21 HEAVY LOCK: a fatter finisher beat (~117ms, still under the 8-frame ladder cap)
HitReactSeconds = 0.3f; // 07-21: light flinch pulse (clip plays at 1.4x -> the peak lands inside it)
HitStaggerSeconds = 0.55f; // heavy stagger pulse
HitReactStaggerDamage = 50f; // finisher (63 seeded) staggers, light (42) flinches -- tracks B2 poise
RumbleEnabled = true;
RumbleHit = 0.25f;
RumbleKill = 0.45f;
RumbleDurationSec = 0.12f;
// Deferred-items pass (2026-06)
BodyFlashEnabled = true;
BodyFlashColor = new Color(3.2f, 2.8f, 2.2f, 1f); // hot near-white overdrive (multiplies the Synty atlas base map)
PlayerHurtFlashColor = new Color(2.6f, 0.55f, 0.4f, 1f); // C2: hot red-orange body flash when the player is hit
BodyFlashDurationSec = 0.16f;
RemoteSwingEnabled = true;
RemoteSlashColor = new Color(0.7f, 1.15f, 1.3f, 1f); // cool teammate arc (07-19 retone: dim bioluminescent wake)
StrikeBeepEnabled = true;
StrikeBeepVolume = 0.40f;
StrikeBeepLeadTicks = 8;
StrikeBeepMaxDistSq = 225f; // 15 m
// Enemy visibility markers (EnemyMarkerSystem)
EnemyMarkerEnabled = true;
EnemyMarkerRange = 140f;
EnemyMarkerFadeStartCount = 6;
EnemyMarkerMinAlpha = 0.28f;
EnemyMarkerColor = new Color(1f, 0.86f, 0.3f, 1f); // warm amber, reads over the cool world
EnemyMarkerSize = 24f;
}
}
}