Skip to main content
Glama

arcade_game

Generate complete 2D HTML5 Canvas arcade games with player controls, enemies, and mechanics. Create production-ready code, tests, and documentation for various game types and themes.

Instructions

Generate complete playable 2D arcade games using HTML5 Canvas with player controls, enemies, and game mechanics

WORKFLOW: Ideal for creating production-ready code, tests, and documentation TIP: Generate unlimited iterations locally, then review with Claude SAVES: Claude context for strategic decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisDepthNoLevel of game complexitydetailed
analysisTypeNoType of game generation to performcomprehensive
codeNoExisting game code to enhance (for single-game analysis)
controlsNoControl schemehybrid
difficultyNoGame difficulty levelmedium
featuresNoGame features to include
filePathNoPath to existing game file to enhance
filesNoArray of specific game files (for multi-game analysis)
gameTypeNoType of arcade game to generateshooter
languageNoProgramming languagejavascript
maxDepthNoMaximum directory depth for game file discovery (1-3)
projectPathNoPath to project root (for multi-game generation)
themeNoVisual theme for the gameretro

Implementation Reference

  • Plugin class registration with name 'arcade_game', category, and description.
    export class ArcadeGameGenerator extends BasePlugin implements IPromptPlugin {
      name = 'arcade_game';
      category = 'generate' as const;
      description = 'Generate complete playable 2D arcade games using HTML5 Canvas with player controls, enemies, and game mechanics';
  • Input schema defining parameters for single/multi-game generation, game types, difficulty, features, theme, controls, etc.
    parameters = {
      // Single-game parameters
      code: {
        type: 'string' as const,
        description: 'Existing game code to enhance (for single-game analysis)',
        required: false
      },
      filePath: {
        type: 'string' as const,
        description: 'Path to existing game file to enhance',
        required: false
      },
      
      // Multi-game parameters  
      projectPath: {
        type: 'string' as const,
        description: 'Path to project root (for multi-game generation)',
        required: false
      },
      files: {
        type: 'array' as const,
        description: 'Array of specific game files (for multi-game analysis)',
        required: false,
        items: { type: 'string' as const }
      },
      maxDepth: {
        type: 'number' as const,
        description: 'Maximum directory depth for game file discovery (1-3)',
        required: false,
        default: 2
      },
      
      // Arcade game specific parameters
      gameType: {
        type: 'string' as const,
        description: 'Type of arcade game to generate',
        enum: ['shooter', 'platformer', 'puzzle', 'snake', 'breakout', 'asteroids', 'custom'],
        default: 'shooter',
        required: false
      },
      difficulty: {
        type: 'string' as const,
        description: 'Game difficulty level',
        enum: ['easy', 'medium', 'hard', 'adaptive'],
        default: 'medium',
        required: false
      },
      features: {
        type: 'array' as const,
        description: 'Game features to include',
        items: { type: 'string' as const },
        default: ['score', 'lives', 'powerups', 'sound'],
        required: false
      },
      theme: {
        type: 'string' as const,
        description: 'Visual theme for the game',
        enum: ['retro', 'neon', 'pixel', 'minimal', 'space', 'nature', 'custom'],
        default: 'retro',
        required: false
      },
      controls: {
        type: 'string' as const,
        description: 'Control scheme',
        enum: ['wasd', 'arrows', 'mouse', 'touch', 'hybrid'],
        default: 'hybrid',
        required: false
      },
      
      // Universal parameters
      language: {
        type: 'string' as const,
        description: 'Programming language',
        required: false,
        default: 'javascript'
      },
      analysisDepth: {
        type: 'string' as const,
        description: 'Level of game complexity',
        enum: ['basic', 'detailed', 'comprehensive'],
        default: 'detailed',
        required: false
      },
      analysisType: {
        type: 'string' as const,
        description: 'Type of game generation to perform',
        enum: ['prototype', 'polished', 'comprehensive'],
        default: 'comprehensive',
        required: false
      }
    };
  • Main handler method that detects single/multi mode, validates params, sets up LLM model, and routes to game generation logic.
    async execute(params: any, llmClient: any) {
      return await withSecurity(this, params, llmClient, async (secureParams) => {
        try {
          // 1. Auto-detect analysis mode based on parameters
          const analysisMode = this.detectAnalysisMode(secureParams);
          
          // 2. Validate parameters based on detected mode
          this.validateParameters(secureParams, analysisMode);
          
          // 3. Setup model
          const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
          
          // 4. Route to appropriate generation method
          if (analysisMode === 'single-file') {
            return await this.executeSingleGameGeneration(secureParams, model, contextLength);
          } else {
            return await this.executeMultiGameGeneration(secureParams, model, contextLength);
          }
          
        } catch (error: any) {
          return ErrorHandler.createExecutionError('arcade_game', error);
        }
      });
    }
  • Helper to auto-detect single-file or multi-file analysis mode based on input parameters.
    private detectAnalysisMode(params: any): 'single-file' | 'multi-file' {
      // Single-file indicators take priority (avoids default parameter issues)
      if (params.code || params.filePath) {
        return 'single-file';
      }
      
      // Multi-file indicators (game collections, project enhancement)
      if (params.projectPath || params.files) {
        return 'multi-file';
      }
      
      // Default to single-file for arcade game generation (game-focused)
      return 'single-file';
    }
  • Core helper generating the prompt stages (system, data, output) for single-game arcade generation, containing the actual game generation instructions.
      private getSingleGamePromptStages(params: any): PromptStages {
        const { gameType, difficulty, features, theme, controls, analysisDepth, analysisType, code } = params;
        
        const systemAndContext = `You are a legendary game developer and creative genius specializing in ${analysisDepth} ${analysisType} arcade game creation.
    
    **Your Mission**: Create a complete, playable, and FUN ${gameType} arcade game that will immediately delight and engage players.
    
    **Game Development Context:**
    - Game Type: ${gameType}
    - Difficulty: ${difficulty}
    - Theme: ${theme}
    - Controls: ${controls}
    - Features: ${JSON.stringify(features)}
    - Complexity: ${analysisDepth}
    - Polish Level: ${analysisType}
    
    **Your World-Class Expertise:**
    - 20+ years creating addictive arcade games that players can't put down
    - Master of HTML5 Canvas, game physics, and smooth 60fps gameplay
    - Expert in player psychology - you know what makes games instantly fun
    - Specialized in clean, readable code that's easy to understand and modify
    - Pioneer of elegant game architectures with proper separation of concerns
    
    **Game Development Philosophy:**
    1. **Instant Fun** - Game should be enjoyable within 5 seconds of loading
    2. **Progressive Challenge** - Start easy, gradually increase difficulty
    3. **Juicy Feedback** - Visual and audio feedback for every player action
    4. **Clean Architecture** - Organized code with clear game loop, entities, and systems
    5. **Responsive Design** - Works perfectly on any screen size
    6. **Educational Value** - Code should teach good game development practices
    
    **Technical Requirements:**
    - Pure HTML5 Canvas and JavaScript (no external dependencies)
    - Smooth 60fps gameplay with proper game loop timing
    - Responsive canvas that adapts to screen size
    - Clean object-oriented design with Player, Enemy, and Game classes
    - Collision detection system optimized for performance
    - Particle effects for visual polish (explosions, trails, etc.)
    - Score system with local storage persistence
    - Professional code comments explaining game development concepts
    
    **Creative Requirements:**
    - Engaging visual style that matches the ${theme} theme
    - Intuitive ${controls} controls that feel responsive
    - Satisfying game mechanics that create flow state
    - Progressive difficulty that keeps players engaged
    - Polish details that make the game feel professional
    
    Your task is to create a masterpiece arcade game that showcases both technical excellence and creative brilliance.`;
    
        const dataPayload = code ? `**Existing Game Code to Enhance:**
    
    \`\`\`javascript
    ${code}
    \`\`\`
    
    **Enhancement Request:**
    Please analyze the existing game and enhance it with the requested features while maintaining the core gameplay.` : 
    
    `**New Game Generation Request:**
    Create a brand new ${gameType} game from scratch with the specified parameters.
    
    **Inspiration for ${gameType} games:**
    ${this.getGameTypeInspiration(gameType)}
    
    **Theme Guidelines for ${theme}:**
    ${this.getThemeGuidelines(theme)}`;
    
        const outputInstructions = `**Generate a complete, playable arcade game as a single HTML file:**
    
    \`\`\`html
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>${gameType.charAt(0).toUpperCase() + gameType.slice(1)} Game</title>
        <style>
            /* Beautiful ${theme}-themed CSS styling */
            /* Responsive design that works on all screen sizes */
            /* Professional visual polish */
        </style>
    </head>
    <body>
        <canvas id="gameCanvas"></canvas>
        <script>
            // Complete, production-ready game code including:
            
            // 1. GAME CONFIGURATION
            const GAME_CONFIG = {
                // All game constants and settings
            };
            
            // 2. UTILITY FUNCTIONS
            class Vector2 {
                // 2D vector math for positions and movement
            }
            
            class Utils {
                // Collision detection, random generators, etc.
            }
            
            // 3. GAME ENTITIES
            class Player {
                // Player character with movement, animation, abilities
            }
            
            class Enemy {
                // Enemy AI, spawning, different types
            }
            
            class Projectile {
                // Bullets, missiles, etc. with physics
            }
            
            class Powerup {
                // Power-ups, collectibles, bonuses
            }
            
            class Particle {
                // Visual effects system for polish
            }
            
            // 4. GAME SYSTEMS
            class InputManager {
                // ${controls} input handling with smooth controls
            }
            
            class AudioManager {
                // Sound effects using Web Audio API (optional)
            }
            
            class ScoreManager {
                // Scoring, high scores, local storage
            }
            
            // 5. MAIN GAME CLASS
            class Game {
                constructor() {
                    // Initialize game systems
                }
                
                init() {
                    // Setup canvas, event listeners, initial state
                }
                
                gameLoop() {
                    // Main 60fps game loop
                    this.update();
                    this.render();
                    requestAnimationFrame(() => this.gameLoop());
                }
                
                update() {
                    // Update all game entities and systems
                }
                
                render() {
                    // Draw everything to canvas
                }
                
                // Additional game state methods (start, pause, gameOver, etc.)
            }
            
            // 6. GAME INITIALIZATION
            const game = new Game();
            game.init();
            game.gameLoop();
        </script>
    </body>
    </html>
    \`\`\`
    
    **Critical Requirements:**
    ✅ Complete, runnable HTML file - no external dependencies
    ✅ Smooth 60fps gameplay with proper timing
    ✅ Responsive design that works on any screen size  
    ✅ Professional code organization with clear separation of concerns
    ✅ Engaging ${gameType} gameplay that's immediately fun
    ✅ Beautiful ${theme} visual style with polished UI
    ✅ Intuitive ${controls} controls that feel responsive
    ✅ All requested features: ${JSON.stringify(features)}
    ✅ Educational code comments explaining game development concepts
    ✅ Ready to copy-paste and play immediately
    
    **Visual Polish Standards:**
    - Smooth animations and transitions
    - Particle effects for explosions, collection, etc.
    - Screen shake for impact feedback
    - Color-coded UI elements for clarity
    - Professional typography and layout
    - Visual feedback for all player actions
    
    **Code Quality Standards:**
    - Clean, readable, well-documented code
    - Proper object-oriented design patterns
    - Performance optimizations for smooth gameplay
    - Error handling and edge case management
    - Easy to understand and modify for learning
    
    Create an arcade game that players will love and developers will learn from!`;
    
        return { systemAndContext, dataPayload, outputInstructions };
      }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/houtini-ai/lm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server