Component-based framework and project template for Godot
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:
βοΈ 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!
(if the videos don't display, view on imgur): 1, 2
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:
- Clone this repository; make a local copy of this entire Godot project and rename it for your game.
- 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.
- The
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:
- Create a new Entity node: a
Node2D/Sprite2D/CharacterBody2D
etc. with theEntity.gd
script attached. - Add Component child nodes to the entity. A component is also a
Node/Area2D
etc. with a script thatextends
theComponent.gd
class. - Modify component parameters in the Godot Editor's Inspector.
- 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:
- Tilesets: https://kenney.nl/assets/1-bit-pack
- Font: Jayvee Enaguas (HarvettFox96) https://www.dafont.com/pixel-operator.font