How invadingoctopus/comedot works
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: Entity.gd Base entity · GameState.gd Global autoloads · InputComponent.gd Control components · PlayerEntityTemplate-Platformer.tscn Entity templates
Components 21
Authoring & Launch
- Godot project · Godot 4.8+ project runtime configuration.
project.godot - Scene templates · Genre starting points copied into a consumer game.
Templates/Scenes/PlatformerSceneTemplate.tscn - Consumer game · Game-specific scenes and content are built here.
- Game frame
Scenes/Launch/GameFrame.tscn - Comedot editor plugin · Provides editor-side component creation and discovery.
addons/Comedot/Comedot.gd
Composition Core
- Base entity · Base actor abstraction for composed gameplay entities.
Entities/Entity.gd - Base component · Reusable child-node behavior base class.
Components/Component.gd - Entity templates · Ready-made combinations of entities and components.
Templates/Entities/PlayerEntityTemplate-Platformer.tscn
Global Services
- Global autoloads · Input, state, scene, settings, and shared UI boundary.
AutoLoad/GameState.gd - Scene manager · Coordinates scene transitions.
AutoLoad/SceneManager.gd - Global input · Centralizes input access.
AutoLoad/GlobalInput.gd
Gameplay Systems
- Control components · Convert player or AI input into movement intent.
Components/Control/InputComponent.gd - Physics & movement · Applies intent through bodies, collisions, navigation, or tiles.
Components/Physics/CharacterBodyComponent.gd - Component swapper · Swaps control or physics implementations at runtime.
Components/Gameplay/ComponentSwapperComponent.gd - Combat components · Health, damage, faction, weapon, and hit response behaviors.
Components/Combat/HealthComponent.gd - Abilities & upgrades
Components/Gameplay/AbilityComponent.gd - Turn-based mode · Optional global turn coordination with per-entity turn behavior.
AutoLoad/TurnBasedCoordinator.gd
Data & Presentation
- Gameplay resources · Resource-backed abilities, stats, and payloads.
Resources/Abilities/Ability.gd - Gameplay UI · Binds gameplay data to HUD, inventory, ability, and stat controls.
UI/Lists/InventoryList.gd - World population · Populates areas and spawns gameplay content.
Scenes/Gameplay/PopulateArea.gd - Shared assets · Prototype assets, tilesets, themes, and shaders.
Connections 27
- 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