Class EngineComponent.ForcedInduction
Simulates forced induction systems (turbocharger or supercharger) that increase engine power output.
Namespace: NWH.VehiclePhysics2.Powertrain
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class EngineComponent.ForcedInduction
Remarks
This class provides a simplified but effective simulation of forced induction systems that compress intake air to increase engine power. It models the key behavioral differences between turbochargers (exhaust-driven with lag) and superchargers (mechanically-driven with instant response).
Key characteristics: - Turbocharger: Spool-up delay based on RPM and throttle, wastegate simulation - Supercharger: Instant boost response directly proportional to RPM - Configurable power gain multiplier (typically 1.2-1.8x for realistic setups) - Boost pressure visualization for gauges and UI
This is an approximation focused on gameplay feel rather than detailed thermodynamic simulation. Factors like actual air flow, intercooler efficiency, compressor maps, and exhaust backpressure are abstracted into the boost behavior parameters.
Fields
boost
Current boost pressure as a normalized value in the range [0, 1], suitable for gauge display.
Declaration
[Range(0, 1)]
[ShowInTelemetry(0, 1, "0.00", null, 1)]
[Tooltip("Boost value as percentage in 0 to 1 range. Unitless.\r\nCan be used for boost gauges.")]
public float boost
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Represents the current boost pressure level where 0 = no boost and 1 = maximum boost. This value changes based on engine RPM, throttle input, and the type of forced induction system.
For turbochargers: Boost builds gradually based on spoolUpTime, reaching maximum at high RPM with full throttle. Drops quickly when throttle closes, especially with wastegate enabled.
For superchargers: Boost rises with RPM and is gated by throttle position, with instant response.
Use this value to drive boost gauge needles, visual effects, and audio cues for turbo/supercharger sound. The actual power gain is interpolated between 1.0x (no boost) and powerGainMultiplier (full boost).
forcedInductionType
Type of forced induction system determining boost behavior characteristics.
Declaration
[Tooltip("Type of forced induction.")]
public EngineComponent.ForcedInduction.ForcedInductionType forcedInductionType
Field Value
| Type | Description |
|---|---|
| EngineComponent.ForcedInduction.ForcedInductionType |
Remarks
Choose Turbocharger for exhaust-driven systems with spool lag, or Supercharger for mechanically-driven systems with instant response. This significantly affects driving feel and power delivery characteristics.
hasWastegate
Enables wastegate simulation for turbocharger setups, causing rapid boost dump on throttle closure.
Declaration
[Tooltip("Imitates the blow-off valve in a turbo setup.\r\nEnable for flutter sound effects and faster boost dump after closing throttle. The turbine keeps spinning, so boost returns quickly when you get back on throttle.\r\nNot used with superchargers.")]
[ShowInSettings("Has Wastegate")]
public bool hasWastegate
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
Models the blow-off valve that vents compressed intake air when the throttle closes at high boost, producing the characteristic "pssh"/flutter. The manifold boost drops to zero, but the turbine keeps its rotational inertia, so getting back on throttle restores boost almost immediately (no re-spool).
Effects when enabled: - Manifold boost vents immediately when throttle closes at high boost levels - onWastegateRelease event fires for flutter / blow-off valve sound effects - Turbine spin is retained, so boost recovers quickly on re-application
Disable for smoother boost behavior or to simulate boost pressure retention systems. This setting has no effect on superchargers as they don't use a blow-off valve.
onWastegateRelease
Event triggered when the wastegate opens and releases boost pressure.
Declaration
[Tooltip("Flag for sound effects.\r\nParameter is the boost value at the time of release.")]
public UnityEvent<float> onWastegateRelease
Field Value
| Type | Description |
|---|---|
| UnityEvent<float> |
Remarks
Invoked when throttle closes at high boost levels (boost > 0.7) with hasWastegate enabled. The event parameter contains the boost value at the moment of release, allowing for volume/pitch adjustment of flutter sound effects based on boost pressure.
Use this to trigger: - Turbo flutter sound effects (characteristic "pssh" or "chatter" sounds) - Blow-off valve sounds - Visual effects like boost gauge needle drops - Particle effects simulating pressure release
powerGainMultiplier
Maximum power multiplier applied at full boost, ranging from 1.0 (no boost) to 3.0 (3x power).
Declaration
[Range(1, 3)]
[Tooltip("Additional power that will be added to the engine's power.\r\nThis is the maximum value possible and depends on spool percent.")]
[ShowInSettings("Power Gain Mp.", 1, 2, 0.1)]
public float powerGainMultiplier
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Determines the peak power increase when boost reaches maximum (boost = 1.0). The actual power multiplier at any given moment is interpolated between 1.0 (no boost) and this value based on the current boost level. For example, with powerGainMultiplier = 1.4: - At boost = 0: 1.0x power (no gain) - At boost = 0.5: 1.2x power (50% of the gain) - At boost = 1.0: 1.4x power (140% of base power, or +40%)
Typical values: - 1.2-1.3 (20-30% gain): Mild boost for daily drivers - 1.3-1.5 (30-50% gain): Moderate boost for performance cars - 1.5-1.8 (50-80% gain): High boost for sports/race applications - 1.8-2.5 (80-150% gain): Extreme boost for drag racing or competition
Higher values provide more dramatic power increases but may require traction control tuning to prevent excessive wheelspin. Remember that this multiplies the base engine power, so a 200kW engine with 1.5x multiplier produces 300kW at full boost.
spoolUpTime
Time in seconds for a turbocharger to spool from zero to full boost under ideal conditions.
Declaration
[Range(0.1, 4)]
[Tooltip("Shortest time possible needed for turbo to spool up to its maximum RPM.\r\nUse larger values for larger turbos and vice versa.\r\nForced to 0 for superchargers.")]
[ShowInSettings("Spool Up Time", 0, 2, 0.05)]
public float spoolUpTime
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Determines turbo lag characteristics - the delay between applying throttle and achieving peak boost. This value represents the fastest possible spool time, which occurs at high RPM with full throttle. Actual spool time varies based on current RPM and throttle position.
Typical turbo characteristics: - 0.2-0.4s: Small, responsive turbos (quick spool, lower peak boost) - 0.4-0.8s: Medium turbos (balanced response and power) - 0.8-1.5s: Large turbos (significant lag, high peak power) - 1.5-3.0s: Very large turbos (extreme lag, massive power at high RPM)
Superchargers ignore this setting as they provide instant boost response tied directly to engine RPM (effectively zero spool time). Lower values create more responsive, arcade-like feel while higher values provide realistic turbo lag behavior for larger turbochargers.
useForcedInduction
Enables or disables the forced induction system.
Declaration
[ShowInTelemetry(NaN, NaN, null, null, 1)]
[ShowInSettings("Enabled")]
[Tooltip("Should forced induction be used?")]
public bool useForcedInduction
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
When false, the forced induction system is completely disabled and the engine operates as a naturally aspirated powerplant using only the base power curve. When true, the configured turbo/supercharger system actively modifies power output based on boost levels. Useful for gameplay features like forced induction upgrades or damage simulation.
Properties
PowerGainMultiplier
Gets the current power multiplier based on boost level, ranging from 1.0 to powerGainMultiplier.
Declaration
public float PowerGainMultiplier { get; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Returns the instantaneous power multiplier that should be applied to engine output. If forced induction is disabled, always returns 1.0 (no boost). Otherwise, returns a value interpolated between 1.0 and powerGainMultiplier based on the current boost level. This property is automatically applied during torque calculations in the engine.
Methods
Update(EngineComponent, float)
Updates forced induction state based on engine conditions and calculates current boost level. Called each physics frame to update boost pressure simulation based on RPM and throttle input.
Declaration
public void Update(EngineComponent engine, float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| EngineComponent | engine | The parent engine component providing RPM and throttle data. |
| float | dt | Per-substep delta time in seconds. Used as the explicit SmoothDamp timestep so spool is independent of render framerate and substep count. |