Interactive Documentation & Developer Onboarding
Core principles and philosophy driving this project
Building a robust, maintainable 3D action-adventure game in Godot 4.5 following industry best practices. This project emphasizes clean architecture, composition over inheritance, and systems that are easy to understand and extend.
Objects reference other objects instead of extending them. Components are attached, not inherited.
Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion.
Code reusability through composition and shared systems. One source of truth for each concern.
If it can't be explained easily, it's bad code. Simplicity enables maintenance and collaboration.
How components compose to create the game
BaseCharacter doesn't do movement itself - it composes MovementHandler, InputHandler, and HealthInterface as child nodes. Each component handles one responsibility.
extends CharacterBody3D
class_name BaseCharacter
# Child node references (Composition)
@onready var movement_handler: MovementHandler = $MovementHandler
@onready var input_handler: InputHandler = $InputHandler
@onready var health_interface: HealthInterface = $HealthInterface
# Connect components together
func setup_child_node_connections():
input_handler.movement_input_changed.connect(
movement_handler.set_movement_input)
input_handler.jump_requested.connect(
movement_handler.handle_jump)
Detailed breakdown of major game systems
Manual camera with autocorrection, first-person mode, and smooth following
Modular character architecture with composition-based components
Formation-based following with catch-up mechanics and AI control
Contextual interactions like Zelda - Read, Talk, Pick Up, etc.
CharacterManager, EventBus, ManagerRegistry for coordination
Z-targeting for lock-on combat mechanics
How systems communicate through loose coupling
Complete script breakdowns with detailed explanations
Character coordinator using composition pattern
Pure movement logic with camera-relative controls
Manual camera with subtle autocorrection
Character registration and switching system
Getting up to speed with the project
# Parent gets reference to child component
@onready var movement: MovementHandler = $MovementHandler
# Parent configures child
func _ready():
movement.set_camera_interface(camera)
# Always check before using
if not camera or not is_instance_valid(camera):
push_warning("Invalid camera reference")
return
if not camera.has_method("get_camera_forward"):
push_warning("Camera missing required methods")
return
print() and push_warning() liberally for debugging