Armor System (AS) Plugin


1. Overview

The Armor System (AS) plugin provides a data-driven framework for equippable armor pieces that protect characters from damage. It manages:

  • Durability — Per-piece durability that degrades on impact and can be repaired.
  • Quality Tiers — Discrete quality levels (e.g. Shoddy, Common, Fine, Masterwork, Legendary) that modify base stats.
  • Material Properties — Each material (UMaterialTypeDataAsset) defines penetration resistance, ricochet chance, spall generation, density, and brittleness.
  • Damage Interaction — Integrates with the central Damage System (FDamageContext) to calculate mitigation.
  • Limb Coverage — Defines which limbs are protected via FGameplayTag coverage sets.
  • GAS Integration — Grants UGameplayEffects & FGameplayTag containers when equipped.
  • Data-Driven — All archetypes, materials, and quality modifiers are defined in UDataAsset classes.

This plugin depends on the Damage System (DS) for shared types and the damage routing pipeline, and complements the Limb Health System (LHS) and Projectile System (PDS).

Class Diagram


2. Core Features

  • Equippable Armor — Characters can equip/unequip armor to named slots (e.g., Head, Chest, Arms, Legs).
  • Durability Management — Manages durability per armor instance.
    • CurrentDurability and MaxDurability tracked per piece.
    • Server-authoritative repair and break-on-zero logic.
  • Quality Tiers — Leverages quality levels to modify armor properties.
    • Uses EItemInstanceQuality from ItemSystemTypes.h (DS).
    • Quality mappings adjust durability, weight, resistance, and passive effects.
  • Material-Based Interactions — Armor mitigation logic is influenced by material properties.
    • UMaterialTypeDataAsset defines material factors (penetration, ricochet, spall).
    • Interacts with projectile data (ERoundType, EProjectileType from DamageSystemTypes.h).
  • Limb Coverage — Armor pieces define which body limbs they protect.
    • CoverageTags in each archetype identify protected limbs via LHS tags (e.g., Tag.Limb.Head).
  • GAS Integration — Seamlessly integrates with the Gameplay Ability System.
    • Grants passive effects (UGameplayEffect classes) and tags while equipped.
    • Effects are removed upon unequip.
  • Data-Driven Design — Core armor properties are defined in Data Assets.
    • UArmorArchetypeDataAsset for base stats, visuals, coverage, quality modifiers.
    • UMaterialTypeDataAsset for intrinsic material definitions.

3. Key C++ Classes & Data Assets

Class / AssetTypeResponsibility
UArmorSystemComponentUActorComponentManages equipped pieces, handles equip/unequip RPCs, processes ProcessDamageInteraction(FDamageContext&).
FArmorPieceInstancestruct (ArmorSystemTypes.h)Runtime data: archetype reference, quality, current/max durability, socket name, mesh component pointer.
FEquippedArmorSlotInfostruct (ArmorSystemTypes.h)Helper struct: slot tag + FArmorPieceInstance, used in replication array.
UArmorArchetypeDataAssetUPrimaryDataAssetDefines base stats (durability, thickness, weight), visuals, coverage tags, material, and quality mappings.
UMaterialTypeDataAssetUDataAssetDefines material factors: PenetrationResistanceFactor, RicochetChanceMultiplier, SpallGenerationFactor, DensityKgm3, BrittlenessFactor.
ArmorSystemTypes.hHeaderDeclares FArmorPieceInstance, FEquippedArmorSlotInfo, any AS-specific enums/structs.

Module Files:

  • IArmorSystemModule.h — public module interface
  • ArmorSystemModule.cpp — module startup/shutdown
  • ArmorSystem.Build.cs — declares dependencies (includes "DamageSystem")

4. Directory Structure

TEXT
ArmorSystem/                       ← Plugin root
└── Source/
    └── ArmorSystem/               ← Module root
        ├── ArmorSystem.Build.cs
        ├── Public/
        │   ├── IArmorSystemModule.h
        │   ├── ArmorSystemTypes.h
        │   ├── MaterialTypeDataAsset.h
        │   ├── ArmorArchetypeDataAsset.h
        │   └── ArmorSystemComponent.h
        └── Private/
            ├── ArmorSystemModule.cpp
            ├── MaterialTypeDataAsset.cpp
            ├── ArmorArchetypeDataAsset.cpp
            └── ArmorSystemComponent.cpp

Note: ItemSystemTypes.h, DamageSystemTypes.h, and MyGameGameplayEffectContext.h are now owned by the DamageSystem plugin.


5. Integration Points

5.1 Damage System (DS)

  • Shared Types

    • ItemSystemTypes.h for EItemInstanceQuality, FStatModifier, etc.
    • DamageSystemTypes.h for ERoundType, EProjectileType
    • FDamageContext struct
  • Damage Routing

    • UDamageRouterComponent invokes

      CPP
      ArmorComponent->ProcessDamageInteraction(FDamageContext& Context, FGameplayTag HitLimbTag, FName HitBoneName);
      
    • AS updates Context.CurrentDamageToApply, Context.bArmorWasHit, Context.bArmorPenetrated, Context.DamageAbsorbedByArmor, etc.

5.2 Limb Health System (LHS)

  • CoverageTags in UArmorArchetypeDataAsset must match LHS limb tags (e.g., Tag.Limb.Chest) so that AS correctly identifies which limb a given hit affects.

5.3 Projectile System (PDS)

  • FDamageContext fields populated by PDS (mass, caliber, round type, behavior type) feed into AS’s mitigation calculations using material factors.

6. Setup & Usage Notes

  1. Add Component

    CPP
    // In your Character
    UPROPERTY(VisibleAnywhere) UArmorSystemComponent* ArmorComponent;
    
  2. Module Dependency

    • In ArmorSystem.Build.cs:

      CSHARP
      PublicDependencyModuleNames.AddRange(new string[]{
          "Core", "CoreUObject", "Engine",
          "GameplayTags", "GameplayAbilities",
          "DamageSystem"
      });
      
    • In ArmorSystem.uplugin, add "DamageSystem" under "Plugins".

  3. Data Asset Creation

    • Material Assets (UMaterialTypeDataAsset): define material factors.

    • Archetype Assets (UArmorArchetypeDataAsset):

      • Assign MaterialTypeDataAssetClass
      • Set BaseMaxDurability, BaseArmorThicknessCm, BaseWeightKg
      • Configure CoverageTags (FGameplayTagContainer of LHS limb tags)
      • Populate QualityStatModifiers (using mappings from ItemSystemTypes.h)
  4. Equipping Logic

    • Implement inventory/equipment UI or code to call on server:

      CPP
      ArmorComponent->Server_EquipArmor(ArchetypeData, DesiredQuality, SlotTag);
      
    • On unequip:

      CPP
      ArmorComponent->Server_UnequipArmor(SlotTag);
      
  5. ProcessDamageInteraction

    • Override or extend to incorporate full ballistic logic:

      CPP
      void UArmorSystemComponent::ProcessDamageInteraction(
          FDamageContext& Context,
          FGameplayTag HitLimbTag,
          FName HitBoneName
      );
      
    • Use Context.ProjectileMassKg, Context.ProjectileCaliberMm, Context.ProjectileRoundType with material factors to compute:

      • Penetration chance
      • Ricochet probability
      • Spall energy
    • Update Context.CurrentDamageToApply and reduce CurrentDurability.