The Companion System (CPS) is a Game Creator 2 module for managing AI companions. Summon pets, party members, or followers that intelligently follow your player, respond to commands, form formations, level up through a bonding system, fight with abilities, and persist across save/load cycles — all configurable through ScriptableObjects and GC2's visual scripting system.
Key Features
Smart Following
Proximity-aware follow with three distance tiers, hysteresis, and automatic speed adjustment. Configurable via FollowProfile ScriptableObjects. Includes stuck detection with escalating recovery.
Formation System
Multiple companions spread into Line, V-Shape, or Circle formations using smoothed proxy transforms. Switch at runtime via visual scripting. Local obstacle avoidance keeps companions from clustering.
Command System
Define custom commands as ScriptableObjects with cooldowns. Route commands using SO reference comparison — no fragile string matching. Commands automatically grant bond points on completion.
Bonding System
Track bond level and tier (Stranger → Familiar → Loyal → Bonded) per companion. Bond grows passively through proximity, and actively via commands, POI visits, and manual modifiers.
Companion Vitals
Standalone health and resource system (Mana/Energy/Stamina/Rage). Supports regen, out-of-combat regen, damage events, death, auto-revive, and invulnerability. No GC2 Stats required.
Ability System
Up to 8 ability slots with cast times, Global Cooldown, resource costs, and bond-tier gates. Abilities target self, friendly, enemy, or ground. Full GC2 visual scripting integration.
Traits System
Assign Common → Legendary traits to companions. Traits apply stat modifiers, grant bonus abilities, and spawn aura VFX. Use TraitPool ScriptableObjects for weighted random assignment.
Target System
Click-to-target, tab-cycle, and nearest-enemy targeting. Targetable component marks GameObjects with a faction (Player/Enemy/Neutral). Abilities validate target faction and range automatically.
Reaction System
Companions react to events with audio, gestures, and VFX. Reactions are bond-gated and throttled by personality frequency settings. Supports 14 trigger types including stuck, bond tier-up, and group alerts.
Idle Behaviors
Autonomous idle actions when the owner is stationary. Companions visit interest points, play animations, and react to their environment. Bond level scales idle frequency.
Party UI
Ready-made prefabs: party frames, companion health/resource bars, ability slot display, target indicator, and tooltip. All driven by CompanionVitals and CompanionAbilitySet events.
GC2 Visual Scripting
Complete set of Instructions, Conditions, and Events covering all systems — following, commands, bonding, vitals, abilities, traits, and targeting. All accessible without writing code.
Persistence
Full GC2 Remember system integration. Active and stored companions are saved/loaded automatically including bond level, active traits, command cooldowns, and vitals.
Optional Bridges
Enable Stats Bridge for companion needs (hunger, happiness) or Inventory Bridge for bag queries. Auto-disable if modules are removed.
Architecture
CPS follows a layered architecture designed for extensibility and clean separation of concerns:
Data Layer
ScriptableObjects define what companions are and how they behave:CompanionDefinition,FollowProfile,CompanionCommand,IdleBehaviorProfile,CompanionPersonality,ReactionProfile,CompanionAbility,CompanionTrait,VitalsProfile
Core Layer
CompanionManager orchestrates spawning and storage. CompanionBrain drives per-companion state and events. CompanionMotor wraps GC2's Character Motion. BondingBehavior tracks bond level and tier transitions.
Behavior Layer
FollowBehavior handles proximity, formations, and stuck recovery. IdleBehavior manages autonomous actions and POI visits. OwnerAwarenessBehavior adds LookAt and sprint reactions. ReactionBehavior plays audio/VFX on companion events. CompanionGroupAwareness broadcasts alerts across the party.
Vitals & Combat Layer
CompanionVitals manages health, resource, regen, and death/revive. CompanionAbilitySet handles ability slots, GCD, and cast state. CompanionTraitHolder applies stat modifiers and bonus abilities. TargetManager handles target selection and cycling.
UI Layer
Ready-made prefabs for party frames, companion health/resource bars, ability slots, target indicators, and tooltips. All driven by C# events — no polling, no Update coupling.
GC2 Integration Layer
Instructions, Conditions, Events, and Remember integration covering all systems. Everything accessible through GC2's visual scripting without code.
Requirements
System Requirements
| Component | Version |
|---|---|
| Unity Version | 2022.3 LTS or newer |
| Game Creator 2 | Core (required) |
| GC2 Stats | Optional (for Needs Bridge) |
| GC2 Inventory | Optional (for Inventory Bridge) |
| TextMeshPro | Optional (for UI) |