4.8 KiB
4.8 KiB
Cutscene System Summary
Overview
This document provides a comprehensive summary of the cutscene system designed for a 2D point-and-click adventure game in Godot 4.3. The system supports both sequential and parallel action execution, with a focus on extensibility and dynamic behavior.
System Architecture
Core Components
-
CutsceneManager
- Central orchestrator for all cutscene actions
- Manages sequential and parallel action execution
- Handles action completion and state transitions
- Provides signals for cutscene events
-
Action (Base Class)
- Abstract base class for all action types
- Defines common interface and state management
- Implements signal-based completion system
- Supports callbacks for flexible chaining
-
Specific Action Types
- MoveAction: Character movement to specific positions
- TurnAction: Character rotation to face targets
- DialogueAction: Text display for conversations
- AnimationAction: Playing character animations
- WaitAction: Time-based delays
Key Features
-
Sequential Execution
- Actions execute one after another in order
- Each action must complete before the next begins
- Supports complex linear story sequences
-
Parallel Execution
- Multiple actions can run simultaneously
- System waits for all actions in a group to complete
- Enables synchronized character movements and actions
-
Dynamic Behavior
- Actions are not immediate; they take time to complete
- Frame-based updates for smooth animations
- Asynchronous completion through signal system
-
Extensibility
- Easy to add new action types by extending the base Action class
- Plugin architecture for complex extensions
- Custom event and callback systems
Implementation Details
File Structure
/cutscene/
├── CutsceneManager.gd
├── Action.gd (base class)
├── actions/
│ ├── MoveAction.gd
│ ├── TurnAction.gd
│ ├── DialogueAction.gd
│ ├── AnimationAction.gd
│ └── WaitAction.gd
└── examples/
└── sample_cutscene.gd
Example Usage
The system supports complex sequences like the one described in the requirements:
# 1. Character1 moves to 234, 591
# 2. At the same time Character2 moves to 912, 235
# 3. When both arrive, character2 turns to character1
# 4. Character2 says a dialogue line to character1
# 5. A special animation (shocked) is played for character1
var cutscene = CutsceneManager.new()
# Add parallel movements
var moves = [
MoveAction.new(character1, Vector2(234, 591)),
MoveAction.new(character2, Vector2(912, 235))
]
cutscene.add_parallel_actions(moves)
// Add sequential actions
cutscene.add_action(TurnAction.new(character2, character1))
cutscene.add_action(DialogueAction.new(character2, "Hello there!"))
cutscene.add_action(AnimationAction.new(character1, "shocked"))
cutscene.start()
Technical Design
State Management
- Actions have three states: PENDING, RUNNING, COMPLETED
- CutsceneManager tracks overall state: IDLE, RUNNING, PAUSED
- Proper state transitions with signal notifications
Completion System
- Signal-based completion notifications
- Parallel action group tracking
- Error handling and recovery mechanisms
- Callback support for flexible action chaining
Performance Considerations
- Object pooling support for frequently created actions
- Efficient signal connection management
- Minimal overhead for inactive actions
- Frame-based updates for smooth animations
Extensibility Features
Adding New Actions
- Create a new class extending Action
- Implement required methods (start, is_completed)
- Add custom logic in update() if needed
- Use the action in cutscenes like any other
System Extensions
- Plugin architecture for complex features
- Custom event system for dynamic triggers
- Integration points with game state management
- Save/load support for persistent cutscenes
Benefits
- Flexibility: Supports both simple linear sequences and complex parallel actions
- Extensibility: Easy to add new action types and system features
- Integration: Designed to work with existing Godot systems
- Performance: Optimized for smooth gameplay and animations
- Maintainability: Clean separation of concerns and clear interfaces
Next Steps
To implement this system:
- Create the base Action class
- Implement the CutsceneManager
- Develop the core action types
- Add the completion and callback system
- Create sample cutscenes for testing
- Extend with custom actions as needed
This design provides a solid foundation for a powerful, flexible cutscene system that can handle the requirements of a 2D point-and-click adventure game while remaining extensible for future needs.