Health, Shields & Energy

Three independent components and one fixed damage order. Any of them can be left out entirely.

❤️3 components
⏱️8 min read
🛡️Damage router
🔌Optional
USKHealthComponent · USKShieldComponent · USKEnergyComponent

Three components, each independent. Health is on every pawn; shields and energy are optional and can be left off entirely. Nothing breaks when a component is missing — the systems that would have used it simply behave as though the resource is infinite or absent.

Incoming damage is routed in a fixed order. Knowing it explains most "why didn't that hurt" questions:

// damage router, in order God Mode Invulnerability Off-screen guard Shield Health

Health

PropertyDefaultPurpose
Max Health100Starting and maximum hit points.
FactionNeutralWhich team this pawn is on. Projectiles pass straight through matching factions.
God ModeOffBlocks all damage permanently — shield and health both untouched. Doubles as an accessibility option.
Ignore Damage Off ScreenOnIgnores damage while the owner is past the top or bottom of the view.
Off Screen Damage Margin0Extra distance past the edge before damage stops registering.

Functions

FunctionPurpose
HealRestores health, capped at maximum. Ignored on a dead pawn.
Reset HealthRestores Max Health to its authored value and fills to full. Safe on dead pawns.
Override Max HealthSets a new maximum for this spawn only — used by wave and spawn-point health overrides. The baseline is untouched, so the next reset restores the original.
ReinitialiseRe-establishes the baseline and fully heals, clearing any invulnerability. Used on pool reuse.
Force KillSets health to zero and fires the death event. Bypasses every damage guard.
Activate InvulnerabilityBlocks damage for a number of seconds. A duration of 0 does nothing — for permanent immunity use God Mode.
Hold InvulnerableThe untimed version: immune until toggled back. Used for "immune until an event", such as a boss during its entrance.
Set God ModeToggles God Mode at runtime.

Events

EventFires
On DamagedDamage actually landed on health, with the amount and causer.
On DeathHealth reached zero.
On Health ChangedAny change at all — damage, healing, reset, override. This is the one to bind a health bar to.
On Invulnerability ChangedImmunity turned on or off. Drives the blinking feedback.

Shields

A regenerating buffer in front of health. Add the component to a pawn to give it one; leave it off and damage goes straight to health.

PropertyDefaultPurpose
Max Shield100Capacity of the buffer.
Start Shield Percent50How full it is at spawn. Starting partial gives the player something to regain rather than only something to lose.
Shield Regen Rate2.5Points restored per second once regeneration resumes.
Regen Energy Cost Per Point10Energy spent per shield point regained. This is what makes shields and weapons compete for the same generator.
Regen Delay After Hit1Seconds of no regeneration after taking a hit, so a shield cannot tank sustained fire.
The shield is a hard gate, not a pool that carries over. While it holds at least one point it blocks the hit completely — a 200-damage shot against a 1-point shield does nothing. That keeps shields readable: you are either shielded or you are not.

An absorbed hit still fires the health component's damage event so hit feedback plays, but the pawn deliberately does not squash, flash or shake — the shield's own effect slots below carry that job instead, which is what makes an absorbed hit look different from a real one.

Feedback

PropertyFires
Shield Hit Effect / SoundEvery absorbed hit. The Niagara system is attached to the pawn, so it follows the ship.
Shield Break Effect / SoundThe moment the shield drops to zero.

Functions

FunctionPurpose
Absorb HitOffers damage to the shield. Returns true if it was absorbed. Called by the damage router — you rarely call it yourself.
Add ShieldRestores points. What a Shield pickup calls.
Refill To Start PercentResets to the spawn level. Used on respawn.
Is UpTrue while the shield holds at least one point.

Energy

A regenerating generator that energy-costed weapons draw from, and that shields spend to rebuild themselves. It is the resource that forces a choice between shooting and staying protected.

PropertyDefaultPurpose
Max Energy100Capacity.
Regen Rate40Energy per second restored.
Regen Delay0Seconds after spending before regeneration resumes. 0 regenerates continuously.

Two ways to spend

FunctionBehaviour
Consume EnergyAll or nothing. Returns false and spends nothing if the full amount isn't available — the weapon simply doesn't fire.
Drain EnergySpends up to the amount available. Used by the front gun, which is never blocked.
Has EnergyTests availability without spending.
Refill To FullInstantly tops up. Used on respawn.
The front gun is never blocked. It drains what is there and keeps firing regardless, so the player is never left completely unarmed. Side and rear weapons use the all-or-nothing rule instead, which is what creates the incentive to ease off and let the generator recover.
With no energy component on the pawn, energy-costed weapons fire for free. The system strips out cleanly in both directions, so you can ship without energy at all and add it later without touching a single weapon asset.

Ammo

Ammo has no component of its own — it belongs to the weapon that uses it, so two ammo weapons on the same ship keep separate supplies. Capacity, cost per volley and trickle refill are set on the weapon asset and are covered under Weapons.

An Ammo pickup refills ammo-costed weapons, and the game mode's emergency ammo drop watches whichever mount is running lowest. See Pickups & Drops.

Showing them on the HUD

Each component broadcasts a change event carrying the current and maximum value. Bind the matching HUD update function and pass the percentage to a resource bar — the whole wiring is one node per resource. See HUD & UI.

Common fixes

  • Nothing takes damage — God Mode is on, or an untimed Hold Invulnerable was never released
  • An enemy can't be hurt as it enters — that is Ignore Damage Off Screen working as intended
  • Shields never regenerate — there is no energy component, or the generator is empty
  • A weapon silently refuses to fire — it costs energy and the all-or-nothing check is failing
  • Absorbed hits look identical to real ones — assign the Shield Hit effect and sound

Where next

HUD & UI

Bars, lives and score readouts.

Read →

Weapons

Energy and ammo costs on weapon assets.

Read →

Pickups & Drops

Health, shield and ammo restoration.

Read →