Getting Started Setup (v5.0.0)
This guide covers the essential node setup for v5.0.0.
Note: 5.0 is the stable line. If you are starting a new project, you may also consider:
v5-1(Upcoming feature release)v6-0(C# Edition - Complete architectural redesign)
v5.0.0 (GDScript)
- Canonical name (5.0): / GB
- Canonical addon path (Godot):
Template Locations (v5.0.0)
All templates are located in /templates/:
Core System Templates
- Systems:
templates/systems/gb_systems.tscn- Complete systems stackgb_systems_isometric.tscn- Isometric-specific systems
Grid Positioner Templates
- Grid Positioners:
templates/grid_positioner/grid_positioner_stack.tscn- Standard top-down gridgrid_positioner_stack_isometric.tscn- Isometric gridcomponents/- Individual grid components
UI Templates
- User Interface:
templates/ui/action_bar.tscn- Main action buttonsaction_log/action_log.tscn- Action feedback displayplacement_selection/placeable_selection_ui.tscn- Building selectortarget_informer.tscn- Target information display
Indicator Templates
- Visual Indicators:
templates/indicator/- Various rule check indicators for different grid types
- Collision shapes and visual feedback elements
Quick Start Setup
Follow these numbered steps for a minimal v5.0.0 setup:
Add Addon
- Ensure
grid_buildingaddon is enabled in Project Settings
- Ensure
Create Core Systems
- Add a
Systemsnode to your scene root - Add
InjectorSystemas child withgb_injector_system.gdscript - Add
BuildingSystemas child withbuilding_system.gdscript - Add
GridTargetingSystemas child withgrid_targeting_system.gdscript
- Add a
Add Grid Positioner
- Add
GridPositionernode to your world - Instance appropriate template:
- Top-down:
grid_positioner_stack.tscn - Isometric:
grid_positioner_stack_isometric.tscn
- Top-down:
- See Grid Positioner Setup for detailed configuration
- Add
Set Up Level Context (CRITICAL)
- Add
LevelContextnode to your level scene - Wire
target_mapto your TileMapLayer - Set
objects_parentto where buildings should spawn - ⚠️ ESSENTIAL: Systems will NOT run without properly configured LevelContext
- See Level Context Integration for detailed setup
- Add
Add Owner Context
- Add
Ownernode to your camera or player - Set
owner_rootto point to your world node
- Add
Create Basic UI
- Add
UI→HUDhierarchy - Instance
placeable_selection_ui.tscnfor building selection - Add
action_bar.tscnfor main controls - See UI Templates and Setup for detailed UI configuration
- Add
Configure Composition Container
- Create a
GBCompositionContainerresource using the Inspector - Assign it to your
InjectorSystemvia the Inspector - Manually create and assign each sub-resource (no automatic assignment)
- Save each resource immediately to prevent data loss
- Configure build rules and settings using the Inspector (not script preloading)
- See Composition Container Configuration for detailed setup
- Critical: Manual assignment required for all sub-resources, save frequently
- Create a
Set Up Input Actions
- Add
build_confirmandbuild_cancelactions in Input Map - Configure key bindings for building controls
- Add
GBCompositionContainer Configuration
The GBCompositionContainer is the central configuration hub that organizes all sub-resources for the system. Each sub-resource controls a specific aspect of the building system.
For comprehensive configuration details, see Composition Container Configuration.
Container Structure
GBCompositionContainer (Resource)
├── config: GBConfig
│ ├── settings: GBSettings
│ │ ├── building: BuildingSettings
│ │ ├── manipulation: ManipulationSettings
│ │ ├── targeting: GridTargetingSettings
│ │ ├── visual: GBVisualSettings
│ │ ├── action_log: ActionLogSettings
│ │ ├── placement_rules: Array[PlacementRule]
│ │ ├── runtime_checks: GBRuntimeChecks
│ │ └── debug: GBDebugSettings
│ ├── templates: GBTemplates
│ └── actions: GBActions
Individual Sub-Resources
1. GBSettings (Main Settings Container)
- building: Core building/placement parameters
- Grid size, placement validation, building rules
- Cost requirements, resource management
- manipulation: Object movement and editing settings
- Drag sensitivity, snap settings, manipulation modes
- targeting: Grid targeting and selection behavior
- Target range, selection shape, collision layers
- visual: UI and visual feedback settings
- Cursor styles, highlight colors, target information display
- action_log: Logging system configuration
- Message filtering, log duration, display settings
- placement_rules: Array of placement validation rules
- Custom rules for where objects can be placed
- runtime_checks: System validation flags
- Debug checks, performance monitoring
- debug: Debugging and development settings
- Log levels, debug overlays, testing flags
2. GBTemplates (System Templates)
- System templates: Pre-configured system stacks
- UI templates: User interface component templates
- Indicator templates: Visual feedback elements
- Grid positioner templates: Different grid configurations
3. GBActions (Input Configuration)
- Action mappings: Input action definitions
- Key bindings: Default keyboard/mouse mappings
- Gesture settings: Touch and gesture controls
Configuration Process
Create Base Resources
Create GBCompositionContainer resource ├── Create GBConfig resource ├── Create GBSettings resource ├── Create individual setting resources └── Create GBTemplates and GBActions resourcesAssign Settings
- Wire each individual settings resource to its parent
- Example:
building_settings.tres→GBSettings.building - All settings are shared resources - changes propagate automatically
Configure Rules
- Add
PlacementRuleresources toGBSettings.placement_rules - Rules validate placement conditions (terrain, cost, etc.)
- Add
Set Up Templates
- Assign template scenes to
GBTemplates - Templates define UI components and system prefabs
- Assign template scenes to
Configure Actions
- Define input actions in
GBActions - Map to Godot Input Map actions
- Define input actions in
Resource Assignment Example
| |
Shared Resource Behavior
- All settings resources are shared Godot Resources
- Changes to any setting resource immediately affect all systems
- No need to restart or reload - changes propagate live
- Enable
resource_local_to_scene = truefor scene-specific instances
Validation
The composition container automatically validates:
- All required sub-resources are present
- Settings are properly configured
- Templates and actions are valid
- Runtime dependencies are satisfied
Use composition_container.get_runtime_issues() to check configuration status.
Required Core Systems
Create a Systems node in your scene root with the following child nodes:
1. InjectorSystem
- Type: Node
- Script:
/systems/injection/gb_injector_system.gd - Purpose: Dependency injection and composition container setup
- Properties: Set
composition_containerto your composition resource
2. BuildingSystem
- Type: Node
- Script:
/systems/building/building_system.gd - Purpose: Core building and placement logic
- Children:
- DragManager (Node) -
/systems/building/managers/drag_manager.gd
- DragManager (Node) -
3. GridTargetingSystem
- Type: Node
- Script:
/systems/grid_targeting/grid_targeting_system.gd - Purpose: Grid targeting and selection logic
- Note: This node is no longer needed starting in v5.1 and can be removed in newer versions
4. ManipulationSystem
- Type: Node with manipulation components
- Purpose: Object manipulation and editing
- Children:
- TargetHighlighter - Visual feedback for targets
- ModeCursors - Cursor management for different modes
- Setup: Create a Node with manipulation script and add highlighter/cursor children
5. SaveLoadSystem (Optional)
- Type: Node
- Purpose: Save/load functionality
- Setup: Create your own save/load system or integrate with existing game state management
- Integration: Connect to world state and player state resources as needed
6. AudioSystem (Optional)
- Type: Node
- Purpose: Audio system for building actions
- Setup: Create your own audio system or integrate with existing game audio
World Setup
Create a World node (typically Node2D) with:
1. GridPositioner
- Type: Instance of appropriate grid positioner template
- Isometric:
/templates/grid_positioner/grid_positioner_stack_isometric.tscn - Top-down:
/templates/grid_positioner/grid_positioner_stack.tscn
- Isometric:
- Purpose: Grid positioning and coordinate system
- Core Hierarchy:
GridPositioner2D (Node2D) - Main positioning controller ├── TargetingShapeCast2D (ShapeCast2D) │ ├── Shape: RectangleShape2D or custom indicator shape │ ├── Script: `targeting_shape_cast_2d.gd` │ └── Collision mask: 2048 (for grid detection) └── ManipulationParent (Node2D) ├── Script: `manipulation_parent.gd` └── IndicatorManager (Node2D) └── Script: `indicator_manager.gd` - GridTargetingSystem: Separate node in Systems hierarchy (not part of GridPositioner stack)
- For detailed setup and configuration, see Grid Positioner Setup.
2. LevelContext (Required for TileMap integration)
- Type: Node
- Script:
/shared/components/context/gb_level_context.gd - Purpose: Provides level-specific context for TileMapLayers and object placement
- Properties:
- target_map: Primary TileMapLayer for grid targeting
- maps: Array of all TileMapLayers in the level
- objects_parent: Node2D where placed objects are parented
- Setup: Add to your level scene and wire to your TileMapLayers
- Example:
YourLevel (Node2D) ├── Ground (TileMapLayer) ← target_map and maps[0] ├── Objects (Node2D) ← objects_parent (add "placed_parent" group) └── LevelContext (Node) ├── target_map: NodePath("../Ground") ├── maps: [NodePath("../Ground")] └── objects_parent: NodePath("../Objects") - For detailed integration examples, see Level Context Integration.
3. Owner (Required for camera systems)
- Type: Node
- Script:
/core/contexts/gb_owner.gd - Parent: Usually child of camera controller
- Properties: Set
owner_rootto point to the World node
UI Setup
Create a UI → HUD hierarchy with these components:
Essential UI Elements
- PlaceableSelectionUI: Building selection interface
- ControlsTileInfoTabs: Grid information and controls
- ActionLog: Action logging and feedback
- ActionBar: Main action buttons
Optional UI Elements
- TargetInformer: Target information display
- SaveLoadContainer: Save/load interface
- CameraZoomSlider: Camera zoom controls
- RuntimeAnalyzer: Debug and analysis tool
Setup Order
- Create Systems node with all system components
- Create World node with GridPositioner
- Add Owner to camera hierarchy
- Create UI/HUD with essential interface elements
- Configure composition container in InjectorSystem
- Set up state resources (world_state, player_state) for save/load functionality
Configuration Resources
You’ll need to create these resource files:
- Composition container resource (defines system dependencies)
- World state resource (persistent world data)
- Player state resource (player-specific data)
- Save settings resource (save/load configuration)
Version-Specific Notes
v5.0 Requirements
- GridTargetingSystem is required for proper targeting functionality
- All systems must be properly configured in the composition container
- State resources are required for save/load functionality
v5.1+ Changes
- GridTargetingSystem is no longer needed - targeting functionality was integrated into other systems
- Simplified setup process with fewer required nodes
- Improved dependency injection reduces manual configuration
Common Setup Patterns
Isometric Games
- Use
grid_positioner_stack_isometric.tscn - Configure camera controller for isometric view
- Set up appropriate tile mapping for isometric grids
Platformer Games
- Use
grid_positioner_stack.tscn - Configure grid to match platformer tile size
- Integrate with character movement systems
Top-Down Games
- Use standard grid positioner
- Configure camera for overhead view
- Set up UI for grid-based controls