UNPKG

carverjs

Version:

A React library for AI-generated interactive games with reinforcement learning support

1,516 lines (1,513 loc) 81.4 kB
import * as React$1 from 'react'; import React__default from 'react'; type DifficultyLevel = 'easy' | 'medium' | 'hard' | 'expert'; type TargetAudience = 'beginner' | 'intermediate' | 'advanced' | 'expert'; type GameCategory = 'narrative' | 'simulation' | 'puzzle' | 'rpg' | 'quiz' | 'adventure' | 'strategy' | 'arcade' | 'educational' | 'sandbox' | 'platformer' | 'action'; type ContentType = 'text' | 'markdown' | 'html' | 'video' | 'audio' | 'image' | 'interactive' | 'simulation' | 'assessment'; interface GameTypeConfig { id: string; name: string; description: string; category: GameCategory; minScenes: number; maxScenes: number; requiredElements: string[]; optionalElements: string[]; supportedAudiences: TargetAudience[]; estimatedTimePerScene: number; minContentLength?: number; supportedContentTypes?: ContentType[]; version?: string; author?: string; customOptions?: Record<string, unknown>; } interface LearningContent { contentId: string; title: string; description: string; modules: ModuleContent[]; chunks: ContentChunk[]; metadata?: Record<string, unknown>; } interface ModuleContent { id: string; title: string; content: string; order: number; keyPoints: string[]; estimatedTime?: number; difficulty?: DifficultyLevel; contentType?: ContentType; metadata?: Record<string, unknown>; } interface ContentChunk { id: string; moduleId: string; content: string; similarity?: number; tokenCount?: number; contentType?: ContentType; metadata?: Record<string, unknown>; } interface ProcessedContent { keyConcepts: KeyConcept[]; learningObjectives: string[]; assessmentPoints: AssessmentPoint[]; narrativeElements: NarrativeElement[]; gameMechanics: GameMechanic[]; complexity?: ContentComplexity; processingMetadata?: Record<string, unknown>; } interface KeyConcept { id: string; title: string; description: string; importance: number; prerequisites: string[]; relatedConcepts: string[]; examples?: string[]; gameRepresentation?: GameElementSuggestion; metadata?: Record<string, unknown>; } interface AssessmentPoint { id: string; conceptId: string; question: string; type: 'multiple-choice' | 'scenario' | 'open-ended' | 'simulation' | 'drag-drop' | 'mini-game'; difficulty: DifficultyLevel; correctAnswer?: unknown; options?: AssessmentOption[]; explanation?: string; metadata?: Record<string, unknown>; } interface AssessmentOption { id: string; label: string; value: unknown; isCorrect: boolean; feedback?: string; } interface NarrativeElement { type: 'character' | 'setting' | 'conflict' | 'theme' | 'plot-point' | 'dialogue' | 'description'; content: string; scenes: string[]; importance?: number; metadata?: Record<string, unknown>; } interface GameMechanic { type: 'collection' | 'puzzle' | 'combat' | 'exploration' | 'crafting' | 'trading' | 'building' | 'racing'; description: string; relatedConcepts: string[]; complexity: number; parameters?: Record<string, unknown>; } interface GameElementSuggestion { elementType: 'character' | 'item' | 'location' | 'mechanic' | 'quest' | 'puzzle'; visualStyle?: string; interactions?: string[]; implementation?: string; } interface ContentComplexity { overallScore: number; vocabularyLevel: DifficultyLevel; conceptDensity: number; prerequisiteComplexity: number; recommendedAudience: TargetAudience; suggestedGameComplexity: DifficultyLevel; } interface GenerationContext { contentId: string; learningContent: LearningContent; gameType: string; targetAudience: TargetAudience; customOptions: Record<string, unknown>; aiModel: string; constraints: GenerationConstraints; processedContent?: ProcessedContent; userPreferences?: UserPreferences; metadata?: Record<string, unknown>; } interface GenerationConstraints { maxScenes: number; maxPlayTime: number; mustIncludeAssessments: boolean; allowBranching: boolean; difficultyProgression: 'linear' | 'adaptive' | 'player-choice' | 'random'; contentComplexity: 'simple' | 'moderate' | 'complex'; maxTokensPerRequest?: number; generationTimeLimit?: number; platformConstraints?: PlatformConstraints; customConstraints?: Record<string, unknown>; } interface PlatformConstraints { platform: 'web' | 'mobile' | 'desktop' | 'console' | 'vr' | 'ar'; screenSize?: Size2D; performance?: PerformanceConstraints; inputMethods?: InputMethod[]; accessibility?: AccessibilityRequirements; } interface PerformanceConstraints { maxMemoryMB?: number; targetFPS?: number; maxAssetSizeMB?: number; networkConstraints?: NetworkConstraints; } interface NetworkConstraints { offlineRequired: boolean; maxDownloadSizeMB?: number; streamingSupport?: boolean; } type InputMethod = 'keyboard' | 'mouse' | 'touch' | 'gamepad' | 'voice' | 'gesture' | 'eye-tracking' | 'motion-controller'; interface UserPreferences { learningStyle?: 'visual' | 'auditory' | 'kinesthetic' | 'reading' | 'mixed'; pace?: 'slow' | 'moderate' | 'fast' | 'variable'; tone?: 'formal' | 'casual' | 'humorous' | 'serious' | 'dramatic'; visualStyle?: VisualStylePreferences; audioPreferences?: AudioPreferences; accessibility?: AccessibilityRequirements; language?: string; custom?: Record<string, unknown>; } interface VisualStylePreferences { colorScheme?: 'light' | 'dark' | 'high-contrast' | 'custom'; artStyle?: 'realistic' | 'cartoon' | 'pixel-art' | 'minimalist' | 'abstract'; animations?: 'full' | 'reduced' | 'none'; uiComplexity?: 'simple' | 'standard' | 'advanced'; } interface AudioPreferences { backgroundMusic?: boolean; soundEffects?: boolean; voiceNarration?: boolean; audioDescriptions?: boolean; volumePreferences?: VolumePreferences; } interface VolumePreferences { master?: number; music?: number; effects?: number; voice?: number; } interface AccessibilityRequirements { highContrast?: boolean; largeText?: boolean; screenReader?: boolean; reducedMotion?: boolean; colorBlindSupport?: boolean; subtitles?: boolean; keyboardNavigation?: boolean; voiceControl?: boolean; motorAccessibility?: MotorAccessibilityOptions; } interface MotorAccessibilityOptions { holdDuration?: number; clickTolerance?: number; dragThreshold?: number; alternativeInputs?: InputMethod[]; } interface GameOutline { id: string; gameType: string; title: string; description: string; scenes: GameScene$1[]; flow: GameFlow; metadata: GameMetadata; assets?: GameAsset[]; } interface GameScene$1 { id: string; type: string; title: string; description: string; content: SceneContent; interactions: SceneInteraction[]; transitions: SceneTransition$1[]; layout?: SceneLayout; metadata: SceneMetadata; } interface SceneContent { text: string; contentType?: ContentType; media?: MediaElement[]; data?: Record<string, unknown>; styling?: StylingOptions; localization?: LocalizationData; } interface SceneLayout { type: 'grid' | 'free-form' | 'flow' | 'layers' | 'isometric'; dimensions: Size2D; gridConfig?: GridLayoutConfig; layers?: LayerConfig[]; camera?: CameraConfig; background?: BackgroundConfig; } interface GridLayoutConfig { cellSize: Size2D; gridSize: { rows: number; columns: number; }; origin: Vector2D; spacing?: Vector2D; } interface LayerConfig { id: string; name: string; zIndex: number; visible: boolean; opacity?: number; blendMode?: BlendMode; } type BlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'soft-light' | 'hard-light' | 'color-dodge' | 'color-burn' | 'darken' | 'lighten' | 'difference' | 'exclusion'; interface CameraConfig { position: Vector2D | Vector3D; type: '2d' | '3d-perspective' | '3d-orthographic' | 'isometric'; fov?: number; zoom?: number; bounds?: BoundingBox2D; constraints?: CameraConstraints; } interface CameraConstraints { minZoom?: number; maxZoom?: number; movementBounds?: BoundingBox2D; followTarget?: string; smoothFollow?: boolean; } interface BackgroundConfig { type: 'color' | 'image' | 'gradient' | 'pattern' | 'video' | 'animated'; value: string; properties?: BackgroundProperties; } interface BackgroundProperties { repeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y'; position?: string; size?: string; attachment?: 'scroll' | 'fixed' | 'local'; parallax?: boolean; parallaxSpeed?: number; } interface SceneInteraction { id: string; type: 'choice' | 'input' | 'click' | 'drag' | 'quiz' | 'simulation' | 'mini-game' | 'gesture' | 'voice'; prompt: string; position?: Vector2D; bounds?: BoundingBox2D | Circle; options?: InteractionOption[]; validation?: ValidationRule[]; config?: InteractionConfig; visual?: InteractionVisual; metadata?: Record<string, unknown>; } interface InteractionOption { id: string; label: string; value: unknown; effect?: string; feedback?: string; isCorrect?: boolean; nextState?: string; styling?: StylingOptions; metadata?: Record<string, unknown>; } interface ValidationRule { type: 'required' | 'format' | 'range' | 'length' | 'pattern' | 'custom'; params: Record<string, unknown>; message: string; validator?: (value: unknown) => boolean; } interface InteractionConfig { timeout?: number; retries?: number; hints?: string[]; scoring?: ScoringConfig; animation?: AnimationConfig; audio?: AudioConfig; } interface ScoringConfig { correctPoints: number; incorrectPenalty?: number; timeBonusMultiplier?: number; streakBonus?: number; } interface InteractionVisual { type: 'button' | 'hotspot' | 'overlay' | 'inline' | 'popup' | 'widget'; styling?: StylingOptions; icon?: string; states?: VisualState[]; animations?: AnimationDefinition[]; } interface VisualState { name: 'default' | 'hover' | 'active' | 'disabled' | 'selected' | 'error' | 'success'; styling: StylingOptions; animation?: AnimationDefinition; } interface SceneTransition$1 { toSceneId: string; condition?: TransitionCondition; animation?: TransitionAnimation; delay?: number; metadata?: Record<string, unknown>; } interface TransitionCondition { type: 'always' | 'if' | 'score' | 'time' | 'interaction' | 'completion' | 'custom'; params: Record<string, unknown>; evaluator?: (context: unknown) => boolean; } interface TransitionAnimation { type: 'fade' | 'slide' | 'zoom' | 'flip' | 'dissolve' | 'wipe' | 'custom'; duration: number; easing?: EasingFunction; direction?: 'in' | 'out' | 'in-out'; params?: Record<string, unknown>; } type EasingFunction = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic-bezier' | 'spring' | 'bounce'; interface MediaElement { id: string; type: 'image' | 'video' | 'audio' | 'animation' | 'interactive' | '3d-model' | 'particle-system'; url?: string; prompt?: string; alt?: string; caption?: string; dimensions?: Size2D; position?: Vector2D; transform?: Transform2D; properties?: MediaProperties; metadata?: Record<string, unknown>; } interface MediaProperties { autoplay?: boolean; loop?: boolean; muted?: boolean; volume?: number; playbackRate?: number; preload?: 'none' | 'metadata' | 'auto'; quality?: QualitySettings; } interface QualitySettings { resolution?: Size2D; compression?: number; formats?: string[]; adaptive?: boolean; } interface StylingOptions { colorScheme?: 'light' | 'dark' | 'auto' | 'custom'; fontFamily?: string; fontSize?: string | number; fontWeight?: 'normal' | 'bold' | 'lighter' | 'bolder' | number; color?: string; backgroundColor?: string; border?: BorderStyle; spacing?: SpacingStyle; layout?: 'standard' | 'card' | 'fullscreen' | 'overlay' | 'inline'; shadow?: ShadowStyle; customClasses?: string[]; customStyles?: Record<string, string>; } interface BorderStyle { width?: string | number; style?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset'; color?: string; radius?: string | number; } interface SpacingStyle { margin?: string | number; padding?: string | number; gap?: string | number; } interface ShadowStyle { offsetX?: number; offsetY?: number; blur?: number; spread?: number; color?: string; inset?: boolean; } interface AnimationConfig { enabled: boolean; defaultDuration?: number; defaultEasing?: EasingFunction; respectReducedMotion?: boolean; } interface AnimationDefinition { name: string; type: 'css' | 'javascript' | 'lottie' | 'spine' | 'custom'; data: unknown; duration?: number; easing?: EasingFunction; delay?: number; iterations?: number | 'infinite'; direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse'; } interface AudioConfig { backgroundMusic?: AudioTrack; soundEffects?: AudioTrack[]; narration?: AudioTrack; ambient?: AudioTrack[]; settings?: AudioSettings; } interface AudioTrack { id: string; url: string; name?: string; volume?: number; loop?: boolean; fadeIn?: number; fadeOut?: number; metadata?: Record<string, unknown>; } interface AudioSettings { masterVolume?: number; musicVolume?: number; effectsVolume?: number; voiceVolume?: number; spatialAudio?: boolean; quality?: 'low' | 'medium' | 'high'; } interface LocalizationData { defaultLanguage: string; availableLanguages: string[]; localizedContent: Record<string, LocalizedContent>; } interface LocalizedContent { language: string; text: string; media?: Record<string, string>; interactions?: Record<string, string>; custom?: Record<string, unknown>; } interface SceneMetadata { estimatedDuration: number; difficulty: DifficultyLevel; learningObjectives: string[]; prerequisites: string[]; tags: string[]; relatedChunks?: string[]; assessmentWeight?: number; replayable?: boolean; accessibilityFeatures?: string[]; performanceNotes?: string[]; custom?: Record<string, unknown>; } interface GameFlow { startSceneId: string; endSceneIds: string[]; paths: FlowPath[]; breakpoints: Breakpoint[]; continuityElements: ContinuityElement[]; validation?: FlowValidation; optimization?: FlowOptimization; } interface FlowPath { id: string; name: string; sceneIds: string[]; conditions?: PathCondition[]; weight: number; difficulty?: DifficultyLevel; estimatedTime?: number; metadata?: Record<string, unknown>; } interface Breakpoint { id: string; sceneId: string; type: 'save-point' | 'chapter-end' | 'decision-point' | 'assessment' | 'reflection' | 'milestone' | 'checkpoint'; title: string; description: string; allowPause: boolean; showProgress: boolean; estimatedTimeToReach?: number; saveData?: SaveData; metadata?: Record<string, unknown>; } interface SaveData { id: string; timestamp: Date; progress: PlayerProgress; gameState: Record<string, unknown>; statistics?: PlayerStatistics; } interface PlayerProgress { currentSceneId: string; completedScenes: string[]; unlockedScenes: string[]; progressPercentage: number; achievements?: Achievement[]; choices?: PlayerChoice[]; } interface PlayerStatistics { totalPlayTime: number; sessionCount: number; averageSessionTime: number; correctAnswersPercentage?: number; hintsUsed?: number; custom?: Record<string, number>; } interface Achievement { id: string; name: string; description: string; icon?: string; points?: number; rarity?: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'; unlockCondition: AchievementCondition; } interface AchievementCondition { type: 'complete-scene' | 'complete-path' | 'score-threshold' | 'time-limit' | 'perfect-score' | 'custom'; params: Record<string, unknown>; evaluator?: (progress: PlayerProgress, statistics: PlayerStatistics) => boolean; } interface PlayerChoice { sceneId: string; interactionId: string; choice: unknown; timestamp: Date; consequences?: string[]; } interface ContinuityElement { type: 'narrative-thread' | 'character-arc' | 'knowledge-building' | 'skill-progression' | 'theme-consistency' | 'difficulty-curve'; description: string; affectedScenes: string[]; strength: number; implementation?: string; validationRules?: ContinuityRule[]; metadata?: Record<string, unknown>; } interface ContinuityRule { type: 'prerequisite' | 'sequence' | 'dependency' | 'consistency'; description: string; params: Record<string, unknown>; validator?: (scenes: GameScene$1[]) => boolean; } interface PathCondition { type: 'score' | 'choice' | 'completion' | 'time' | 'skill-level' | 'random' | 'adaptive' | 'custom'; operator?: '>' | '<' | '=' | '!=' | '>=' | '<='; value?: unknown; weight?: number; evaluator?: (context: unknown) => boolean; metadata?: Record<string, unknown>; } interface FlowValidation { isValid: boolean; errors: string[]; warnings: string[]; statistics?: FlowStatistics; suggestions?: string[]; } interface FlowStatistics { totalScenes: number; decisionPoints: number; pathCount: number; averagePathLength: number; complexityScore: number; reachabilityAnalysis: ReachabilityAnalysis; difficultyDistribution: Record<DifficultyLevel, number>; } interface ReachabilityAnalysis { reachableScenes: string[]; unreachableScenes: string[]; deadEndScenes: string[]; criticalPathScenes: string[]; optionalPathScenes: string[]; } interface FlowOptimization { algorithm: string; score: number; suggestions: OptimizationSuggestion[]; performanceMetrics?: PerformanceMetrics; } interface OptimizationSuggestion { type: 'reorder-scenes' | 'add-transition' | 'remove-redundancy' | 'balance-difficulty' | 'improve-pacing'; description: string; impact: number; complexity: 'low' | 'medium' | 'high'; affectedScenes?: string[]; } interface PerformanceMetrics { completionTimeRange: { min: number; max: number; average: number; }; engagementPrediction: number; difficultyCurveAnalysis: DifficultyAnalysis; retentionProbability: number; } interface DifficultyAnalysis { progressionType: 'linear' | 'exponential' | 'logarithmic' | 'stepped' | 'irregular'; spikes: DifficultySpike[]; recommendedAdjustments: string[]; } interface DifficultySpike { sceneId: string; severity: number; type: 'sudden-increase' | 'sustained-high' | 'unexpected-drop'; mitigation?: string; } interface GameAsset { id: string; name: string; type: AssetType; url: string; size?: number; dimensions?: Size2D; format?: string; priority?: 'low' | 'medium' | 'high' | 'critical'; preload?: 'none' | 'metadata' | 'auto'; dependencies?: string[]; metadata?: Record<string, unknown>; } type AssetType = 'image' | 'audio' | 'video' | 'font' | 'texture' | '3d-model' | 'animation' | 'shader' | 'data' | 'script' | 'style' | 'manifest'; interface GameMetadata { createdAt: Date; modifiedAt?: Date; version: string; targetAudience: TargetAudience; estimatedPlayTime: number; educationalGoals?: string[]; genre: GameCategory; contentRating?: ContentRating; platformCompatibility: string[]; accessibilityCompliance?: AccessibilityStandard[]; aiModel?: string; generationParams?: Record<string, unknown>; qualityMetrics?: QualityMetrics; localizationSupport?: string[]; custom?: Record<string, unknown>; } interface ContentRating { organization: 'ESRB' | 'PEGI' | 'CERO' | 'USK' | 'OFLC' | 'custom'; rating: string; descriptors?: string[]; ageRecommendation?: number; } type AccessibilityStandard = 'WCAG-2.1-A' | 'WCAG-2.1-AA' | 'WCAG-2.1-AAA' | 'Section-508' | 'EN-301-549'; interface QualityMetrics { contentCoverage: number; engagementScore: number; educationalEffectiveness: number; flowCoherence: number; technicalQuality: number; accessibilityScore: number; overallScore: number; analysisDetails?: QualityAnalysisDetails; } interface QualityAnalysisDetails { contentAnalysis: ContentQualityAnalysis; technicalAnalysis: TechnicalQualityAnalysis; uxAnalysis: UXQualityAnalysis; performanceAnalysis: PerformanceQualityAnalysis; } interface ContentQualityAnalysis { narrativeCoherence: number; educationalAlignment: number; contentDepth: number; languageQuality: number; issues: ContentIssue[]; } interface TechnicalQualityAnalysis { performance: number; compatibility: number; assetOptimization: number; codeQuality: number; issues: TechnicalIssue[]; } interface UXQualityAnalysis { usability: number; navigationClarity: number; visualDesign: number; interactionDesign: number; issues: UXIssue[]; } interface PerformanceQualityAnalysis { loadingTime: number; memoryUsage: number; renderingPerformance: number; networkEfficiency: number; issues: PerformanceIssue[]; } interface ContentIssue { type: 'grammatical' | 'factual' | 'inconsistency' | 'inappropriate' | 'unclear'; severity: IssueSeverity; description: string; location?: string; suggestedFix?: string; } interface TechnicalIssue { type: 'compatibility' | 'performance' | 'security' | 'accessibility' | 'standards'; severity: IssueSeverity; description: string; affectedComponents?: string[]; suggestedFix?: string; } interface UXIssue { type: 'navigation' | 'visual' | 'interaction' | 'feedback' | 'accessibility'; severity: IssueSeverity; description: string; userImpact?: string; suggestedImprovement?: string; } interface PerformanceIssue { type: 'loading' | 'memory' | 'rendering' | 'network' | 'storage'; severity: IssueSeverity; description: string; performanceImpact?: string; optimizationSuggestion?: string; } type IssueSeverity = 'low' | 'medium' | 'high' | 'critical'; interface IGameGenerator { generateOutline(context: GenerationContext): Promise<GameOutline>; validateOutline(outline: GameOutline): ValidationResult; enhanceOutline(outline: GameOutline, options: EnhancementOptions): Promise<GameOutline>; getSupportedEnhancements?(): string[]; getConfigurationSchema?(): Record<string, unknown>; previewContent?(context: GenerationContext): Promise<GamePreview>; } interface GamePreview { id: string; title: string; description: string; sceneSummaries: SceneSummary[]; estimatedGenerationTime: number; qualityScore: number; issues?: string[]; } interface SceneSummary { id: string; title: string; type: string; summary: string; estimatedDuration: number; } interface ISceneBuilder { buildScene(sceneConfig: SceneConfig, context: GenerationContext): Promise<GameScene$1>; getSupportedSceneTypes(): string[]; validateScene(scene: GameScene$1): ValidationResult; enhanceScene?(scene: GameScene$1, options: SceneEnhancementOptions): Promise<GameScene$1>; getCapabilities?(): SceneBuilderCapabilities; buildScenes?(sceneConfigs: SceneConfig[], context: GenerationContext): Promise<GameScene$1[]>; } interface IFlowDesigner { designFlow(scenes: GameScene$1[], strategy: FlowStrategy): Promise<GameFlow>; validateFlow(flow: GameFlow): ValidationResult; optimizeFlow(flow: GameFlow): Promise<GameFlow>; getCapabilities?(): FlowDesignerCapabilities; analyzeComplexity?(flow: GameFlow): FlowComplexityAnalysis; generateAlternativeFlows?(scenes: GameScene$1[], strategy: FlowStrategy, count: number): Promise<GameFlow[]>; } interface IContentProcessor { processContent(content: LearningContent, gameType: string): Promise<ProcessedContent>; extractKeyConceptsStructure(content: LearningContent): Promise<KeyConcept[]>; getSupportedContentTypes(): ContentType[]; analyzeComplexity?(content: LearningContent): Promise<ContentComplexity>; extractAssessmentOpportunities?(content: LearningContent): Promise<AssessmentPoint[]>; suggestGameMechanics?(content: LearningContent, gameType: string): Promise<GameMechanic[]>; } interface SceneConfig { id: string; type: string; title: string; description: string; gameType: string; priority?: number; contentRequirements?: ContentRequirements; interactionRequirements?: InteractionRequirements; visualRequirements?: VisualRequirements; [key: string]: unknown; } interface ContentRequirements { minLength?: number; maxLength?: number; requiredTypes?: ContentType[]; themes?: string[]; learningObjectives?: string[]; } interface InteractionRequirements { minInteractions?: number; maxInteractions?: number; requiredTypes?: string[]; requiresAssessment?: boolean; requiresBranching?: boolean; } interface VisualRequirements { requiredMedia?: string[]; visualStyle?: string; accessibility?: string[]; platform?: string[]; } interface EnhancementOptions { addNarrativeHooks?: boolean; optimizeForAudience?: TargetAudience; ensureContinuity?: boolean; addAssessments?: boolean; includeAccessibility?: boolean; addMultimedia?: boolean; optimizePerformance?: boolean; addLocalization?: boolean; enhancementLevel?: 'basic' | 'standard' | 'advanced'; custom?: Record<string, unknown>; } interface SceneEnhancementOptions { addVisuals?: boolean; enhanceInteractivity?: boolean; addAudio?: boolean; improveAccessibility?: boolean; addAnimations?: boolean; optimizeLayout?: boolean; addProgressiveDisclosure?: boolean; custom?: Record<string, unknown>; } interface FlowStrategy { type: GameCategory; allowBranching: boolean; pattern?: 'linear' | 'branching' | 'hub-and-spoke' | 'open-world' | 'guided-exploration'; pacing?: 'slow' | 'moderate' | 'fast' | 'variable' | 'adaptive'; difficultyCurve?: 'flat' | 'rising' | 'peaks-and-valleys' | 'adaptive' | 'player-controlled'; engagementStrategy?: 'narrative-driven' | 'challenge-based' | 'exploration-focused' | 'social-interaction'; retryStrategy?: 'unlimited' | 'limited' | 'progressive-hints' | 'adaptive-difficulty'; custom?: Record<string, unknown>; } interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; score?: number; suggestions?: string[]; context?: Record<string, unknown>; metadata?: Record<string, unknown>; } interface SceneBuilderCapabilities { supportedSceneTypes: string[]; supportedInteractions: string[]; supportedMedia: string[]; maxInteractionsPerScene: number; supportsDynamicContent: boolean; supportsAIEnhancement: boolean; supportsBatchProcessing: boolean; supportedComplexityLevels: DifficultyLevel[]; custom?: Record<string, unknown>; } interface FlowDesignerCapabilities { supportedPatterns: string[]; maxPaths: number; supportsAdaptiveDifficulty: boolean; supportsDynamicBranching: boolean; optimizationAlgorithms: string[]; supportsAlternativeGeneration: boolean; maxAlternativeFlows?: number; custom?: Record<string, unknown>; } interface FlowComplexityAnalysis { overallComplexity: number; branchingComplexity: number; pathLengthVariance: number; decisionPointDensity: number; cognitiveLoad: number; navigationComplexity: number; contentComplexityDistribution: Record<DifficultyLevel, number>; recommendations?: string[]; details?: Record<string, unknown>; } interface GameGenerationResult { success: boolean; outline?: GameOutline; error?: string; errorDetails?: ErrorDetails; processingTime: number; statistics?: GenerationStatistics; qualityAssessment?: QualityAssessment; metadata?: Record<string, unknown>; } interface ErrorDetails { code: string; category: 'input' | 'processing' | 'ai' | 'system' | 'timeout' | 'validation'; context?: Record<string, unknown>; stackTrace?: string; recoverySuggestions?: string[]; } interface GenerationStatistics { totalScenes: number; estimatedPlayTime: number; gameType: string; complexity: 'simple' | 'moderate' | 'complex'; tokensConsumed?: number; apiCalls?: number; contentCoverage?: number; efficiencyScore?: number; assetStatistics?: AssetGenerationStatistics; performanceStatistics?: PerformanceGenerationStatistics; } interface AssetGenerationStatistics { totalAssets: number; assetsByType: Record<AssetType, number>; totalAssetSize: number; averageGenerationTime: number; } interface PerformanceGenerationStatistics { memoryUsage: MemoryUsageStatistics; cpuUsage: number; networkUsage: NetworkUsageStatistics; bottlenecks: PerformanceBottleneck[]; } interface MemoryUsageStatistics { peak: number; average: number; growthRate: number; } interface NetworkUsageStatistics { totalRequests: number; totalDataTransferred: number; averageRequestTime: number; failedRequests: number; } interface PerformanceBottleneck { type: 'cpu' | 'memory' | 'network' | 'ai' | 'disk'; description: string; impact: number; optimizationSuggestions: string[]; } interface QualityAssessment { overallScore: number; metrics: QualityMetrics; issues?: QualityIssue[]; recommendations?: string[]; confidence?: number; comparativeAnalysis?: ComparativeQualityAnalysis; } interface ComparativeQualityAnalysis { similarGamesComparison: SimilarGamesComparison; industryBenchmarks: IndustryBenchmarks; bestPracticesCompliance: BestPracticesCompliance; } interface SimilarGamesComparison { comparisonGames: GameReference[]; relativeQualityScore: number; strengths: string[]; weaknesses: string[]; } interface GameReference { id: string; name: string; category: GameCategory; qualityScore: number; keyFeatures: string[]; } interface IndustryBenchmarks { industryAverageScore: number; topTierThreshold: number; qualityPercentile: number; benchmarkCategories: Record<string, BenchmarkCategory>; } interface BenchmarkCategory { name: string; score: number; industryAverage: number; topPerformersAverage: number; } interface BestPracticesCompliance { overallCompliance: number; practiceAreas: PracticeArea[]; complianceGaps: ComplianceGap[]; } interface PracticeArea { name: string; complianceScore: number; practicesFollowed: string[]; practicesMissed: string[]; } interface ComplianceGap { area: string; severity: IssueSeverity; description: string; qualityImpact: number; remediationSteps: string[]; } interface QualityIssue { severity: IssueSeverity; type: string; category: 'content' | 'technical' | 'ux' | 'performance' | 'accessibility'; description: string; affectedScenes?: string[]; affectedComponents?: string[]; suggestedFix?: string; fixComplexity?: 'low' | 'medium' | 'high'; metadata?: Record<string, unknown>; } interface PluginConfig { id: string; name: string; version: string; type: PluginType; description: string; author: string; requiredSystemVersion: string; dependencies?: PluginDependency[]; permissions?: PluginPermission[]; configSchema?: Record<string, unknown>; entryPoint: string; assets?: PluginAsset[]; metadata?: Record<string, unknown>; } type PluginType = 'game-type' | 'scene-builder' | 'flow-designer' | 'content-processor' | 'enhancement' | 'asset-generator' | 'quality-analyzer' | 'export-format' | 'integration'; interface PluginDependency { pluginId: string; version: string; optional?: boolean; fallback?: PluginFallback; } interface PluginFallback { type: 'disable-feature' | 'use-alternative' | 'graceful-degradation'; description: string; alternativePluginId?: string; } interface PluginPermission { type: PermissionType; description: string; required: boolean; scope?: string; riskLevel?: 'low' | 'medium' | 'high'; } type PermissionType = 'ai-access' | 'database-read' | 'database-write' | 'external-api' | 'file-system' | 'network-access' | 'user-data-access' | 'system-modification'; interface PluginAsset { id: string; type: AssetType; path: string; description?: string; size?: number; } interface ExtensionPoint { id: string; name: string; description: string; interface: string; allowMultiple: boolean; priority?: number; version?: string; backwardCompatible?: boolean; } interface PluginLifecycle { onLoad?(): Promise<void>; onActivate?(): Promise<void>; onDeactivate?(): Promise<void>; onUnload?(): Promise<void>; onShutdown?(): Promise<void>; } type EventHandler<T = unknown> = (data: T) => void | Promise<void>; type AsyncFunction<T = unknown, R = unknown> = (input: T) => Promise<R>; type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; }; type RequireFields<T, K extends keyof T> = T & Required<Pick<T, K>>; type OptionalFields<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; type Parameters<T> = T extends (...args: infer P) => unknown ? P : never; type ReturnType<T> = T extends (...args: unknown[]) => infer R ? R : unknown; type DeepReadonly<T> = { [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P]; }; type Nullable<T> = T | null; type Optional<T> = T | undefined; type Brand<T, B> = T & { __brand: B; }; type Nominal<T, N extends string> = T & { __nominal: N; }; type GameGeneratorFactory = (config: GameTypeConfig) => IGameGenerator; type SceneBuilderFactory = (config: GameTypeConfig) => ISceneBuilder; type FlowDesignerFactory = (config: GameTypeConfig) => IFlowDesigner; type ContentProcessorFactory = (config: GameTypeConfig) => IContentProcessor; interface ComponentRegistry { generators: Map<string, IGameGenerator>; sceneBuilders: Map<string, ISceneBuilder>; flowDesigners: Map<string, IFlowDesigner>; contentProcessors: Map<string, IContentProcessor>; gameTypeConfigs: Map<string, GameTypeConfig>; plugins: Map<string, PluginConfig>; extensionPoints: Map<string, ExtensionPoint>; } interface RegistrationOptions { allowOverride?: boolean; validationLevel?: 'strict' | 'moderate' | 'lenient'; enableImmediately?: boolean; priority?: number; metadata?: Record<string, unknown>; } interface Builder<T> { build(): T; validate(): ValidationResult; reset(): Builder<T>; } interface GameOutlineBuilder extends Builder<GameOutline> { setGameType(gameType: string): GameOutlineBuilder; setTitle(title: string): GameOutlineBuilder; setDescription(description: string): GameOutlineBuilder; addScene(scene: GameScene$1): GameOutlineBuilder; addScenes(scenes: GameScene$1[]): GameOutlineBuilder; setFlow(flow: GameFlow): GameOutlineBuilder; setMetadata(metadata: GameMetadata): GameOutlineBuilder; } interface SceneBuilderInterface extends Builder<GameScene$1> { setId(id: string): SceneBuilderInterface; setType(type: string): SceneBuilderInterface; setTitle(title: string): SceneBuilderInterface; setDescription(description: string): SceneBuilderInterface; setContent(content: SceneContent): SceneBuilderInterface; addInteraction(interaction: SceneInteraction): SceneBuilderInterface; addInteractions(interactions: SceneInteraction[]): SceneBuilderInterface; addTransition(transition: SceneTransition$1): SceneBuilderInterface; addTransitions(transitions: SceneTransition$1[]): SceneBuilderInterface; setLayout(layout: SceneLayout): SceneBuilderInterface; setMetadata(metadata: SceneMetadata): SceneBuilderInterface; } declare abstract class GameGenerationError extends Error { code: string; context?: Record<string, unknown>; category: string; severity: IssueSeverity; constructor(message: string, code: string, category: string, severity?: IssueSeverity, context?: Record<string, unknown>); } declare class ValidationError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class GenerationError extends GameGenerationError { constructor(message: string, severity?: IssueSeverity, context?: Record<string, unknown>); } declare class ConfigurationError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class PluginError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class ContentProcessingError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class AIServiceError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class PerformanceError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare class SecurityError extends GameGenerationError { constructor(message: string, context?: Record<string, unknown>); } declare const DEFAULT_GAME_TYPE_CONFIG: Partial<GameTypeConfig>; declare const DEFAULT_GENERATION_CONSTRAINTS: GenerationConstraints; declare const DEFAULT_SCENE_METADATA: SceneMetadata; declare const DEFAULT_USER_PREFERENCES: UserPreferences; declare const DEFAULT_QUALITY_METRICS: QualityMetrics; declare const SUPPORTED_INTERACTION_TYPES: readonly ["choice", "input", "click", "drag", "quiz", "simulation", "mini-game", "gesture", "voice", "custom"]; declare const SUPPORTED_MEDIA_TYPES: readonly ["image", "video", "audio", "animation", "interactive", "3d-model", "particle-system"]; declare const SUPPORTED_GAME_CATEGORIES: readonly ["narrative", "simulation", "puzzle", "rpg", "quiz", "adventure", "strategy", "arcade", "educational", "sandbox", "platformer", "action"]; declare const SUPPORTED_CONTENT_TYPES: readonly ["text", "markdown", "html", "video", "audio", "image", "interactive", "simulation", "assessment"]; declare const SUPPORTED_DIFFICULTY_LEVELS: readonly ["easy", "medium", "hard", "expert"]; declare const SUPPORTED_TARGET_AUDIENCES: readonly ["beginner", "intermediate", "advanced", "expert"]; declare const SUPPORTED_ASSET_TYPES: readonly ["image", "audio", "video", "font", "texture", "3d-model", "animation", "shader", "data", "script", "style", "manifest"]; declare const SUPPORTED_PLATFORMS: readonly ["web", "mobile", "desktop", "console", "vr", "ar"]; declare const SUPPORTED_INPUT_METHODS: readonly ["keyboard", "mouse", "touch", "gamepad", "voice", "gesture", "eye-tracking", "motion-controller"]; declare const QUALITY_THRESHOLDS: { readonly POOR: 0.3; readonly FAIR: 0.5; readonly GOOD: 0.7; readonly EXCELLENT: 0.9; }; declare const PERFORMANCE_TARGETS: { readonly LOADING_TIME_MS: 3000; readonly MEMORY_USAGE_MB: 100; readonly FRAME_RATE_FPS: 60; readonly ASSET_SIZE_LIMIT_MB: 50; }; declare const ACCESSIBILITY_LEVELS: readonly ["WCAG-2.1-A", "WCAG-2.1-AA", "WCAG-2.1-AAA", "Section-508", "EN-301-549"]; declare const EASING_FUNCTIONS: readonly ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "cubic-bezier", "spring", "bounce"]; declare const ANIMATION_TYPES: readonly ["fade", "slide", "zoom", "flip", "dissolve", "wipe", "custom"]; declare const CONTENT_RATING_ORGANIZATIONS: readonly ["ESRB", "PEGI", "CERO", "USK", "OFLC", "custom"]; declare function isGameTypeConfig(obj: unknown): obj is GameTypeConfig; declare function isGenerationContext(obj: unknown): obj is GenerationContext; declare function isGameOutline(obj: unknown): obj is GameOutline; declare function isGameScene(obj: unknown): obj is GameScene$1; declare function isLearningContent(obj: unknown): obj is LearningContent; declare function isValidationResult(obj: unknown): obj is ValidationResult; declare function isGameFlow(obj: unknown): obj is GameFlow; declare function isSceneInteraction(obj: unknown): obj is SceneInteraction; declare function isGameAsset(obj: unknown): obj is GameAsset; declare function isQualityMetrics(obj: unknown): obj is QualityMetrics; declare function createDefaultGameTypeConfig(id: string, name: string, category: GameCategory): GameTypeConfig; declare function createDefaultGenerationConstraints(overrides?: Partial<GenerationConstraints>): GenerationConstraints; declare function createDefaultUserPreferences(overrides?: Partial<UserPreferences>): UserPreferences; declare function isValidDifficultyLevel(level: string): level is DifficultyLevel; declare function isValidTargetAudience(audience: string): audience is TargetAudience; declare function isValidGameCategory(category: string): category is GameCategory; declare function isValidContentType(contentType: string): contentType is ContentType; declare function isValidAssetType(assetType: string): assetType is AssetType; declare function calculateOverallQualityScore(metrics: QualityMetrics): number; declare function getQualityTier(score: number): 'poor' | 'fair' | 'good' | 'excellent'; declare function estimateTotalPlayTime(scenes: GameScene$1[]): number; declare function countScenesByDifficulty(scenes: GameScene$1[]): Record<DifficultyLevel, number>; declare function calculateContentCoverage(learningContent: LearningContent, scenes: GameScene$1[]): number; declare function generateUniqueId(prefix?: string): string; declare function deepClone<T>(obj: T): T; declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T; declare function sanitizeId(input: string): string; declare function formatDuration(minutes: number): string; declare function calculateDifficultyProgression(scenes: GameScene$1[]): number; declare const INTERFACE_VERSION: "1.0.0"; declare const INTERFACE_LAST_UPDATED: "2025-01-25"; declare const INTERFACE_AUTHORS: readonly ["Game Development Community"]; declare const COMPATIBILITY_MATRIX: { readonly '1.0.0': { readonly backwardCompatible: readonly []; readonly forwardCompatible: readonly []; readonly breaking: readonly []; }; }; interface Vector2D { readonly x: number; readonly y: number; } interface Vector3D { readonly x: number; readonly y: number; readonly z: number; } interface Vector4D { readonly x: number; readonly y: number; readonly z: number; readonly w: number; } interface Size2D { readonly width: number; readonly height: number; } interface Size3D { readonly width: number; readonly height: number; readonly depth: number; } interface Rectangle { readonly x: number; readonly y: number; readonly width: number; readonly height: number; } interface Circle { readonly center: Vector2D; readonly radius: number; } interface Ellipse { readonly center: Vector2D; readonly radiusX: number; readonly radiusY: number; } interface BoundingBox2D { readonly min: Vector2D; readonly max: Vector2D; } interface BoundingBox3D { readonly min: Vector3D; readonly max: Vector3D; } interface OrientedBoundingBox { readonly center: Vector2D; readonly size: Size2D; readonly rotation: number; } interface BoundingSphere { readonly center: Vector3D; readonly radius: number; } interface Rotation2D { readonly angle: number; } interface Rotation3D { readonly x: number; readonly y: number; readonly z: number; readonly order?: RotationOrder; } interface Quaternion { readonly x: number; readonly y: number; readonly z: number; readonly w: number; } interface Scale2D { readonly x: number; readonly y: number; } interface Scale3D { readonly x: number; readonly y: number; readonly z: number; } interface Transform2D { readonly position: Vector2D; readonly rotation: Rotation2D; readonly scale: Scale2D; } interface Transform3D { readonly position: Vector3D; readonly rotation: Rotation3D | Quaternion; readonly scale: Scale3D; } interface Anchor { readonly x: number; readonly y: number; } type AnchorPreset = 'top-left' | 'top-center' | 'top-right' | 'middle-left' | 'middle-center' | 'middle-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'; interface Pivot { readonly point: Vector2D; readonly anchor: Anchor; } type CardinalDirection = 'north' | 'south' | 'east' | 'west'; type IntermediateDirection = 'northeast' | 'northwest' | 'southeast' | 'southwest'; type CompassDirection = CardinalDirection | IntermediateDirection; type MovementDirection = 'up' | 'down' | 'left' | 'right' | 'forward' | 'back'; type MovementDirection3D = MovementDirection | 'in' | 'out'; type RotationOrder = 'XYZ' | 'XZY' | 'YXZ' | 'YZX' | 'ZXY' | 'ZYX'; interface Viewport { readonly x: number; readonly y: number; readonly width: number; readonly height: number; } interface CameraBounds2D { readonly bounds: BoundingBox2D; readonly zoom: number; readonly rotation?: number; } interface CameraFrustum { readonly left: number; readonly right: number; readonly top: number; readonly bottom: number; readonly near: number; readonly far: number; } interface PerspectiveCamera { readonly position: Vector3D; readonly target: Vector3D; readonly up: Vector3D; readonly fov: number; readonly aspect: number; readonly near: number; readonly far: number; } interface OrthographicCamera { readonly position: Vector3D; readonly target: Vector3D; readonly up: Vector3D; readonly left: number; readonly right: number; readonly top: number; readonly bottom: number; readonly near: number; readonly far: number; } interface GridCoordinate { readonly row: number; readonly column: number; } interface GridSize { readonly rows: number; readonly columns: number; } interface GridConfig { readonly cellSize: Size2D; readonly gridSize: GridSize; readonly origin: Vector2D; readonly spacing?: Vector2D; } interface HexCoordinate { readonly q: number; readonly r: number; } interface IsometricCoordinate { readonly isoX: number; readonly isoY: number; readonly cartX: number; readonly cartY: number; } type SpatialRelationship = 'intersects' | 'contains' | 'contained-by' | 'overlaps' | 'adjacent' | 'separate'; interface Distance { readonly value: number; readonly unit?: 'pixels' | 'meters' | 'units' | 'grid-cells'; } interface Ray2D { readonly origin: Vector2D; readonly direction: Vector2D; } interface Ray3D { readonly origin: Vector3D; readonly direction: Vector3D; } interface LineSegment2D { readonly start: Vector2D; readonly end: Vector2D; } interface LineSegment3D { readonly start: Vector3D; readonly end: Vector3D; } interface Keyframe<T> { readonly time: number; readonly value: T; readonly easing?: EasingFunction; } interface PathPoint { readonly position: Vector2D; readonly tangent?: Vector2D; readonly time?: number; } interface BezierCurve2D { readonly start: Vector2D; readonly controlPoint1: Vector2D; readonly controlPoint2: Vector2D; readonly end: Vector2D; } interface SplineCurve2D { readonly points: readonly Vector2D[]; readonly tension?: number; readonly closed?: boolean; } declare const ZERO_VECTOR_2D: Vector2D; declare const ZERO_VECTOR_3D: Vector3D; declare const UNIT_VECTOR_2D_X: Vector2D; declare const UNIT_VECTOR_2D_Y: Vector2D; declare const UNIT_VECTOR_3D_X: Vector3D; declare const UNIT_VECTOR_3D_Y: Vector3D; declare const UNIT_VECTOR_3D_Z: Vector3D; declare const ORIGIN_2D: Vector2D; declare const ORIGIN_3D: Vector3D; declare const IDENTITY_TRANSFORM_2D: Transform2D; declare const IDENTITY_TRANSFORM_3D: Transform3D; declare const IDENTITY_QUATERNION: Quaternion; declare const ANCHOR_PRESETS: Record<AnchorPreset, Anchor>; declare const DIRECTION_VECTORS_2D: Record<MovementDirection, Vector2D>; declare const DIRECTION_VECTORS_3D: Record<MovementDirection3D, Vector3D>; declare const ANGLES: { readonly DEGREES_TO_RADIANS: number; readonly RADIANS_TO_DEGREES: number; readonly PI: number; readonly TWO_PI: number; readonly HALF_PI: number; readonly QUARTER_PI: number; }; declare function isVector2D(obj: unknown): obj is Vector2D; declare function isVector3D(obj: unknown): obj is Vector3D; declare function isRectangle(obj: unknown): obj is Rectangle; declare function isTransform2D(obj: unknown): obj is Transform2D; declare function isBoundingBox2D(obj: unknown): obj is BoundingBox2D; type CoordinateType<T> = T extends { position: infer P; } ? P : never; type MutableVector2D = { -readonly [K in keyof Vector2D]: Vector2D[K]; }; type MutableVector3D = { -readonly [K in keyof Vector3D]: Vector3D[K]; }; type CoordinateSystem = '2d' | '3d' | 'isometric' | 'hex'; type MeasurementUnit = 'pixels' | 'meters' | 'units' | 'grid-cells' | 'inches' | 'centimeters'; declare const COORDINATES_VERSION: "1.0.0"; declare const COORDINATES_LAST_UPDATED: "2025-01-25"; type Direction