match-3 grid generation
make game scene modular global debug mode
This commit is contained in:
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
## Project Overview
|
||||
|
||||
"Skelly" is a Godot 4.4 mobile game project featuring a match-3 puzzle game within a broader game framework. The project includes a menu system, settings management, audio handling, localization support, and a comprehensive debug system.
|
||||
"Skelly" is a Godot 4.4 mobile game project featuring multiple gameplay modes within a unified game framework. The project currently supports match-3 puzzle gameplay with planned support for clickomania gameplay. It includes a modular gameplay system, menu system, settings management, audio handling, localization support, and a comprehensive debug system.
|
||||
|
||||
**For detailed project architecture, see `docs/MAP.md`**
|
||||
|
||||
@@ -17,9 +17,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Debug UI: Press F12 in-game or use debug button to toggle debug panels
|
||||
|
||||
### Testing & Development
|
||||
- Debug mode can be toggled with F12 key or debug button UI
|
||||
- Debug mode can be toggled with F12 key or debug button UI (available on all major scenes)
|
||||
- Match-3 debug controls include gem count adjustment and board reroll
|
||||
- Difficulty presets: Easy (3 gems), Normal (5 gems), Hard (8 gems)
|
||||
- Gameplay mode switching: Space+Enter in game scene switches between match-3 and clickomania modes
|
||||
|
||||
### Audio Configuration
|
||||
- Music: Located in `assets/audio/music/` directory with loop configuration in AudioManager
|
||||
@@ -37,6 +38,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- **ALWAYS** use `GameManager` for scene transitions - never call `get_tree().change_scene_to_file()` directly
|
||||
- Scene paths are defined as constants in GameManager
|
||||
- Error handling is built into GameManager for failed scene loads
|
||||
- Use `GameManager.start_game_with_mode(mode)` to launch specific gameplay modes
|
||||
- Supported gameplay modes: "match3", "clickomania"
|
||||
|
||||
### Autoload Usage
|
||||
- Use autoloads for global state management only
|
||||
@@ -56,9 +59,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- **This file** - Claude Code specific development guidelines
|
||||
|
||||
### Key Scripts to Understand
|
||||
- `src/autoloads/GameManager.gd` - Scene transition patterns
|
||||
- `src/autoloads/GameManager.gd` - Scene transition patterns and gameplay mode management
|
||||
- `src/autoloads/DebugManager.gd` - Debug system integration
|
||||
- `scenes/match3/match3.gd` - Match-3 implementation reference
|
||||
- `scenes/game/game.gd` - Main game scene with modular gameplay system
|
||||
- `scenes/game/gameplays/match3_gameplay.gd` - Match-3 implementation reference
|
||||
- `scenes/game/gameplays/` - Individual gameplay mode implementations
|
||||
- `project.godot` - Input actions and autoload definitions
|
||||
|
||||
## Development Workflow
|
||||
@@ -75,8 +80,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
- Check mobile compatibility if UI changes made
|
||||
|
||||
### Common Implementation Patterns
|
||||
- Scene transitions: Use `GameManager.change_to_scene()` methods
|
||||
- Debug integration: Connect to `DebugManager` signals
|
||||
- Scene transitions: Use `GameManager.start_game_with_mode()` and related methods
|
||||
- Debug integration: Connect to `DebugManager` signals and initialize debug state
|
||||
- Gameplay modes: Implement in `scenes/game/gameplays/` directory following modular pattern
|
||||
- Scoring system: Connect `score_changed` signal from gameplay to main game scene
|
||||
- Settings: Use `SettingsManager` for persistent configuration
|
||||
- Audio: Use `AudioManager` for music and sound effects
|
||||
- Localization: Use `LocalizationManager` for language switching
|
||||
@@ -100,7 +100,7 @@ func _get_match_line(start: Vector2i, dir: Vector2i) -> Array:
|
||||
GameManager.start_match3_game()
|
||||
|
||||
# ❌ Wrong
|
||||
get_tree().change_scene_to_file("res://scenes/match3/match3.tscn")
|
||||
GameManager.start_match3_game() # Use GameManager instead of direct scene loading
|
||||
```
|
||||
|
||||
### Autoload Usage
|
||||
@@ -227,7 +227,7 @@ wip
|
||||
get_tree().change_scene_to_file("some_scene.tscn")
|
||||
|
||||
# ❌ Don't hardcode paths
|
||||
var tile = load("res://scenes/match3/tile.tscn")
|
||||
var tile = load("res://scenes/game/gameplays/tile.tscn")
|
||||
|
||||
# ❌ Don't ignore null checks
|
||||
var node = get_node("SomeNode")
|
||||
|
||||
94
docs/MAP.md
94
docs/MAP.md
@@ -1,7 +1,7 @@
|
||||
# Skelly - Project Structure Map
|
||||
|
||||
## Overview
|
||||
Skelly is a Godot 4.4 game project featuring a match-3 puzzle game with skeleton character themes. The project follows a modular architecture with clear separation between scenes, autoloads, assets, and data.
|
||||
Skelly is a Godot 4.4 game project featuring multiple gameplay modes with skeleton character themes. The project supports match-3 puzzle gameplay with planned clickomania gameplay through a modular gameplay architecture. It follows a modular structure with clear separation between scenes, autoloads, assets, and data.
|
||||
|
||||
## Project Root Structure
|
||||
|
||||
@@ -36,10 +36,11 @@ Located in `src/autoloads/`, these scripts are automatically loaded when the gam
|
||||
- Uses: `data/default_bus_layout.tres`
|
||||
|
||||
3. **GameManager** (`src/autoloads/GameManager.gd`)
|
||||
- Central game state management
|
||||
- Scene transitions between main/game/match3
|
||||
- Central game state management and gameplay mode coordination
|
||||
- Scene transitions between main/game scenes
|
||||
- Gameplay mode selection and launching (match3, clickomania)
|
||||
- Navigation flow control
|
||||
- References: main.tscn, game.tscn, match3.tscn
|
||||
- References: main.tscn, game.tscn and individual gameplay scenes
|
||||
|
||||
4. **LocalizationManager** (`src/autoloads/LocalizationManager.gd`)
|
||||
- Language switching functionality
|
||||
@@ -60,6 +61,12 @@ main.tscn (Entry Point)
|
||||
├── PressAnyKeyScreen.tscn
|
||||
├── MainMenu.tscn
|
||||
└── SettingsMenu.tscn
|
||||
|
||||
game.tscn (Gameplay Container)
|
||||
├── GameplayContainer (Dynamic content)
|
||||
├── UI/ScoreDisplay
|
||||
├── BackButton
|
||||
└── DebugToggle
|
||||
```
|
||||
|
||||
### Game Flow
|
||||
@@ -86,48 +93,61 @@ main.tscn (Entry Point)
|
||||
- Connected to SettingsManager and AudioManager
|
||||
|
||||
5. **Game Scene** (`scenes/game/game.tscn` + `game.gd`)
|
||||
- Main gameplay container
|
||||
- Loads match-3 instance
|
||||
- Back button for navigation
|
||||
- Bridge between UI and game logic
|
||||
|
||||
6. **Match-3 Game** (`scenes/match3/match3.tscn` + `match3.gd`)
|
||||
- Core puzzle game implementation
|
||||
- Grid-based tile system
|
||||
- Debug UI integration
|
||||
- Gem management system
|
||||
- Main gameplay container with modular gameplay system
|
||||
- Dynamic loading of gameplay modes into GameplayContainer
|
||||
- Global score management and display
|
||||
- Back button for navigation to main menu
|
||||
- Gameplay mode switching support (Space+Enter debug key)
|
||||
- Bridge between UI and individual gameplay implementations
|
||||
|
||||
### UI Components
|
||||
```
|
||||
scenes/ui/
|
||||
├── DebugButton.tscn + DebugButton.gd
|
||||
├── DebugToggle.tscn + DebugToggle.gd # Now available on all major scenes
|
||||
├── DebugMenu.tscn + DebugMenu.gd # Match-3 debug controls
|
||||
├── MainMenu.tscn + MainMenu.gd
|
||||
└── SettingsMenu.tscn + SettingsMenu.gd
|
||||
```
|
||||
|
||||
## Match-3 Game System
|
||||
## Modular Gameplay System
|
||||
|
||||
### Core Components
|
||||
1. **Match3 Controller** (`scenes/match3/match3.gd`)
|
||||
The game now uses a modular gameplay architecture where different game modes can be dynamically loaded into the main game scene.
|
||||
|
||||
### Gameplay Architecture
|
||||
- **Main Game Scene** (`scenes/game/game.gd`) - Container and coordinator
|
||||
- **Gameplay Directory** (`scenes/game/gameplays/`) - Individual gameplay implementations
|
||||
- **Dynamic Loading** - Gameplay scenes loaded at runtime based on mode selection
|
||||
- **Signal-based Communication** - Gameplays communicate with main scene via signals
|
||||
|
||||
### Current Gameplay Modes
|
||||
|
||||
#### Match-3 Mode (`scenes/game/gameplays/match3_gameplay.tscn`)
|
||||
1. **Match3 Controller** (`scenes/game/gameplays/match3_gameplay.gd`)
|
||||
- Grid management (8x8 default)
|
||||
- Match detection algorithms
|
||||
- Tile dropping and refilling
|
||||
- Gem pool management (3-8 gem types)
|
||||
- Debug UI integration
|
||||
- Score reporting via `score_changed` signal
|
||||
|
||||
2. **Tile System** (`scenes/match3/tile.gd` + `Tile.tscn`)
|
||||
2. **Tile System** (`scenes/game/gameplays/tile.gd` + `Tile.tscn`)
|
||||
- Individual tile behavior
|
||||
- Gem type management
|
||||
- Visual representation
|
||||
- Group membership for coordination
|
||||
|
||||
#### Clickomania Mode (`scenes/game/gameplays/clickomania_gameplay.tscn`)
|
||||
- Planned implementation for clickomania-style gameplay
|
||||
- Will integrate with same scoring and UI systems as match-3
|
||||
|
||||
### Debug System
|
||||
- Global debug state via DebugManager
|
||||
- Match-3 specific debug UI panel
|
||||
- Gem count controls (+/- buttons)
|
||||
- Difficulty presets (Easy: 3 gems, Normal: 5 gems, Hard: 8 gems)
|
||||
- Reroll functionality
|
||||
- F12 toggle support
|
||||
- Global debug state via DebugManager with proper initialization
|
||||
- Debug toggle available on all major scenes (MainMenu, SettingsMenu, PressAnyKeyScreen, Game)
|
||||
- Match-3 specific debug UI panel with gem count controls and difficulty presets
|
||||
- Gem count controls (+/- buttons) with difficulty presets (Easy: 3, Normal: 5, Hard: 8)
|
||||
- Board reroll functionality for testing
|
||||
- F12 toggle support across all scenes
|
||||
- Debug prints reduced in production code
|
||||
|
||||
## Asset Organization
|
||||
|
||||
@@ -174,14 +194,18 @@ assets/
|
||||
PressAnyKeyScreen --[any_key_pressed]--> Main
|
||||
MainMenu --[open_settings]--> Main
|
||||
SettingsMenu --[back_to_main_menu]--> Main
|
||||
DebugManager --[debug_toggled, debug_ui_toggled]--> Match3
|
||||
DebugManager --[debug_toggled]--> All scenes with DebugToggle
|
||||
GameplayModes --[score_changed]--> Game Scene
|
||||
Game Scene --[score updates]--> UI/ScoreDisplay
|
||||
```
|
||||
|
||||
### Scene References
|
||||
```
|
||||
GameManager --> main.tscn, game.tscn, match3.tscn
|
||||
GameManager --> main.tscn, game.tscn
|
||||
GameManager --> scenes/game/gameplays/*.tscn (via GAMEPLAY_SCENES constant)
|
||||
Main --> MainMenu.tscn, SettingsMenu.tscn
|
||||
Game --> match3.tscn (instantiated)
|
||||
Game --> GameplayContainer (dynamic loading of gameplay scenes)
|
||||
Game --> scenes/game/gameplays/match3_gameplay.tscn, clickomania_gameplay.tscn
|
||||
```
|
||||
|
||||
### Asset Dependencies
|
||||
@@ -194,16 +218,20 @@ AudioManager --> data/default_bus_layout.tres
|
||||
## Development Notes
|
||||
|
||||
### Current Implementation Status
|
||||
- Modular gameplay system with dynamic loading architecture
|
||||
- Match-3 system with 8x8 grid and configurable gem pools
|
||||
- Debug UI system with F12 toggle functionality
|
||||
- Scene transition system via GameManager
|
||||
- Global scoring system integrated across gameplay modes
|
||||
- Debug UI system with F12 toggle functionality across all major scenes
|
||||
- Scene transition system via GameManager with gameplay mode support
|
||||
- Internationalization support for English/Russian
|
||||
|
||||
### Architecture Patterns
|
||||
1. **Autoload Pattern** - Global managers as singletons
|
||||
2. **Signal-Based Communication** - Loose coupling between components
|
||||
3. **Scene Composition** - Modular scene loading and management
|
||||
4. **Data-Driven Configuration** - JSON for settings and translations
|
||||
5. **Component Architecture** - Reusable UI and game components
|
||||
3. **Modular Gameplay Architecture** - Dynamic loading of gameplay modes
|
||||
4. **Scene Composition** - Modular scene loading and management
|
||||
5. **Data-Driven Configuration** - JSON for settings and translations
|
||||
6. **Component Architecture** - Reusable UI and game components
|
||||
7. **Centralized Scoring System** - Global score management across gameplay modes
|
||||
|
||||
This structure provides a clean separation of concerns, making the codebase maintainable and extensible for future features.
|
||||
Reference in New Issue
Block a user