Appearance
Derived attributes
Mass Forge derived-attribute profiles calculate deterministic linear stats for actorless or represented Mass entities. A profile can express formulas such as maximum health from vitality, armor from strength, or combat power from other calculated attributes.
Setup
- Define every source and target attribute in the global Vital, Combat, or Support schemas.
- Create a Mass Forge Derived Attribute Profile Data Asset.
- Give the profile a stable
ProfileIdand add up to eight rules. - Add Mass Forge Attributes Trait and Mass Forge Derived Attributes Trait to the same Mass Entity Config.
- Select the profile on the derived-attributes trait.
Each rule supports a base value and up to eight source terms:
Target = BaseValue + sum(SourceAttribute × Coefficient)
Examples:
MaxHealth = 100 + Vitality × 10Armor = 5 + Strength × 0.5CombatPower = AttackPower + Armor × 0.25
Negative coefficients are valid. An empty term list produces a constant derived value. The target attribute's current schema bounds are compiled into the rule and applied after calculation.
Dependency graph
A source may itself be the target of another derived rule. Authors do not need to arrange rules manually: the profile builds a deterministic topological order and preserves authored order whenever multiple rules are otherwise independent.
Duplicate targets and circular dependencies are rejected. For example, Armor depending on CombatPower while CombatPower depends on Armor produces a validation error instead of frame-dependent results.
Derived outputs should be treated as processor-owned values. A direct change to a derived target can be overwritten on the next processor run.
Runtime behavior
The trait resolves attribute names and dependencies while building the entity template. The compiled formula graph is stored as a Mass const-shared fragment, so every entity in the archetype uses the same immutable rules without carrying a per-entity rule copy.
The processor evaluates the graph during PrePhysics and is explicitly ordered before Mass Forge regeneration. A regeneration rule can therefore sample a freshly calculated derived attribute in the same processing phase.
Calculations use double precision internally. If a runtime source or result is non-finite, that rule leaves its target unchanged rather than contaminating entity state.
Validation and limits
A profile reports invalid data for a missing ID, no rules, more than eight rules, duplicate or missing targets, more than eight terms in a rule, missing source attributes, non-finite numeric values, or any dependency cycle.
Schema membership is checked when the trait compiles the profile. A profile that references an attribute absent from the configured schemas is rejected for that entity template with an actionable log error.
Performance contract
Compiled rules contain only domains, slots, coefficients, base values, and target bounds. The entity loop performs no name lookup, asset loading, allocation, graph traversal, or delegate dispatch. The graph consumes shared archetype memory and adds zero bytes of rule storage per entity.
The current formula model is intentionally linear. Nonlinear and project-defined calculations are not part of the supported formula contract in this release.