create_text_adventure
Generate interactive text adventure games with branching storylines, inventory systems, and multiple endings for production-ready code and documentation.
Instructions
Generate complete interactive text adventure games with branching storylines, inventory systems, and multiple endings
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
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Existing adventure code to enhance (for single-file analysis) | |
| complexity | No | Adventure complexity level | intermediate |
| features | No | Adventure features to include | |
| filePath | No | Path to existing adventure file to enhance | |
| files | No | Array of specific adventure files to analyze/enhance | |
| length | No | Expected adventure length | medium |
| maxDepth | No | Maximum directory depth for adventure file discovery (1-5) | |
| playerClass | No | Player character class/type | custom |
| projectPath | No | Path to project root where adventure will be created | |
| theme | No | Adventure theme | fantasy |
Implementation Reference
- Main tool handler that detects single-file or multi-file mode, validates parameters, sets up the LLM model, and routes to the appropriate generation method.async execute(params: any, llmClient: any) { return await withSecurity(this, params, llmClient, async (secureParams) => { try { // Auto-detect analysis mode const analysisMode = this.detectAnalysisMode(secureParams); // Validate parameters this.validateParameters(secureParams, analysisMode); // Setup model const { model, contextLength } = await ModelSetup.getReadyModel(llmClient); // Route to appropriate generation method if (analysisMode === 'single-file') { return await this.executeSingleFileGeneration(secureParams, model, contextLength); } else { return await this.executeMultiFileGeneration(secureParams, model, contextLength); } } catch (error: any) { return ErrorHandler.createExecutionError('create_text_adventure', error); } }); }
- Input schema defining all parameters for the create_text_adventure tool, including file paths, project settings, and adventure-specific options like theme, complexity, and features.parameters = { // Single-file parameters (for analyzing existing adventures) code: { type: 'string' as const, description: 'Existing adventure code to enhance (for single-file analysis)', required: false }, filePath: { type: 'string' as const, description: 'Path to existing adventure file to enhance', required: false }, // Multi-file parameters (for generating complete adventure projects) projectPath: { type: 'string' as const, description: 'Path to project root where adventure will be created', required: false }, files: { type: 'array' as const, description: 'Array of specific adventure files to analyze/enhance', required: false, items: { type: 'string' as const } }, maxDepth: { type: 'number' as const, description: 'Maximum directory depth for adventure file discovery (1-5)', required: false, default: 3 }, // Adventure-specific parameters theme: { type: 'string' as const, description: 'Adventure theme', enum: ['fantasy', 'sci-fi', 'mystery', 'horror', 'historical', 'modern', 'steampunk', 'cyberpunk'], default: 'fantasy', required: false }, complexity: { type: 'string' as const, description: 'Adventure complexity level', enum: ['simple', 'intermediate', 'advanced'], default: 'intermediate', required: false }, length: { type: 'string' as const, description: 'Expected adventure length', enum: ['short', 'medium', 'long', 'epic'], default: 'medium', required: false }, features: { type: 'array' as const, description: 'Adventure features to include', items: { type: 'string' as const }, default: ['inventory', 'stats', 'save_game', 'multiple_endings'], required: false }, playerClass: { type: 'string' as const, description: 'Player character class/type', enum: ['warrior', 'mage', 'rogue', 'ranger', 'detective', 'scientist', 'explorer', 'custom'], default: 'custom', required: false } };
- Handler for multi-file text adventure generation (default mode), which generates detailed prompt stages and executes chunked LLM calls to produce a complete multi-file game project.private async executeMultiFileGeneration(params: any, model: any, contextLength: number) { // For new adventure generation, we create the complete project const promptStages = this.getMultiFilePromptStages(params); // Always use chunking for complete adventure generation const promptManager = new ThreeStagePromptManager(); const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength); const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize); const conversation = promptManager.createChunkedConversation(promptStages, dataChunks); const messages = [ conversation.systemMessage, ...conversation.dataMessages, conversation.analysisMessage ]; return await ResponseProcessor.executeChunked( messages, model, contextLength, 'create_text_adventure', 'multifile' );
- Handler for single-file adventure enhancement, reads existing code, generates prompt stages, and executes LLM calls (chunked or direct based on token limits).private async executeSingleFileGeneration(params: any, model: any, contextLength: number) { // Process existing adventure code let adventureCode = params.code; if (params.filePath) { adventureCode = await readFileContent(params.filePath); } // Generate enhancement prompt const promptStages = this.getSingleFilePromptStages({ ...params, code: adventureCode }); // Execute with appropriate method const promptManager = new ThreeStagePromptManager(); const needsChunking = TokenCalculator.needsChunking(promptStages, contextLength); if (needsChunking) { const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength); const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize); const conversation = promptManager.createChunkedConversation(promptStages, dataChunks); const messages = [ conversation.systemMessage, ...conversation.dataMessages, conversation.analysisMessage ]; return await ResponseProcessor.executeChunked( messages, model, contextLength, 'create_text_adventure', 'single' ); } else { return await ResponseProcessor.executeDirect( promptStages, model, contextLength, 'create_text_adventure' ); } }
- Core helper that generates the comprehensive prompt stages for creating full multi-file text adventure projects, including system context, data payload, and detailed output instructions for 7 specific files.private getMultiFilePromptStages(params: any): PromptStages { const { theme, complexity, length, features, playerClass } = params; const systemAndContext = `You are a master game designer and interactive fiction writer with 20+ years of experience creating captivating text adventures. You specialize in complete game architecture, narrative design, and creating immersive interactive experiences. **Your Mission**: Create a complete, professional-quality text adventure game from scratch. **Your Expertise**: - Interactive fiction architecture and game engine design - Compelling narrative structure with branching storylines - Advanced game mechanics (inventory, combat, character progression) - Professional web development for gaming applications - User experience design for text-based adventures - Replayability and engagement optimization **Adventure Specifications**: - Theme: ${theme} - Complexity Level: ${complexity} - Expected Length: ${length} - Features: ${features.join(', ')} - Player Class: ${playerClass} **Game Architecture Approach**: 1. Design modular game engine with extensible components 2. Create rich, atmospheric narrative with meaningful choices 3. Implement sophisticated game mechanics and systems 4. Build intuitive, responsive user interface 5. Include multiple story paths and endings for replayability 6. Ensure professional code quality and structure **Quality Standards**: - Professional game architecture with clean separation of concerns - Engaging storytelling with character development and world-building - Sophisticated game mechanics appropriate for the complexity level - Modern web technologies with responsive design - Comprehensive save/load system and game state management - Multiple difficulty levels and replayability features`; const dataPayload = `Adventure Generation Requirements: **Theme**: ${theme} **Complexity**: ${complexity} **Length**: ${length} **Features**: ${features.join(', ')} **Player Class**: ${playerClass} **Expected Output**: Complete, multi-file text adventure game project **Feature Details**: ${this.getFeatureDescriptions(features).map(f => `- ${f}`).join('\n')} **Complexity Guidelines**: ${this.getComplexityGuidelines(complexity)} **Length Specifications**: ${this.getLengthSpecifications(length)}`; const outputInstructions = `Create a complete text adventure game with the following file structure: **File Structure Required:** 1. **index.html** - Main game interface with modern styling 2. **game-engine.js** - Core game engine and state management 3. **story-data.js** - All story content, choices, and narrative text 4. **game-mechanics.js** - Inventory, combat, stats, and game systems 5. **ui-manager.js** - User interface management and interactions 6. **save-system.js** - Save/load functionality and persistence 7. **styles.css** - Professional styling with theme-appropriate design **Output Format:** For each file, provide: \`\`\` // File: [filename] [complete file content] \`\`\` **Technical Requirements:** - Modern, clean JavaScript with ES6+ features - Responsive CSS design that works on mobile and desktop - Comprehensive error handling and edge case management - Modular architecture for easy expansion - Local storage save system with multiple save slots - Professional UI/UX with smooth transitions and feedback - Accessibility features (keyboard navigation, screen reader support) **Game Content Requirements:** - Rich, immersive storyline appropriate for ${theme} theme - At least ${this.getMinimumScenes(length)} unique scenes/locations - Multiple story paths leading to different outcomes - Character development and meaningful player choices - Atmospheric descriptions and engaging dialogue - ${this.getMinimumEndings(complexity)} distinct endings based on player choices **Quality Assurance:** - All code must be production-ready and fully functional - Include comprehensive comments and documentation - Implement proper game state validation - Handle all user input edge cases gracefully - Provide clear instructions for players Create an adventure that demonstrates professional game development standards while delivering an engaging, memorable interactive experience.`; return { systemAndContext, dataPayload, outputInstructions };
- src/prompts/fun/create_text_adventure.ts:28-31 (registration)Plugin class registration with tool name 'create_text_adventure', category, and description.export class TextAdventureGenerator extends BasePlugin implements IPromptPlugin { name = 'create_text_adventure'; category = 'generate' as const; description = 'Generate complete interactive text adventure games with branching storylines, inventory systems, and multiple endings';