# invadingoctopus/comedot architecture

> Architecture diagram of the GitHub repository invadingoctopus/comedot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/invadingoctopus/comedot
- Repository: https://github.com/invadingoctopus/comedot

## Overview

#### Purpose and Runtime
Comedot is a Godot 4.8+ 2D game-framework/template, not a standalone game. It supports multiple genres through scene composition: gameplay actors are Godot entities with reusable behavior components. Godot executes GDScript and `.tscn` scene trees; no backend or external runtime service is indicated. Primary project configuration is `project.godot`.

#### Entry Points and Authoring Workflow
Start from reusable game-scene templates, especially `Templates/Scenes/PlatformerSceneTemplate.tscn` or `Templates/Scenes/OverheadSceneTemplate.tscn`; a consumer copies this repository as their game project and builds under `Game/`. Runtime scene launching/UI framing is represented by `Scenes/Launch/GameFrame.tscn`. Editor-side creation and discovery are supported by the Comedot Godot plugin: `addons/Comedot/plugin.cfg`, `addons/Comedot/Comedot.gd`, and `addons/Comedot/ComponentsDock.tscn`.

#### Entity–Component Composition Core
`Entities/Entity.gd` and `Entities/Entity.tscn` establish the base actor abstraction; `Entities/Characters/PlayerEntity.gd` specializes player behavior. Reusable child-node behavior derives from `Components/Component.gd`. Scenes compose component instances onto entities rather than encoding genre mechanics in inheritance. Templates package ready-made entity combinations, e.g. `Templates/Entities/PlayerEntityTemplate-Platformer.tscn` and `Templates/Entities/BulletEntityTemplate.tscn`.

#### Input, State, Scene, and UI Coordination
Global Godot autoloads form the cross-scene control boundary: `AutoLoad/GlobalInput.gd` centralizes input, `AutoLoad/GameState.gd` holds game-level state, and `AutoLoad/SceneManager.gd` manages scene transitions. `AutoLoad/Settings.gd` provides persistent preference/config access; `AutoLoad/GlobalUI.gd` hosts shared UI behavior. Gameplay components should communicate through these services or Godot node/signal relationships rather than requiring a server.

#### Gameplay Pipelines
Control components convert player/AI input into movement intent; representative implementations are `Components/Control/InputComponent.gd`, `Components/Control/BasicOverheadControlComponent.gd`, and `Components/Control/TileBasedControlComponentBase.gd`. Physics/movement components apply that intent to Godot bodies, collisions, navigation, or tiles: `Components/Physics/CharacterBodyComponent.gd`, `Components/Movement/NavigationComponent.gd`, and `Components/Physics/PlatformerPhysicsComponent.gd`. This separation lets one entity swap control or physics implementations at runtime via `Components/Gameplay/ComponentSwapperComponent.gd`.

#### Domain Systems and Data Contracts
Combat is composed from independently attachable health, damage, faction, weapon, and hit-response components: `Components/Combat/HealthComponent.gd`, `Components/Combat/DamageReceivingComponent.gd`, and `Components/Combat/GunComponent.gd`. Abilities and progression similarly use resource-backed definitions and components: `Resources/Abilities/Ability.gd`, `Components/Gameplay/AbilityComponent.gd`, and `Components/Gameplay/UpgradesComponent.gd`. Stats are the common mutable-value layer through `Resources/Stats/Stat.gd` and `Components/Data/StatsComponent.gd`; payload resources provide data-driven actions/events via `Resources/Payloads/Payload.gd`.

#### Specialized Modes, Presentation, and Content
Turn-based games add a global coordinator plus per-entity turn components: `AutoLoad/TurnBasedCoordinator.gd`, `Components/TurnBased/TurnBasedComponent.gd`, and `Entities/TurnBased/TurnBasedEntity.gd`. UI is a separate presentation layer that binds gameplay resources to HUD, inventory, ability, and upgrade controls, e.g. `UI/Lists/InventoryList.gd`, `UI/Lists/AbilityButtonsList.gd`, and `UI/Views/StatUI.gd`. Shared prototype assets, tilesets, themes, and shaders are local project resources under `Assets/`; spawning/world-population behavior is provided by `Scenes/Gameplay/PopulateArea.gd` and `Scripts/Gameplay/Spawner.gd`.

Main entry points: [`Entities/Entity.gd`](https://github.com/invadingoctopus/comedot/blob/develop/Entities/Entity.gd) (Base entity), [`AutoLoad/GameState.gd`](https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/GameState.gd) (Global autoloads), [`Components/Control/InputComponent.gd`](https://github.com/invadingoctopus/comedot/blob/develop/Components/Control/InputComponent.gd) (Control components), [`Templates/Entities/PlayerEntityTemplate-Platformer.tscn`](https://github.com/invadingoctopus/comedot/blob/develop/Templates/Entities/PlayerEntityTemplate-Platformer.tscn) (Entity templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Authoring &amp; Launch"]
  node_project["Godot project<br/>project config<br/>[project.godot]"]
  node_templates["Scene templates<br/>starter scenes"]
  node_game["Consumer game<br/>game content"]
  node_game_frame["Game frame<br/>launch scene<br/>[GameFrame.tscn]"]
  node_plugin["Comedot editor plugin<br/>Godot plugin<br/>[Comedot.gd]"]
end

subgraph group_core["Composition Core"]
  node_entity["Base entity<br/>actor scene/script<br/>[Entity.gd]"]
  node_component["Base component<br/>behavior node<br/>[Component.gd]"]
  node_entity_templates["Entity templates<br/>composed scenes"]
end

subgraph group_services["Global Services"]
  node_autoloads["Global autoloads<br/>cross-scene services<br/>[GameState.gd]"]
  node_scene_manager["Scene manager<br/>autoload<br/>[SceneManager.gd]"]
  node_global_input["Global input<br/>autoload<br/>[GlobalInput.gd]"]
end

subgraph group_gameplay["Gameplay Systems"]
  node_control["Control components<br/>movement intent<br/>[InputComponent.gd]"]
  node_physics["Physics &amp; movement<br/>body movement"]
  node_swapper["Component swapper<br/>runtime composition"]
  node_combat["Combat components<br/>attachable combat<br/>[HealthComponent.gd]"]
  node_abilities["Abilities &amp; upgrades<br/>progression components"]
  node_turn_based["Turn-based mode<br/>mode coordinator"]
end

subgraph group_content["Data &amp; Presentation"]
  node_resources["Gameplay resources<br/>data contracts<br/>[Ability.gd]"]
  node_ui["Gameplay UI<br/>presentation layer<br/>[InventoryList.gd]"]
  node_world_population["World population<br/>spawning<br/>[PopulateArea.gd]"]
  node_assets["Shared assets<br/>project resources"]
end

node_project -->|"launches"| node_game_frame
node_templates -->|"starts"| node_game
node_game -->|"runs within"| node_game_frame
node_plugin -->|"discovers and creates"| node_component
node_entity -->|"composes child"| node_component
node_entity_templates -->|"instantiates"| node_entity
node_entity_templates -->|"attaches"| node_component
node_autoloads -->|"includes"| node_scene_manager
node_autoloads -->|"includes"| node_global_input
node_game_frame -->|"uses"| node_scene_manager
node_control -->|"reads"| node_global_input
node_control -->|"emits movement intent"| node_physics
node_entity -->|"hosts"| node_control
node_entity -->|"hosts"| node_physics
node_swapper -.->|"swaps"| node_control
node_swapper -.->|"swaps"| node_physics
node_entity -->|"hosts"| node_combat
node_entity -->|"hosts"| node_abilities
node_abilities -->|"uses definitions"| node_resources
node_combat -->|"uses stats and payloads"| node_resources
node_ui -->|"binds"| node_resources
node_autoloads -->|"hosts shared behavior"| node_ui
node_turn_based -->|"coordinates actors"| node_entity
node_turn_based -->|"extends"| node_autoloads
node_world_population -->|"spawns"| node_entity_templates
node_world_population -->|"uses"| node_assets
node_game -->|"defines content for"| node_world_population

click node_project "https://github.com/invadingoctopus/comedot/blob/develop/project.godot"
click node_templates "https://github.com/invadingoctopus/comedot/blob/develop/Templates/Scenes/PlatformerSceneTemplate.tscn"
click node_game_frame "https://github.com/invadingoctopus/comedot/blob/develop/Scenes/Launch/GameFrame.tscn"
click node_plugin "https://github.com/invadingoctopus/comedot/blob/develop/addons/Comedot/Comedot.gd"
click node_entity "https://github.com/invadingoctopus/comedot/blob/develop/Entities/Entity.gd"
click node_component "https://github.com/invadingoctopus/comedot/blob/develop/Components/Component.gd"
click node_entity_templates "https://github.com/invadingoctopus/comedot/blob/develop/Templates/Entities/PlayerEntityTemplate-Platformer.tscn"
click node_autoloads "https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/GameState.gd"
click node_scene_manager "https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/SceneManager.gd"
click node_global_input "https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/GlobalInput.gd"
click node_control "https://github.com/invadingoctopus/comedot/blob/develop/Components/Control/InputComponent.gd"
click node_physics "https://github.com/invadingoctopus/comedot/blob/develop/Components/Physics/CharacterBodyComponent.gd"
click node_swapper "https://github.com/invadingoctopus/comedot/blob/develop/Components/Gameplay/ComponentSwapperComponent.gd"
click node_combat "https://github.com/invadingoctopus/comedot/blob/develop/Components/Combat/HealthComponent.gd"
click node_abilities "https://github.com/invadingoctopus/comedot/blob/develop/Components/Gameplay/AbilityComponent.gd"
click node_turn_based "https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/TurnBasedCoordinator.gd"
click node_resources "https://github.com/invadingoctopus/comedot/blob/develop/Resources/Abilities/Ability.gd"
click node_ui "https://github.com/invadingoctopus/comedot/blob/develop/UI/Lists/InventoryList.gd"
click node_world_population "https://github.com/invadingoctopus/comedot/blob/develop/Scenes/Gameplay/PopulateArea.gd"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_project,node_templates,node_game,node_game_frame,node_plugin toneBlue
class node_entity,node_component,node_entity_templates toneAmber
class node_autoloads,node_scene_manager,node_global_input toneMint
class node_control,node_physics,node_swapper,node_combat,node_abilities,node_turn_based toneRose
class node_resources,node_ui,node_world_population,node_assets toneIndigo
```

## Components

### Authoring & Launch

- [Godot project](https://github.com/invadingoctopus/comedot/blob/develop/project.godot): project config · Godot 4.8+ project runtime configuration. · `project.godot`
- [Scene templates](https://github.com/invadingoctopus/comedot/blob/develop/Templates/Scenes/PlatformerSceneTemplate.tscn): starter scenes · Genre starting points copied into a consumer game. · `Templates/Scenes/PlatformerSceneTemplate.tscn`
- **Consumer game**: game content · Game-specific scenes and content are built here.
- [Game frame](https://github.com/invadingoctopus/comedot/blob/develop/Scenes/Launch/GameFrame.tscn): launch scene · `Scenes/Launch/GameFrame.tscn`
- [Comedot editor plugin](https://github.com/invadingoctopus/comedot/blob/develop/addons/Comedot/Comedot.gd): Godot plugin · Provides editor-side component creation and discovery. · `addons/Comedot/Comedot.gd`

### Composition Core

- [Base entity](https://github.com/invadingoctopus/comedot/blob/develop/Entities/Entity.gd): actor scene/script · Base actor abstraction for composed gameplay entities. · `Entities/Entity.gd`
- [Base component](https://github.com/invadingoctopus/comedot/blob/develop/Components/Component.gd): behavior node · Reusable child-node behavior base class. · `Components/Component.gd`
- [Entity templates](https://github.com/invadingoctopus/comedot/blob/develop/Templates/Entities/PlayerEntityTemplate-Platformer.tscn): composed scenes · Ready-made combinations of entities and components. · `Templates/Entities/PlayerEntityTemplate-Platformer.tscn`

### Global Services

- [Global autoloads](https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/GameState.gd): cross-scene services · Input, state, scene, settings, and shared UI boundary. · `AutoLoad/GameState.gd`
- [Scene manager](https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/SceneManager.gd): autoload · Coordinates scene transitions. · `AutoLoad/SceneManager.gd`
- [Global input](https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/GlobalInput.gd): autoload · Centralizes input access. · `AutoLoad/GlobalInput.gd`

### Gameplay Systems

- [Control components](https://github.com/invadingoctopus/comedot/blob/develop/Components/Control/InputComponent.gd): movement intent · Convert player or AI input into movement intent. · `Components/Control/InputComponent.gd`
- [Physics & movement](https://github.com/invadingoctopus/comedot/blob/develop/Components/Physics/CharacterBodyComponent.gd): body movement · Applies intent through bodies, collisions, navigation, or tiles. · `Components/Physics/CharacterBodyComponent.gd`
- [Component swapper](https://github.com/invadingoctopus/comedot/blob/develop/Components/Gameplay/ComponentSwapperComponent.gd): runtime composition · Swaps control or physics implementations at runtime. · `Components/Gameplay/ComponentSwapperComponent.gd`
- [Combat components](https://github.com/invadingoctopus/comedot/blob/develop/Components/Combat/HealthComponent.gd): attachable combat · Health, damage, faction, weapon, and hit response behaviors. · `Components/Combat/HealthComponent.gd`
- [Abilities & upgrades](https://github.com/invadingoctopus/comedot/blob/develop/Components/Gameplay/AbilityComponent.gd): progression components · `Components/Gameplay/AbilityComponent.gd`
- [Turn-based mode](https://github.com/invadingoctopus/comedot/blob/develop/AutoLoad/TurnBasedCoordinator.gd): mode coordinator · Optional global turn coordination with per-entity turn behavior. · `AutoLoad/TurnBasedCoordinator.gd`

### Data & Presentation

- [Gameplay resources](https://github.com/invadingoctopus/comedot/blob/develop/Resources/Abilities/Ability.gd): data contracts · Resource-backed abilities, stats, and payloads. · `Resources/Abilities/Ability.gd`
- [Gameplay UI](https://github.com/invadingoctopus/comedot/blob/develop/UI/Lists/InventoryList.gd): presentation layer · Binds gameplay data to HUD, inventory, ability, and stat controls. · `UI/Lists/InventoryList.gd`
- [World population](https://github.com/invadingoctopus/comedot/blob/develop/Scenes/Gameplay/PopulateArea.gd): spawning · Populates areas and spawns gameplay content. · `Scenes/Gameplay/PopulateArea.gd`
- **Shared assets**: project resources · Prototype assets, tilesets, themes, and shaders.

## Connections

- Godot project → Game frame: launches
- Scene templates → Consumer game: starts
- Consumer game → Game frame: runs within
- Comedot editor plugin → Base component: discovers and creates
- Base entity → Base component: composes child
- Entity templates → Base entity: instantiates
- Entity templates → Base component: attaches
- Global autoloads → Scene manager: includes
- Global autoloads → Global input: includes
- Game frame → Scene manager: uses
- Control components → Global input: reads
- Control components → Physics & movement: emits movement intent
- Base entity → Control components: hosts
- Base entity → Physics & movement: hosts
- Component swapper → Control components: swaps
- Component swapper → Physics & movement: swaps
- Base entity → Combat components: hosts
- Base entity → Abilities & upgrades: hosts
- Abilities & upgrades → Gameplay resources: uses definitions
- Combat components → Gameplay resources: uses stats and payloads
- Gameplay UI → Gameplay resources: binds
- Global autoloads → Gameplay UI: hosts shared behavior
- Turn-based mode → Base entity: coordinates actors
- Turn-based mode → Global autoloads: extends
- World population → Entity templates: spawns
- World population → Shared assets: uses
- Consumer game → World population: defines content for
