How phazorknight/cogito works
Project type and purpose
• COGITO is a Godot 4 “Immersive Sim” template project, not a web app. It provides a modular, component-based framework (player controller, interaction system, inventory, NPCs, quests, UI, audio) that plugs into the Godot engine via add-ons.
High-level architecture analysis
• Top-level: Godot Engine ← project.godot
• -ons folder: each add-on (cogito, input_helper, quick_audio) is a self-contained plugin registered via plugin.cfg
• Inside “addons/cogito”: dozens of submodules (Components, SceneManagement, InventoryPD, QuestSystem, EasyMenus, DynamicFootstepSystem, etc.), each exposing Scenes (.tscn), Scripts (.gd), and Resources (.tres)
• README & docs point to a component‐based, modular design: systems are loosely coupled, accessible via global scripts (cogito_globals.gd) or scene manager
Main components
A. Godot Engine Core
• Resource pipeline (Assets → imported formats)
• Scene tree management (SceneManager, Scenes)
• Input dispatch (InputHelper add-on)
• Audio bus & playback (Godot audio + quick_audio)
B. COGITO Plugin
• Core entry point: plugin.cfg + cogito_plugin.gd
• Globals & settings: cogito_globals.gd, cogito_settings.gd
• SceneManagement module (loading, persistence)
• Player Controller module (first-person controller, DynamicFootstepSystem)
• Interaction System (Components subfolder)
• Inventory System (InventoryPD)
• NPC & Enemy System (CogitoNPC, Enemies)
• Quest System (QuestSystem)
• UI & Menus (EasyMenus + HUD Scenes)
• Theme & VFX
C. External integrations
• Dialogic / Dialogue Manager (plugins not under addons/cogito)
D. Demo Scenes
• Prefabs & DemoScenes illustrate how modules compose into levels
Relationships & data flows
• Engine → loads plugin → registers scene types & systems
• SceneManager → instantiates Scenes → root SceneTree
• InputHelper → captures input → forwards to PlayerController & EasyMenus
• PlayerController → moves camera & physics → triggers DynamicFootstepSystem
• InteractionSystem Components (attached to scene nodes) ← query PlayerController state & Attributes
• InventoryPD ↔ Scenes & UI
• NPCSystem ↔ NavigationAgent → interacts with Player via line-of-sight events
• QuestSystem → listens for events (Scene transitions, Inventory changes) → updates UI via ui_quest_hud
• Audio → quick_audio + Godot buses → play SFX (footsteps, interactions)
• VFX → instantiated by scripts (explosion, bullet decals)
Architectural patterns & principles
• Plugin-based modular architecture: each feature lives in its own folder/add-on with its own plugin.cfg or registration script
• Component-based design: behaviors are scripts (Components/*.gd) attached to scene nodes, encouraging composition over inheritance
• Scene-resource separation: .tscn for structure & layout, .gd for logic, .tres for data
• Global managers: cogito_globals, scene_manager, quest_manager coordinate cross‐cutting concerns
• Loose coupling via signals/events: modules communicate via Godot’s signal system (e.g., player_entered_zone, quest_completed)