Skip to content

JuliGommz/CognitionAI

Repository files navigation

Cognitio

A trait-based decision framework for personality-driven agents

Unity C# License Phase

A framework for personality-driven character decision-making. Characters evaluate situations through their individual psychological profile — built on an interdisciplinary foundation combining personality psychology (Big Five, HEXACO, 16PF), neuroscience (dual-process theory, somatic markers), and appraisal theory — instead of relying on scripted behavior trees or random responses. Currently implemented in Unity; designed as a middleware layer adaptable to other engines.

Product Principle: The core product works without writing code. Characters, context, and connections are configured through Inspector UI. Code access is for advanced use cases only.


What It Does

Characters have 45 personality traits across 4 categories (Emotional, Social, Cognitive, Moral), organized in 15 subcategories. A cautious character avoids conflict. An empathetic character prioritizes social bonds. Behavior emerges from personality, not scripts.

Situation → [Gut Reaction (System 1) + Deliberation (System 2) + Moral Integration (vmPFC)] → Ranked Actions

The framework acts as a bidirectional middleware layer — game systems feed context and events into Cognitio, Cognitio feeds decisions back out to your existing systems (Behavior Trees, FSMs, Utility AI). It connects to your game, not replaces it.

Three Frameworks address the full scope:

  1. Decision Model — how a single character evaluates options and picks one (Phase 2 ✅)
  2. Character ↔ Character — how relationships between characters change decisions (Phase 3)
  3. Character ↔ World — how the environment feeds into and receives from decisions (Phase 4-5)

Current State

Phase Description Status
1 Foundation — Trait System & Architecture ✅ Complete
1.1 Custom Inspector UI & Design System ✅ Complete
2 Core Decision Loop (Dual-Process Architecture) ✅ Complete
3 Personality Integration & Authoring Suite Foundation 🔜 Next
4 Unity Integration, Characters & Authoring Suite GUI Planned
5 Performance Optimization Planned
6 Asset Store Polish Planned

What's built:

  • 45 trait definitions as ScriptableObjects, organized in 4 categories and 15 subcategories
  • Immutable character profiles (config) with mutable runtime state (clone) separation
  • Custom Inspector UI with category foldouts, sliders, dark/light theme support
  • Design System documentation with component library, personas, and accessibility standards
  • Full dual-process decision engine: Emotional Appraisal (System 1) + Cognitive Evaluation (System 2) + Value Integration (vmPFC moral blending)
  • Motivation system with priority-weighted fulfillment scoring
  • Goal tracking with active/complete/failed lifecycle
  • LOD system (Full / Reduced / Minimal) for performance scaling
  • Decision logging with full score breakdown tracing
  • DecisionEngineRunner MonoBehaviour for Inspector-based setup
  • Zero external dependencies, zero GC allocations in decision hot path

What's next (Phase 3): Emotional state persistence (moodlet system), relationship system (trust, respect, affection), and the authoring suite foundation (export pipeline prototype).


Architecture

CharacterProfile (ScriptableObject, immutable config)
├── TraitDefinitions (0.0–1.0 values)
│   ├── Emotional  — 9 traits (Compassion, EmotionalControl, StressTolerance, ...)
│   ├── Social     — 12 traits (Assertiveness, Trust, Leadership, ...)
│   ├── Cognitive  — 12 traits (AnalyticalProcessing, StrategicThinking, ...)
│   └── Moral      — 12 traits (Justice, Integrity, MoralFlexibility, ...)
└── 15 Subcategories (AggressionRelated, Creativity, DecisionMaking, ...)

RuntimeCharacterData (mutable deep clone)
├── Active Trait Values
├── Motivations (priority 0-10)
├── Goals (active/complete/failed)
└── State Flags

Decision Pipeline:
  ContextParameters ─┐
  ActionDefinitions ──┤
  RuntimeCharacterData┤
                      ▼
  EmotionalAppraisal (System 1) → EmotionalResponse (VAD + hijack flag)
  CognitiveEvaluation (System 2) → TraitScore + MotivationScore + GoalScore
  ValueEvaluator (vmPFC) → Blended final scores per action
                      ▼
  DecisionResult (ranked actions with full score breakdown)

Key design decisions:

  • Config/Runtime separation — ScriptableObjects define who a character IS; RuntimeCharacterData tracks what they DO
  • Dual-process architecture — System 1 (fast emotional) + System 2 (deliberate cognitive), validated by Kahneman research
  • Moral traits as integration weights — Moral category modifies how Emotional/Social/Cognitive combine, not what they score (vmPFC neuroscience)
  • LOD gating — Full (all systems), Reduced (skip emotional), Minimal (trait-only) for scalable AI complexity
  • Zero-allocation hot path — no new, no LINQ in decision evaluation
  • Custom Inspector — trait editing via sliders, category foldouts, progressive disclosure
  • Theme-aware UI — dark/light mode with shared constants (CognitionEditorConstants)
  • Output-only mode — can also run as a pure decision layer feeding into existing Behavior Trees, FSMs, or Utility AI without bidirectional wiring

Research Foundation

The trait system and decision architecture are grounded in interdisciplinary research, not a single personality model:

  • Personality Psychology: Big Five (OCEAN), HEXACO, Cattell 16PF — validated trait granularity and category structure
  • Neuroscience: Brain-trait correlates (amygdala, vmPFC, dlPFC, TPJ) mapped to each trait category via fMRI meta-analyses
  • Decision Theory: Kahneman's Dual Process Theory (System 1/System 2), Damasio's Somatic Marker Hypothesis
  • Emotion Science: Gross Emotion Regulation model, Panksepp's Affective Neuroscience, OCC appraisal theory
  • 4-Category Validation: Emotional → Limbic system, Social → TPJ/MPFC networks, Cognitive → dlPFC executive function, Moral → vmPFC integration weights

All 20 research requirements validated through peer-reviewed neuroscience sources (Nature, PMC, Frontiers, JNeurosci).


Tech Stack

  • Engine: Unity 6.0+ (current implementation; engine-agnostic architecture planned)
  • Language: C# (.NET Standard 2.1)
  • Architecture: ScriptableObject-based, custom Inspector (IMGUI)
  • Dependencies: None (fully standalone)

Getting Started

git clone https://github.com/JuliGommz/CognitionAI.git
  1. Open 04_UnityProjects/Cognitio_TestingEnvironment/ in Unity 6.0+
  2. Right-click in Project window → Create > Cognitio > Character Profile
  3. Add traits via the Inspector, adjust values with sliders
  4. See the Architecture section above for how the decision engine works

Project Structure

Cognitio/
├── 04_UnityProjects/
│   └── Cognitio_TestingEnvironment/
│       └── Assets/Cognitio/
│           ├── Scripts/
│           │   ├── Core/              # Trait system (CharacterProfile, RuntimeCharacterData, ...)
│           │   ├── DecisionEngine/    # Decision pipeline (EmotionalAppraisal, CognitiveEvaluation, ...)
│           │   └── Editor/            # Custom Inspector UI
│           └── Data/                  # Trait definitions & character profiles
└── 01_Documentation/
    └── Design_System/                # UI/UX specs

Roadmap

Short-term (Phase 3): Emotional state persistence (moodlet system with personality-based decay), relationship system (trust, respect, affection), and authoring suite foundation (export pipeline prototype).

Mid-term (Phase 4): Three complete characters, Authoring Suite GUI (visual node editor), bidirectional integration UX for connecting Cognitio to game systems without code.

Long-term (Phase 5-7): Performance optimization for 200+ characters at 60fps, Asset Store polish with visual debugger, and advanced features based on community feedback.


License

Copyright (c) 2024–2026 Julian Gomez. All rights reserved.

This project is proprietary software. No part of this codebase may be reproduced, distributed, or used in derivative works without explicit written permission from the author.

For licensing inquiries, collaboration, or academic use: [contact TBD]


Author

Julian Gomez — Game & Multimedia Design, with a background in Psychology and Educational Science. Building tools that make game characters feel human.

About

Personality-driven character decision framework. 45 traits, interdisciplinary research foundation, ScriptableObject architecture. Currently implemented in Unity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors