InvadingOctopus / comedot

Component-based framework and project template for 2D Godot games

Home Page:https://godotengine.org/asset-library/asset/3163

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comedot

Component-based framework and project template for Godot

Godot+Comedot Logo

The goal is to have an all-in-one toolkit for 2D games (platformers, shoot-em-ups, RPGs, turn-based strategy or puzzle) where you build scenes by adding components to entities like Lego blocks and tweaking their parameters in the UI. "Entities" are just regular nodes and "components" are also nodes that modify other nodes, so you can mix this framework with any other architecture or programming paradigm, even for 2D scenes in a 3D game!

Important

This is still mostly a private personal project; it's what I'm using to make my own epic games while learning Godot and GDScript as I go. The API may change frequently and no backwards compatibility is guaranteed!

🌳 An example of a player entity's node tree:

components-tree

⭐️ It lets you do neat tricks like put a GunComponent and MouseRotationComponent on any object and It Just Works:

RocksWithGuns.mp4

⭐️ The composition architecture lets you easily change abilities/buffs/debuffs at runtime; just add/remove components in simple event handlers, like this example of swapping between platformer physics and flying/"overhead" movement:

Platformer+Overheader.mp4

πŸ“ˆ There's even sexy charts for debugging variables in real-time!

debug-charts

(if the videos don't display, view on imgur): 1, 2

How To Use

Warning

Requires Godot 4.4 ~Embrace the Future ✨
The first time you load this project, there may be errors because Godot will re-import the asset files and set the internal IDs for textures etc. To fix: Just close and reopen the project.

πŸš€ For a quick glance: See the /Templates/Scenes/ folder.

βš™οΈ To use this framework for your own games:

  1. Clone this repository; make a local copy of this entire Godot project and rename it for your game.
  2. Drag-&-drop nodes from the /Entities/ and /Components/ folders to build your scenes.
    • The /Templates/ folder contains example scenes and Entities with preset groups of Components to use as a quick starting point for various types of gameplay.
    • The /Scripts/ folder contains code for simple non-Entity nodes.
    • The /UI/ folder contains common UI elements such as a stats HUD, special action buttons, lists for choosing upgrades etc.

Custom Dock Plugin

Note

🧩 A "component" is any Godot node that:

  • Reacts to events (like player input or collisions).
  • Moves or modifies its parent node or other components.
  • Contains data for other components to use (like character health and other stats).

πŸͺ† An "entity" is a node whose children are components (it may also have non-component children).

🎳 Whenever your game needs an "actor" like the player character or a monster, or an object with "behaviors" that could be reused for other objects, like interactive items or collectible powerups:

Use the included custom dock plugin (the Comedock :) or perform these steps manually:

  1. Create a new Entity node: a Node2D/Sprite2D/CharacterBody2D etc. with the Entity.gd script attached.
  2. Add Component child nodes to the entity. A component is also a Node/Area2D etc. with a script that extends the Component.gd class.
  3. Modify component parameters in the Godot Editor's Inspector.
  4. Save the entity + components tree as a standalone scene file to organize it separately from the main "world" scene and quickly create copies of it anywhere.

Tip

πŸ“œ Read HowTo.md to see how to do common tasks like player movement and combat or adding entirely new functionality.

πŸ’¬ For more deets, ping Syntaks.io on Discord.


Comedot Β©? MMXXIV ShinryakuTako@GitHub β€’ Syntaks.io@Discord

🀍 THANKS: