Files
experiment-adventure-ai/cutscene_system_summary.md
2025-07-30 21:52:27 -07:00

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

  1. CutsceneManager

    • Central orchestrator for all cutscene actions
    • Manages sequential and parallel action execution
    • Handles action completion and state transitions
    • Provides signals for cutscene events
  2. 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
  3. 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

  1. Sequential Execution

    • Actions execute one after another in order
    • Each action must complete before the next begins
    • Supports complex linear story sequences
  2. Parallel Execution

    • Multiple actions can run simultaneously
    • System waits for all actions in a group to complete
    • Enables synchronized character movements and actions
  3. Dynamic Behavior

    • Actions are not immediate; they take time to complete
    • Frame-based updates for smooth animations
    • Asynchronous completion through signal system
  4. 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

  1. Create a new class extending Action
  2. Implement required methods (start, is_completed)
  3. Add custom logic in update() if needed
  4. 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

  1. Flexibility: Supports both simple linear sequences and complex parallel actions
  2. Extensibility: Easy to add new action types and system features
  3. Integration: Designed to work with existing Godot systems
  4. Performance: Optimized for smooth gameplay and animations
  5. Maintainability: Clean separation of concerns and clear interfaces

Next Steps

To implement this system:

  1. Create the base Action class
  2. Implement the CutsceneManager
  3. Develop the core action types
  4. Add the completion and callback system
  5. Create sample cutscenes for testing
  6. 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.