Video summary

Considerations for a Stat System - Things That Are Harder

Main summary

Key takeaways

Technology

Summary (tech/stat-system considerations)

The video discusses how to design a robust stat system (and its effects system) for RPG-like games, arguing that it’s more complicated than it first appears. The speaker uses Dungeons & Dragons as a reference model but frames most points as engine-agnostic.


1) Types of stats: base, derived, and “secondarily” derived

  • Base stats: core values on a character/object (e.g., D&D Intelligence).
  • Derived stats (single-level): computed from one base stat (e.g., intelligence modifier = (INT − 10) / 2).
    • Often not stored because they duplicate math.
  • Secondarily derived stats: derived from derived stats and/or other inputs
    • Example: spell DC depends on proficiency + intelligence modifier + other modifiers.

Key implication: If base stats change, the system must propagate updates so secondarily derived values remain correct.

Design trick: Instead of storing a fully computed value like spell DC, store spell DC modifiers and compute spell DC from components at query time. This localizes dependency logic.


2) “Philosophy” of where effects apply (base vs outer layers)

Older/newer D&D editions differ in whether effects more often modify:

  • Base stats, or
  • Derived/combat-facing values

The speaker suggests that constraining where effects are allowed to apply (e.g., forbid base-stat edits, forbid leaf edits) can:

  • simplify implementation, and
  • reduce tangled dependencies.

3) Choose appropriate data types

  • Integers are typically preferred for most stats.
    • Using floats can introduce precision artifacts (e.g., storing 4 as 3.9999999), creating rounding/accuracy complexity.
  • Booleans / states: flags like blinded / stunned / flying.
  • Enums: discrete allowed values (e.g., material types).
  • Tags / multi-valued membership: e.g., belonging to multiple factions.

Additional notes on factions/tags:

  • Memory-efficiency approaches (like bit fields) may reduce overhead.
  • But bit-field sizing makes extension painful (adding a new faction may require refactors).
  • Storing factions as raw names can cause bugs if names mismatch (e.g., “name mismatch creates a new faction”).

4) Scope / universality of stats

Not every stat belongs on every entity.

  • Example: some stats might matter only for PCs (stun could be “not fun” for players but allowed for enemies).
  • Other stats may apply to objects too
    • Example: hit points on chairs; reduced to zero to destroy.

5) Stat change “moments” / where reactions should live

When a stat changes, the system may need to:

  1. Update dependent derived stats (especially secondarily derived stats).
  2. Trigger visual/UI/gameplay reactions (encumbrance UI, blood/damage animations, etc.).

The speaker discusses tradeoffs between:

  • doing reactions in a general on change handler, or
  • embedding min/max behavior and reaction logic inside stat objects (min/max clamping, death triggers at zero, etc.).

6) Min/max rules and unbounded stats

Many stats have defined minimum/maximum boundaries.

  • Example: D&D STR max 20—reaching the max might not have special side effects, but hitting zero can be lethal/harmful.
  • Some stats are unbounded (effectively “anything”).
  • Some stats require embedded logic when limits are reached:
    • Example cited from older D&D: exceeding max HP could cause an explosion.

7) How stat modifications are modeled: flat modifiers vs multipliers

Two main modifier math approaches:

  • Flat add/subtract only
    • Order doesn’t matter (commutative).
  • Multipliers
    • Introduce order-of-operations complexity.
    • Example: movement speed with “+10 ft” and “×2” can differ depending on whether multiplication happens before/after addition.
    • Removing temporary multipliers can be tricky (does removal subtract the correctly scaled amount?).

Stacking multipliers also varies by rule:

  • “×2 then ×2 ⇒ ×4”
  • or treating it as adding to the multiplier (older D&D-like behavior)

Speaker’s suggestion: many systems avoid multipliers to reduce nuance/control problems, but multipliers can be useful for scaling progression curves.


8) Effects system: duration semantics and application windows

Effects are described as packages that modify other stats, with explicit duration types:

  • Instant: applies once and permanently changes the target
    • Example: “instant damage” cannot be dispelled afterward.
  • Permanent (stored/lingering): persists as a state until dispelled
    • Example: turned to stone.
  • Timed with real-time vs pause: whether timers stop during pause.
  • Discrete combat time: durations in rounds/turns rather than seconds.
  • Equipment-based: while equipped, bonuses apply; remove item to revert.
  • Zone-based: applies while in/near an area
    • Example referencing D&D 5e-style wording (e.g., applies at turn start if within range).
  • Source-coupled permanence: effect persists while the source exists
    • Example: curse lasts while the caster is alive.
  • Damage over time (DoT): periodic pulses over a duration, not just a one-time hit.

9) Special case: hit points & damage pipeline complexity

The video emphasizes that HP/damage is often a separate sub-system.

  • Damage is typically modeled as instant
    • The system applies a damage package that reduces HP, rather than keeping a temporary “damaging state.”
  • You may need to model:
    • Damage amount
    • Damage type (fire vs bludgeoning)
    • Damage source (demon vs animal; magical vs non-magical) for conditional rules.
  • Maximum HP is usually derived (separate stat or derived from progression). The speaker suggests treating max HP as the “most HP you can ever have.”

Order-of-operations chain

  1. Modify incoming damage (damage reduction / “iron skin”-type mechanics)

    • If reduction exceeds damage, behaviors discussed:
      • allow negative (can become healing),
      • clamp to zero,
      • clamp to a small minimum (e.g., minimum 1 damage).
    • Warning: making reduction too transparent can harm learning/tactics.
      • Example pitfalls: misleading feedback like “healed for 20” when using the wrong element; “immune” can strongly signal the wrong tactic for players.
  2. Resistances & vulnerabilities (multiplicative)

    • Speaker’s opinion: avoid mid-range resist like 50% because it can obscure tactical reasons to switch strategies.
    • Suggestion: very large or very small values for clearer signals.
  3. Shields / temporary HP

    • These typically deplete before underlying HP.
    • Bypass possibilities may exist (implementation-dependent).
  4. Damage gates

    • Cap damage per hit (survivability model seen in games like Anthem and some Zelda titles).
    • Role impact:
      • high gates + low HP can handle big single hits,
      • high HP handles lots of small hits.

10) State transitions & the “dying-dying” (dying dead) bug source

Many RPG bugs come from transitional states.

  • When HP reaches zero, the entity may not instantly become a corpse.
  • There is often a dying transitional state:
    • e.g., falls over,
    • can still affect pathfinding,
    • final death triggers later.

Complications

  • Healing/resurrection can happen during the transitional window.
  • Death/revival logic may run twice or in conflicting ways, double-upsetting systems
    • example: pathfinding grid placement applied twice.

The principle generalizes to other states:

  • prone/stunned/blinded need alignment between gameplay timing and animation timing.
    • If animation lags behind gameplay, players may exploit discrepancies
      • e.g., advantage while visual is “standing up” but mechanics say “prone.”
    • Approaches:
      • apply gameplay instantly and treat animation as purely visual, or
      • ensure consistent transitions.

11) Implementation / architecture advice and examples

The speaker argues stat systems aren’t inherently hard, but correctness requires intent. Consider:

  • math design
  • storage approach
  • space efficiency / retrieval performance

Examples of evolving approaches:

  • In the 90s:
    • extremely space-efficient storage (single numbers, bitfields),
    • but complicated effect application/removal.
  • On Sonic Chronicles:
    • more structured system with events like on change / on min / on max to reduce errors.
  • Current Unreal project:
    • “heavier” implementation using Blueprints,
    • likely storing base stat + separate modifiers applied at runtime,
    • accepting extra retrieval cost to reduce bugs.

12) Overall takeaway

If you’re building an RPG stat system, expect more than “just an HP counter.” The biggest risks are:

  • dependency propagation bugs (base → derived → secondarily derived),
  • order-of-operations issues (multipliers/additives),
  • duration semantics mistakes,
  • transitional-state bugs (dying-dead, prone animation mismatch).

Main speakers / sources

  • Main speaker: The single creator who authored/narrated the video (no name provided in the subtitles).
  • External references (examples):
    • Dungeons & Dragons (3rd/5th/2nd edition concepts)
    • Games cited as examples: Anthem, Zelda, Baldur’s Gate, Sonic Chronicles

Original video