Instruction file imported from pyrovoice/CardGame (
.github/instructions/gdscript.instructions.md). Copyright stays with the author.
GDScript Architecture Guidelines
Workspace & Context Context
- When working on game mechanics, always refer to the
GameandSharedfolders (Game/scripts/,Game/scenes/,Shared/scripts/). - Engine configurations and project-wide autoloads reside in
project.godot.
GDScript & Godot 4 Conventions
- Explicit Typing: Use static typing everywhere possible (
var card: CardData,func execute(action: GameAction) -> void:). - Naming Conventions:
class_namein PascalCase (e.g.CardLoader,BaseTestManager).- Functions and variables in
snake_caseor project-consistent camelCase where established (e.g., maintain local file consistency). - Enums in PascalCase or SCREAMING_SNAKE_CASE as defined in core types (e.g.
EffectType.Type).
- Memory & Node Lifecycle:
- Distinguish between
RefCountedobjects (e.g.EffectType,CardData) andNode/Node3D/Controlinstances (queue_free()when removing nodes). - Avoid creating dangling signals; disconnect or ensure node cleanup on destruction.
- Distinguish between
- Queue and State Operations:
- Game actions should route through the proper queue resolution mechanisms (
ResolvableQueue.gd,AbilityManager.gd). - Do not modify state directly across layers if a manager or queue event handles it.
- Game actions should route through the proper queue resolution mechanisms (