How GameDemo works: Architecture Overview
mainGameDemo follows an opinionated architecture designed for testability and modularity using several Chickensoft packages:
- State Management: Uses
LogicBlocksto separate state from presentation via hierarchical state machines. This ensures the view is always synchronized with the state and allows for easy testing of logic in isolation. - Dependency Injection: Uses
AutoInjectfor tree-based dependency provisioning. It resolves dependencies by looking up the node tree, mirroring Godot's node structure. It also supports Enhanced Lifecycles (two-phase initialization) to separate value creation from consumption. - Testing: Uses
GoDotTestfor local and CI/CD testing. It leveragesGodotNodeInterfacesto provide interfaces for Godot objects, allowing for easy mocking and the use of fake scene trees during unit tests. - Data & Persistence: Implements saving and loading via
Serialization,Serialization.Godot, andSaveFileBuilder. - Node Extensions: Uses
Introspection(C# source generation) to add mixin-like functionality to node scripts at build time.