match-3 grid generation

make game scene modular
global debug mode
This commit is contained in:
2025-09-24 10:45:14 +04:00
parent 122b5cb55f
commit afc808f0d6
21 changed files with 506 additions and 94 deletions

View File

@@ -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.