Code
This is a simple implementation of the classic Asteroids game using an Entity-Component-System (ECS) pattern in Godot. The code is tightly focused on game logic and explores how ECS can help structure gameplay mechanics in a clean and scalable way.
✅ Roadmap & Refactoring Ideas
🔧 Entity Lifecycle
Clarify how entities are created, updated, and destroyed:
- Entities are added to the canvas as logical units, while their geometry (e.g. polygon) is added separately for rendering.
- Different zones:
OutOfScreenOutOfStageOnStage
Update strategies:
- Geometry & rendering logic
- Collision data (only updated when geometry changes)
🧼 Removing Entities
- Implement a system to remove entities from the canvas based on tags.
🧠 ECS Refinement
- Consider allowing entities to be added to a different parent node (not just
Canvas). - Add a logger system per entity for debugging.
🗺️ Level Design (Map System)
- Levels could be packaged and selected via the editor.
- Each level may contain:
- Predefined entities
- Spawning logic
- Stage bounds
🛠️ ECS <-> Editor Interaction
Tools to help while working in the Godot Editor:
- Show render geometry and position in the editor.
- Auto-update ECS entity position when moved manually.
🧩 Composite Components
Explore a structure where:
- An entity can have a
ParentGeometrycomponent. - A
FollowTobehavior lets entities follow others (e.g. bullets or VFX).
Additional ideas:
- Event system?
- Action system?
🎮 Gameplay Features
| Feature | Status |
|---|---|
| Create/Move/Destroy Asteroids | ✅ |
| Input handling for Ship | ✅ |
| Bullets, Collision, Lifetime | ✅ |
| Ship Life & Destruction | ⬜ |
| UI: Score, Life, Menu | ⬜ |
| VFX | ⬜ |
| Acceleration, Rotation | ⬜ |
This post is a living log of the current progress and future ideas. Feedback or suggestions are welcome via GitHub issues or PRs.