All Docs Documentation Version: Base (Free) Influence System Ultimate
Simple Attribute Forge Ultimate

Formula Pipeline

Understanding the 7-step mathematical calculation system

Pipeline Overview

Complete Mathematical Formula
Result = PostFlat + ((Start + Flat) × (1 + AddPct% - SubPct%) × Multipliers)

Every formula in the Ultimate system follows this exact 7-step pipeline, ensuring consistent and predictable calculations across all attribute relationships.

Pipeline Flow Visualization

Step 1: Starting Point (Zero or TargetBase)
Step 2: Flat Bonuses (Add/Subtract)
Step 3: Additive Percentages
Step 4: Subtractive Percentages
Step 5: Multipliers
Step 6: Post-Flat Bonuses
Step 7: Apply Mode (Override/Add/Subtract)

Step 1: Starting Point

Determines the initial value for all subsequent calculations.

Start Modes

public enum StartMode { Zero, // Begin calculation from 0 TargetBase // Begin from target attribute's baseValue }

When to Use Each Mode

Zero Mode

Use for: Creating new calculated values

  • Damage calculations based on STR
  • Spell power based on INT
  • Movement speed based on AGI

TargetBase Mode

Use for: Modifying existing values

  • Level-based health scaling
  • Equipment bonuses to existing stats
  • Percentage modifications

Practical Examples

Zero Mode: STR 15 → Damage calculation starts at 0, adds STR bonuses
TargetBase Mode: Health 100 → Level scaling starts at 100, adds level bonuses

Step 2: Flat Bonuses

Add or subtract flat values based on source attributes.

Formula Structure

flatTotal = Σ(sourceValue × multiplier × operation)

Configuration

public class FormulaRow { public string source; // Source attribute (e.g., "Strength") public MathOperation operation; // Add or Subtract public float value; // Multiplier (e.g., 2.0 for "2 per point") }

Real Examples

STR → Damage: Strength 15 × 2.0 = +30 damage
Multiple Sources: STR 15 × 1.5 + END 12 × 0.8 = 22.5 + 9.6 = +32.1
Subtractive: Weight 50 × -0.1 = -5 movement speed

Step-by-Step Calculation

Example: Multi-Source Damage Formula
Sources: • Strength: 20 (×1.5 multiplier) • Dexterity: 15 (×0.8 multiplier) • Intelligence: 10 (×-0.2 multiplier, reduces physical damage) Calculation: (20 × 1.5) + (15 × 0.8) + (10 × -0.2) = 30 + 12 - 2 = 40

Step 3: Additive Percentages

Percentage increases based on source attributes. Values are in percentage points (10 = 10%).

Formula Structure

addPctTotal = Σ(sourceValue × percentage) / 100

Typical Use Cases

Calculation Example

Intelligence → Spell Damage Bonus
Configuration: • Source: Intelligence • Percentage: 2 (means 2% per point) With Intelligence = 25: addPctTotal = (25 × 2) / 100 = 50 / 100 = 0.5 (50% increase)

Step 4: Subtractive Percentages

Percentage decreases based on source attributes. Combined with additive percentages in final calculation.

Formula Structure

subPctTotal = Σ(sourceValue × percentage) / 100 combinedPct = (1 + addPct - subPct)

Common Applications

Combined Percentage Example

Movement Speed with Bonuses and Penalties
Additive: AGI 20 × 1% = +20% Subtractive: Encumbrance 15 × 0.5% = -7.5% Combined: 1 + 0.20 - 0.075 = 1.125 (12.5% net increase) Final calculation: baseSpeed × 1.125

Step 5: Multipliers

Static multiplication factors that compound with each other.

Formula Structure

multiplierTotal = factor1 × factor2 × factor3...

Configuration

public class MultiplierRow { public string label; // Description (e.g., "Equipment Bonus") public float factor; // Multiplication value (e.g., 1.2 for 20% increase) }

Common Multiplier Sources

Compounding Example

Multiple Multipliers
Equipment Bonus: ×1.2 Class Specialization: ×1.15 Legendary Item: ×1.3 Total Multiplier: 1.2 × 1.15 × 1.3 = 1.794 (79.4% increase)

Step 6: Post-Flat Bonuses

Final flat adjustments applied after all percentage and multiplier calculations.

Formula Structure

postFlatTotal = Σ(amount × additive_flag)

Configuration

public class PostFlatRow { public string label; // Description public float amount; // Flat value public bool isAdditive; // true = add, false = subtract }

Ideal Use Cases

Why Post-Flat Matters

Comparison: Flat vs Post-Flat
Example: 20% multiplier applied Flat Bonus (+10): (10 + 10) × 1.2 = 24 Post-Flat Bonus (+10): (10 × 1.2) + 10 = 22 Post-flat ensures the +10 is never multiplied by other effects.

Step 7: Apply Mode

Determines how the calculated result affects the target attribute's formulaBonus.

Apply Modes

public enum ApplyMode { OverrideBase, // formulaBonus = result - baseValue AddToBase, // formulaBonus = result SubtractFromBase // formulaBonus = -result }

Mode Explanations

OverrideBase

Effect: Sets totalValue to exactly the calculated result

Use for: Level-scaled attributes where the formula determines the final value

// Level 5 → Health should be exactly 200 // baseValue: 100, result: 200 // formulaBonus = 200 - 100 = 100 // totalValue = 100 + 100 = 200

AddToBase

Effect: Adds calculated result as a bonus to baseValue

Use for: Bonus calculations that stack with base values

// STR 10 → adds 20 damage bonus // baseValue: 50, result: 20 // formulaBonus = 20 // totalValue = 50 + 20 = 70

SubtractFromBase

Effect: Subtracts calculated result from baseValue

Use for: Penalty systems and encumbrance effects

// Weight 30 → reduces speed by 15 // baseValue: 100, result: 15 // formulaBonus = -15 // totalValue = 100 + (-15) = 85

Complete Pipeline Example

Let's trace through a complex formula that uses multiple pipeline steps.

Complex Spell Damage Formula
Target: Spell Damage Source Attributes: Intelligence 25, Level 8, Magic Weapon +15 Configuration: • Start Mode: Zero • Flat: Intelligence × 2.0 = 50 • Add%: Level × 3% = 24% • Multiplier: Magic Weapon Bonus ×1.3 • Post-Flat: Base Spell Power +20 • Apply: Add to Base

Step-by-Step Calculation

1 Starting Point: Zero Mode → start = 0
2 Flat Bonuses: Intelligence 25 × 2.0 = 50 → total = 0 + 50 = 50
3 Additive %: Level 8 × 3% = 24% → addPct = 0.24
4 Subtractive %: None → subPct = 0
5 Multipliers: Magic Weapon ×1.3 → mul = 1.3
6 Post-Flat: Base Spell Power +20 → postFlat = 20
7 Final Calculation: 20 + ((0 + 50) × (1 + 0.24 - 0) × 1.3) = 20 + (50 × 1.24 × 1.3) = 20 + 80.6 = 100.6
Result: The Spell Damage attribute gains 100.6 points of formulaBonus, added to its baseValue.

Pipeline Design Principles

Order of Operations

The pipeline order is carefully designed to produce intuitive results:

  1. Flat bonuses first: Raw attribute scaling
  2. Percentages next: Modify the flat total proportionally
  3. Multipliers after: Apply equipment and class bonuses
  4. Post-flat last: Guaranteed minimums and set bonuses

Mathematical Properties

Additive vs Multiplicative:

Preventing Common Issues

Feedback Loop Prevention: Formulas always read from baseValue, never totalValue, preventing infinite loops and accumulation errors.
// CORRECT - Formula reads baseValue float sourceValue = attributes.GetAttributeValue("Strength"); // Returns baseValue // INCORRECT - Would create feedback float sourceValue = attributes.strength.totalValue; // Includes formula results

Advanced Pipeline Features

Conditional Breakpoints

Breakpoints can modify any step of the pipeline based on conditions:

Threshold Breakpoint: When Level ≥ 20, add ×1.5 multiplier to damage formulas
Step Breakpoint: Every 5 STR points adds +10 flat damage bonus

Multiple Formula Integration

Multiple formulas can target the same attribute - their results are summed:

Health Total Formula Bonus: • LevelHealth formula: +80 • ConstitutionHealth formula: +30 • SetBonusHealth formula: +50 • Total formulaBonus: 160 Final Health: baseValue(100) + formulaBonus(160) = 260

Execution Order

Use execution order to create formula dependencies:

Order 0: Calculate base damage (STR → Damage) Order 1: Calculate spell power (INT → SpellPower) Order 2: Calculate total DPS (Damage + SpellPower → DPS)

Testing the Pipeline

Wizard Test Preview

The Influence Wizard includes a live test panel that shows pipeline calculations in real-time:

  1. Set test values for all source attributes
  2. Select a formula to test
  3. View step-by-step breakdown in the preview panel
  4. Modify values to test edge cases

Runtime Testing

// Test specific formula with custom values var testValues = new Dictionary<string, float> { {"Strength", 20}, {"Intelligence", 15}, {"Level", 10} }; float result = orchestrator.TestFormula("MyFormula", testValues); Debug.Log($"Formula result: {result}");

Debug Mode Output

// Enable detailed logging orchestrator.debugMode = true; // Console output: [Pipeline] StrengthDamage calculation: Step 1 (Start): 0 Step 2 (Flat): Strength(20) × 1.5 = 30 → total: 30 Step 3 (Add%): None → 0% Step 4 (Sub%): None → 0% Step 5 (Mul): Equipment ×1.2 → total: 36 Step 6 (PostFlat): Base +10 → total: 46 Step 7 (Apply): AddToBase → formulaBonus = 46

Pipeline Best Practices

Step Selection Guidelines

Use Flat Bonuses For

  • Direct attribute scaling (STR → damage)
  • Linear progressions
  • Multiple source combinations

Use Percentages For

  • Proportional scaling effects
  • Stat-based efficiency bonuses
  • Diminishing returns simulation

Use Multipliers For

  • Equipment and class bonuses
  • Situational modifiers
  • Difficulty scaling

Use Post-Flat For

  • Minimum value guarantees
  • Set bonuses
  • Fixed additions

Performance Tips

Common Mistakes

Avoid These Patterns: