Core Architecture

Documentation Unreal Engine AI Architecture

Understanding the StateTree + Behavior Tree hybrid architecture used in professional action games.


The StateTree + Behavior Tree Hybrid

This plugin implements the AAA-standard AI architecture used in professional action games. Understanding this architecture is key to using the plugin effectively.

Why This Architecture?

The Problem with Traditional Approaches:

Most developers build AI using a single massive Behavior Tree. This leads to:

  • ❌ Unmaintainable trees with hundreds of nodes
  • ❌ Mixed concerns (strategy + execution in one place)
  • ❌ Difficult debugging and iteration
  • ❌ Poor scalability as complexity grows

The Professional Solution:

Separate strategic thinking from tactical execution:

StateTree (The Brain) - High-level decision making:

┌─────────────────────────────────────┐
│ StateTree: Strategic Layer          │
├─────────────────────────────────────┤
│ • Evaluates combat context          │
│ • Scores available actions          │
│ • Manages state transitions         │
│ • Controls movement strategy        │
│ • Handles target acquisition        │
└─────────────────────────────────────┘
          ↓
┌─────────────────────────────────────┐
│ Action Execution: Tactical Layer    │
├─────────────────────────────────────┤
│ Option A: Gameplay Ability          │
│   → Simple: Play montage, apply dmg │
│                                     │
│ Option B: Behavior Tree Sequence    │
│   → Complex: Multi-step, branching  │
└─────────────────────────────────────┘

Benefits:

Clear Separation - Strategy decisions separate from action execution ✅ Scalability - Add new actions without touching state machine logic ✅ Debuggability - Isolate issues to strategy or execution layer ✅ Maintainability - Each layer has single responsibility ✅ Industry Standard - Same pattern used in major action games

Pro Tip: When to Use Each Execution Mode Use Gameplay Abilities for simple attacks (play montage → damage). Use Behavior Tree sequences for complex multi-step actions with conditional branches (charge attack → check stamina → branch to heavy or light version).


System Flow

  1. StateTree polls ActionEvaluationComponent each tick
  2. Component gathers context: distance, angle, health, threat, tags
  3. ActionSet scores all available actions using:
    • Distance and angle evaluations
    • Health-based modifiers
    • Cooldown status
    • Context tags (player blocking, low health, etc.)
    • Novelty decay (anti-repetition)
  4. Best action selected and executed as:
    • Gameplay Ability (via AbilitySystemComponent), OR
    • Behavior Tree sequence (via temporary BT component)
  5. Movement system evaluates 16 directions simultaneously:
    • Scores each for distance, angle, avoidance
    • Blends pathfinding with direct input
    • Applies strafing, retreat, or approach behavior

What It Is / What It's Not

What SoulslikeCombat IS

Production-Ready Enemy AI - Intelligent tactical combat behaviors
Modular Component System - Mix and match for different enemy types
Data-Driven Configuration - Designers tune without code
Blueprint-Friendly - Full Blueprint support, C++ optional
Demo-Included - Working enemy to study and extend
Professionally Architected - AAA-standard StateTree/BT hybrid
Scalable - Works for simple enemies and complex bosses

What It's NOT (Yet)

NOT a Complete Game Template - Combat systems only, not a full game
NOT Player Character Combat - Focused on enemy AI (player template coming Q1 2025)
NOT Multiplayer-Ready - Single-player focused (replication planned Q2 2025)
NOT a Visual Scripting Tool - Uses standard UE StateTree and Behavior Tree
NOT "No-Code" - Requires understanding of UE's AI, GAS, and animation systems

Scope & Expectations

This plugin provides:

  • Enemy AI decision-making and movement
  • Melee combat hit detection
  • Action scoring and execution framework
  • Multi-enemy coordination
  • Component-based architecture

You still need:

  • Player character combat system
  • UI/HUD (health bars, lock-on indicators, damage numbers)
  • Level design and encounter placement
  • Save/load systems
  • Progression and difficulty balancing