View Format: Multi-Page Single Page
All Docs Documentation Version: Base (Free) Influence System Modifier System

Base Demo Scene

An interactive demo showcasing core attribute features with three panels: Character Stats, Stat Checks, and Combat Simulation. No generated code or ScriptableObjects required - everything runs from code.

Quick Setup

1 Open the Demo Scene
Navigate to Simple Attribute Forge/Base/FreeDemo/BaseDemo.unity and open it
2 Hit Play
The demo is fully self-contained - just press Play to see it in action
That's it! The demo creates all attributes from code at runtime. No wizard setup, no generated ScriptableObjects needed.

Three-Panel Layout

The demo scene features three side-by-side panels, each demonstrating different aspects of the attribute system:

Character Stats (Left)

Live attribute display with interactive controls:

  • 8 attributes: HP, Mana, Stamina (Vitals) + STR, DEX, INT, DEF, LCK (Basic)
  • Real-time regeneration with visual bars
  • Take Damage (-35 HP)
  • Heal (+50 HP)
  • Cast Spell (-25 MP)
  • Rest (Restore All)

Stat Checks (Middle)

Random challenges that test your attributes:

  • Random stat check with difficulty rating
  • Pass/fail based on your current stat values
  • Train (+2 Base) to permanently increase stats
  • Drink Potion (+8 for 5 seconds) for temporary boost
  • Shows modifierBonus in action

Combat Sim (Right)

Auto-battle between Player and a Goblin enemy:

  • Turn-based combat log
  • Damage based on STR vs DEF
  • Enemy has its own attribute set
  • Start Fight / Reset buttons
  • Demonstrates attribute interaction patterns

What It Demonstrates

Regeneration System

Take damage and watch HP regenerate automatically after a delay. Stamina and Mana also regenerate. The demo uses ModifyValue() which triggers the regen system.

Three-Tier Values

The potion button adds to modifierBonus temporarily, showing the base + modifier = total calculation in real time. Train adds to baseValue permanently.

Creating Attributes in Code

All attributes are created programmatically using SimpleRuntimeAttribute constructors - no wizard generation needed for simple use cases.

Behavior Types

Vitals (HP/Mana/Stamina) show current/max with regeneration. Basic stats (STR/DEX/INT) show totalValue. Demonstrates when to use each type.

Key Code Patterns

Creating Attributes from Code

// Vital attribute with regeneration var hpDef = new SimpleAttributeValue { attributeName = "Health", code = "HP", behaviorType = SimpleBehaviorType.Vital, baseValue = 100, minValue = 0, maxValue = 200, canRegenerate = true, regenerationRate = 3f, regenerationDelay = 2f }; var hp = new SimpleRuntimeAttribute(hpDef); // Basic stat (no regeneration) var strDef = new SimpleAttributeValue { attributeName = "Strength", code = "STR", behaviorType = SimpleBehaviorType.Basic, baseValue = 12, minValue = 1, maxValue = 99 }; var str = new SimpleRuntimeAttribute(strDef);

Temporary Buffs via modifierBonus

// Apply temporary potion buff attribute.modifierBonus += 8f; // Remove after duration (via coroutine) yield return new WaitForSeconds(5f); attribute.modifierBonus -= 8f;

Manual Regeneration Tick

// The demo implements manual regen since attributes aren't on a MonoBehaviour // In a real game, the generated component handles this automatically if (attr.canRegenerate && attr.currentValue < attr.totalValue) { attr.RegenerateStep(Time.deltaTime); }

Customization

The demo source code is in FreeDemo/BaseDemo.cs. You can:

Remember: This demo creates attributes from code for simplicity. In a real game, you would use the Attribute Data Wizard to generate a proper attribute component with automatic regeneration management, events, and type-safe access.