Files
BreakEscape/planning_notes/title-screen/TITLE_SCREEN_DEVELOPER_GUIDE.md
Z. Cliffe Schreuders 87072c6f4e Add title screen minigame implementation with customization options
- Created TITLE_SCREEN_CUSTOMIZATION.md with examples for extending the title screen.
- Added TITLE_SCREEN_DEVELOPER_GUIDE.md for technical guidance on implementation.
- Introduced TITLE_SCREEN_IMPLEMENTATION.md detailing the architecture and features.
- Compiled TITLE_SCREEN_INDEX.md as a documentation index for easy navigation.
- Updated TITLE_SCREEN_OVERLAY_UPDATE.md to reflect changes in title screen display mode.
- Created TITLE_SCREEN_QUICK_START.md for a quick setup guide.
- Developed TITLE_SCREEN_README.md as a comprehensive overview of the title screen system.
- Added title-screen-demo.json scenario to demonstrate title screen functionality.
- Modified existing files to integrate the title screen into the game flow.
2025-11-14 13:20:21 +00:00

7.0 KiB

Title Screen Implementation - Summary for Developers

🎬 What You Get

A beautiful, animated title screen that appears before the main game loads:

╔═══════════════════════════════════════════════════════════════╗
║                                                               ║
║                     BreakEscape                               ║  ← Glowing green text
║                   (pulsing glow effect)                       ║
║                                                               ║
║            Educational Security Game                          ║
║                                                               ║
║                      Loading...                               ║
║                                                               ║
╚═══════════════════════════════════════════════════════════════╝

📦 What's Included

File Purpose Status
js/minigames/title-screen/title-screen-minigame.js Main minigame class Created
css/title-screen.css Styling & animations Created
scenarios/title-screen-demo.json Example scenario Created
js/minigames/index.js Register minigame Modified
js/core/game.js Launch title screen Modified
js/minigames/framework/minigame-manager.js Handle transitions Modified

🎯 Quick Start (3 Steps)

Step 1: Enable in your scenario

{
    "showTitleScreen": true,
    "scenario_brief": "Your mission...",
    ...
}

Step 2: That's it!

The title screen will automatically:

  • Display when the game loads
  • Hide the game canvas
  • Auto-close after 3 seconds
  • Close immediately when the next minigame starts
  • Show the canvas + inventory again

Step 3: Test

http://localhost:8000/index.html?scenario=title-screen-demo

🔍 How It Works

The title screen is a special minigame that:

  1. Loads Before the Room is Visible

    • Game initializes (creates rooms, player, camera)
    • Canvas is hidden
    • Title screen minigame starts
    • Player sees only the title screen
  2. Auto-Closes When Needed

    • Waits 3 seconds (configurable)
    • OR closes when next minigame starts (mission brief, dialog, etc.)
    • Canvas and inventory are automatically shown again
  3. Seamless Transition

    • No loading delays
    • No player interaction required
    • Automatic as part of game flow

🎨 Customization

Change Auto-Close Time

window.startTitleScreenMinigame({
    autoCloseTimeout: 5000  // Wait 5 seconds instead of 3
});

Disable for Specific Scenarios

{
    "showTitleScreen": false,
    ...
}

Extend with Custom Content

See TITLE_SCREEN_CUSTOMIZATION.md for 7 examples including:

  • Theme variations (dark, cyberpunk, etc.)
  • Interactive buttons ("Press to Continue")
  • Story introductions
  • Progress bars
  • Custom animations

📚 Documentation

  • TITLE_SCREEN_README.md ← Start here (complete overview)
  • TITLE_SCREEN_IMPLEMENTATION.md - Technical details
  • TITLE_SCREEN_QUICK_START.md - Visual guide with diagrams
  • TITLE_SCREEN_CUSTOMIZATION.md - Examples and extensions

🧪 Verify Installation

Check that these files exist:

ls js/minigames/title-screen/title-screen-minigame.js  # ✅ New
ls css/title-screen.css                                # ✅ New
ls scenarios/title-screen-demo.json                    # ✅ New

Check that these are modified:

grep -l "title-screen" js/minigames/index.js          # ✅ Modified
grep -l "showTitleScreen" js/core/game.js             # ✅ Modified
grep -l "TitleScreenMinigame" js/minigames/framework/minigame-manager.js  # ✅ Modified

Check for errors:

# Open browser console on any game page
# Should see: "🎬 Title screen minigame started"
# No red errors

🚀 Usage Examples

Example 1: Default (3 second display)

{
    "showTitleScreen": true,
    "scenario_brief": "Your mission..."
}

Example 2: Custom timeout

// Programmatically start with 10 second timeout
window.startTitleScreenMinigame({
    autoCloseTimeout: 10000
});

Example 3: Disabled

{
    "showTitleScreen": false
}

Example 4: With demo scenario

http://localhost:8000/index.html?scenario=title-screen-demo

⚙️ Technical Details

Minigame Registration

MinigameFramework.registerScene('title-screen', TitleScreenMinigame);
window.startTitleScreenMinigame = startTitleScreenMinigame;

Game Flow Integration

// In game.js create() function:
if (gameScenario.showTitleScreen !== false) {
    // Hide canvas + inventory
    // Start title screen minigame
}

Auto-Close Logic

// In minigame-manager.js startMinigame():
if (wasTitleScreen && sceneType !== 'title-screen') {
    // Show canvas + inventory when transitioning away
}

Quality Assurance

  • No Syntax Errors - Verified
  • No Breaking Changes - All existing minigames work
  • Cross-Browser Compatible - CSS animations work everywhere
  • Responsive - Full screen on all resolutions
  • Accessible - Text is readable, animations don't cause seizures
  • Performance - Lightweight CSS animations, no JS bloat

🎓 Key Concepts

Why a Minigame?

Using the minigame framework ensures:

  • Consistent UI patterns
  • Automatic modal behavior
  • Proper input handling
  • Automatic canvas management

Why Hide the Canvas?

  • Prevents loading flicker
  • Cleaner first impression
  • Professional appearance
  • Players can't see game assets loading

Why Auto-Close?

  • No user interaction needed
  • Automatic transition to mission brief
  • Seamless game flow
  • No player confusion

📞 Support

If the title screen doesn't appear:

  1. Check browser console for errors (F12)
  2. Verify showTitleScreen: true in scenario JSON
  3. Ensure js/minigames/title-screen/title-screen-minigame.js exists
  4. Check that css/title-screen.css is loaded (Network tab in DevTools)

If the title screen appears but looks wrong:

  1. Check that CSS file loaded (should see green glowing text)
  2. Verify no CSS conflicts in other stylesheets
  3. Check that screen resolution shows full-screen overlay
  4. Try hard refresh (Ctrl+Shift+R on Linux)

If the title screen won't close:

  1. Check browser console for errors
  2. Verify next minigame is starting (should see in console logs)
  3. Try clicking on the screen (some custom versions might have buttons)
  4. Wait 3 seconds (auto-close timeout)

🎉 You're All Set!

Your title screen is now ready to use. Just add "showTitleScreen": true to any scenario and watch it display automatically!

Enjoy the BreakEscape! 🎬