UNPKG

carverjs

Version:

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

1,250 lines (1,248 loc) 103 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 { readonly id: string; readonly name: string; readonly description: string; readonly category: GameCategory; readonly minScenes: number; readonly maxScenes: number; readonly requiredElements: readonly string[]; readonly optionalElements: readonly string[]; readonly supportedAudiences: readonly TargetAudience[]; readonly estimatedTimePerScene: number; readonly minContentLength?: number; readonly supportedContentTypes?: readonly ContentType[]; readonly version?: string; readonly author?: string; readonly customOptions?: Record<string, unknown>; } interface LearningContent { readonly contentId: string; readonly title: string; readonly description: string; readonly modules: readonly ModuleContent[]; readonly chunks: readonly ContentChunk[]; readonly metadata?: Record<string, unknown>; } interface ModuleContent { readonly id: string; readonly title: string; readonly content: string; readonly order: number; readonly keyPoints: readonly string[]; readonly estimatedTime?: number; readonly difficulty?: DifficultyLevel; readonly contentType?: ContentType; readonly metadata?: Record<string, unknown>; } interface ContentChunk { readonly id: string; readonly moduleId: string; readonly content: string; readonly similarity?: number; readonly tokenCount?: number; readonly contentType?: ContentType; readonly metadata?: Record<string, unknown>; } interface ProcessedContent { readonly keyConcepts: readonly KeyConcept[]; readonly learningObjectives: readonly string[]; readonly assessmentPoints: readonly AssessmentPoint[]; readonly narrativeElements: readonly NarrativeElement[]; readonly gameMechanics: readonly GameMechanic[]; readonly complexity?: ContentComplexity; readonly processingMetadata?: Record<string, unknown>; } interface KeyConcept { readonly id: string; readonly title: string; readonly description: string; readonly importance: number; readonly prerequisites: readonly string[]; readonly relatedConcepts: readonly string[]; readonly examples?: readonly string[]; readonly gameRepresentation?: GameElementSuggestion; readonly metadata?: Record<string, unknown>; } interface AssessmentPoint { readonly id: string; readonly conceptId: string; readonly question: string; readonly type: 'multiple-choice' | 'scenario' | 'open-ended' | 'simulation' | 'drag-drop' | 'mini-game'; readonly difficulty: DifficultyLevel; readonly correctAnswer?: unknown; readonly options?: readonly AssessmentOption[]; readonly explanation?: string; readonly metadata?: Record<string, unknown>; } interface AssessmentOption { readonly id: string; readonly label: string; readonly value: unknown; readonly isCorrect: boolean; readonly feedback?: string; } interface NarrativeElement { readonly type: 'character' | 'setting' | 'conflict' | 'theme' | 'plot-point' | 'dialogue' | 'description'; readonly content: string; readonly scenes: readonly string[]; readonly importance?: number; readonly metadata?: Record<string, unknown>; } interface GameMechanic { readonly type: 'collection' | 'puzzle' | 'combat' | 'exploration' | 'crafting' | 'trading' | 'building' | 'racing'; readonly description: string; readonly relatedConcepts: readonly string[]; readonly complexity: number; readonly parameters?: Record<string, unknown>; } interface GameElementSuggestion { readonly elementType: 'character' | 'item' | 'location' | 'mechanic' | 'quest' | 'puzzle'; readonly visualStyle?: string; readonly interactions?: readonly string[]; readonly implementation?: string; } interface ContentComplexity { readonly overallScore: number; readonly vocabularyLevel: DifficultyLevel; readonly conceptDensity: number; readonly prerequisiteComplexity: number; readonly recommendedAudience: TargetAudience; readonly suggestedGameComplexity: DifficultyLevel; } interface GenerationContext { readonly contentId: string; readonly learningContent: LearningContent; readonly gameType: string; readonly targetAudience: TargetAudience; readonly customOptions: Record<string, unknown>; readonly aiModel: string; readonly constraints: GenerationConstraints; readonly processedContent?: ProcessedContent; readonly userPreferences?: UserPreferences; readonly metadata?: Record<string, unknown>; } interface GenerationConstraints { readonly maxScenes: number; readonly maxPlayTime: number; readonly mustIncludeAssessments: boolean; readonly allowBranching: boolean; readonly difficultyProgression: 'linear' | 'adaptive' | 'player-choice' | 'random'; readonly contentComplexity: 'simple' | 'moderate' | 'complex'; readonly maxTokensPerRequest?: number; readonly generationTimeLimit?: number; readonly platformConstraints?: PlatformConstraints; readonly customConstraints?: Record<string, unknown>; } interface PlatformConstraints { readonly platform: 'web' | 'mobile' | 'desktop' | 'console' | 'vr' | 'ar'; readonly screenSize?: Size2D; readonly performance?: PerformanceConstraints; readonly inputMethods?: readonly InputMethod[]; readonly accessibility?: AccessibilityRequirements; } interface PerformanceConstraints { readonly maxMemoryMB?: number; readonly targetFPS?: number; readonly maxAssetSizeMB?: number; readonly networkConstraints?: NetworkConstraints; } interface NetworkConstraints { readonly offlineRequired: boolean; readonly maxDownloadSizeMB?: number; readonly streamingSupport?: boolean; } type InputMethod = 'keyboard' | 'mouse' | 'touch' | 'gamepad' | 'voice' | 'gesture' | 'eye-tracking' | 'motion-controller'; interface UserPreferences { readonly learningStyle?: 'visual' | 'auditory' | 'kinesthetic' | 'reading' | 'mixed'; readonly pace?: 'slow' | 'moderate' | 'fast' | 'variable'; readonly tone?: 'formal' | 'casual' | 'humorous' | 'serious' | 'dramatic'; readonly visualStyle?: VisualStylePreferences; readonly audioPreferences?: AudioPreferences; readonly accessibility?: AccessibilityRequirements; readonly language?: string; readonly custom?: Record<string, unknown>; } interface VisualStylePreferences { readonly colorScheme?: 'light' | 'dark' | 'high-contrast' | 'custom'; readonly artStyle?: 'realistic' | 'cartoon' | 'pixel-art' | 'minimalist' | 'abstract'; readonly animations?: 'full' | 'reduced' | 'none'; readonly uiComplexity?: 'simple' | 'standard' | 'advanced'; } interface AudioPreferences { readonly backgroundMusic?: boolean; readonly soundEffects?: boolean; readonly voiceNarration?: boolean; readonly audioDescriptions?: boolean; readonly volumePreferences?: VolumePreferences; } interface VolumePreferences { readonly master?: number; readonly music?: number; readonly effects?: number; readonly voice?: number; } interface AccessibilityRequirements { readonly highContrast?: boolean; readonly largeText?: boolean; readonly screenReader?: boolean; readonly reducedMotion?: boolean; readonly colorBlindSupport?: boolean; readonly subtitles?: boolean; readonly keyboardNavigation?: boolean; readonly voiceControl?: boolean; readonly motorAccessibility?: MotorAccessibilityOptions; } interface MotorAccessibilityOptions { readonly holdDuration?: number; readonly clickTolerance?: number; readonly dragThreshold?: number; readonly alternativeInputs?: readonly InputMethod[]; } interface GameOutline { readonly id: string; readonly gameType: string; readonly title: string; readonly description: string; readonly scenes: readonly NarrativeScene[]; readonly flow: GameFlow; readonly metadata: GameMetadata; readonly assets?: readonly GameAsset[]; } interface NarrativeScene { readonly id: string; readonly type: string; readonly title: string; readonly description: string; readonly content: SceneContent; readonly interactions: readonly SceneInteraction[]; readonly transitions: readonly SceneTransition$1[]; readonly actions?: readonly SceneActionChoice$1[]; readonly layout?: SceneLayout; readonly metadata: SceneMetadata; } interface SceneContent { readonly text: string; readonly contentType?: ContentType; readonly media?: readonly MediaElement[]; readonly data?: Record<string, unknown>; readonly styling?: StylingOptions; readonly localization?: LocalizationData; } interface SceneLayout { readonly type: 'grid' | 'free-form' | 'flow' | 'layers' | 'isometric'; readonly dimensions: Size2D; readonly gridConfig?: GridLayoutConfig; readonly layers?: readonly LayerConfig[]; readonly camera?: CameraConfig; readonly background?: BackgroundConfig; } interface GridLayoutConfig { readonly cellSize: Size2D; readonly gridSize: { rows: number; columns: number; }; readonly origin: Vector2D; readonly spacing?: Vector2D; } interface LayerConfig { readonly id: string; readonly name: string; readonly zIndex: number; readonly visible: boolean; readonly opacity?: number; readonly blendMode?: BlendMode; } type BlendMode = 'normal' | 'multiply' | 'screen' | 'overlay' | 'soft-light' | 'hard-light' | 'color-dodge' | 'color-burn' | 'darken' | 'lighten' | 'difference' | 'exclusion'; interface CameraConfig { readonly position: Vector2D | Vector3D; readonly type: '2d' | '3d-perspective' | '3d-orthographic' | 'isometric'; readonly fov?: number; readonly zoom?: number; readonly bounds?: BoundingBox2D; readonly constraints?: CameraConstraints; } interface CameraConstraints { readonly minZoom?: number; readonly maxZoom?: number; readonly movementBounds?: BoundingBox2D; readonly followTarget?: string; readonly smoothFollow?: boolean; } interface BackgroundConfig { readonly type: 'color' | 'image' | 'gradient' | 'pattern' | 'video' | 'animated'; readonly value: string; readonly properties?: BackgroundProperties; } interface BackgroundProperties { readonly repeat?: 'no-repeat' | 'repeat' | 'repeat-x' | 'repeat-y'; readonly position?: string; readonly size?: string; readonly attachment?: 'scroll' | 'fixed' | 'local'; readonly parallax?: boolean; readonly parallaxSpeed?: number; } interface SceneInteraction { readonly id: string; readonly type: 'choice' | 'input' | 'click' | 'drag' | 'quiz' | 'simulation' | 'mini-game' | 'gesture' | 'voice'; readonly prompt: string; readonly position?: Vector2D; readonly bounds?: BoundingBox2D | Circle; readonly options?: readonly InteractionOption[]; readonly validation?: readonly ValidationRule[]; readonly config?: InteractionConfig; readonly visual?: InteractionVisual; readonly metadata?: Record<string, unknown>; } interface InteractionOption { readonly id: string; readonly label: string; readonly value: unknown; readonly effect?: string; readonly feedback?: string; readonly isCorrect?: boolean; readonly nextState?: string; readonly styling?: StylingOptions; readonly metadata?: Record<string, unknown>; } interface ValidationRule { readonly type: 'required' | 'format' | 'range' | 'length' | 'pattern' | 'custom'; readonly params: Record<string, unknown>; readonly message: string; readonly validator?: (value: unknown) => boolean; } interface InteractionConfig { readonly timeout?: number; readonly retries?: number; readonly hints?: readonly string[]; readonly scoring?: ScoringConfig; readonly animation?: AnimationConfig; readonly audio?: AudioConfig; } interface ScoringConfig { readonly correctPoints: number; readonly incorrectPenalty?: number; readonly timeBonusMultiplier?: number; readonly streakBonus?: number; } interface InteractionVisual { readonly type: 'button' | 'hotspot' | 'overlay' | 'inline' | 'popup' | 'widget'; readonly styling?: StylingOptions; readonly icon?: string; readonly states?: readonly VisualState[]; readonly animations?: readonly AnimationDefinition[]; } interface VisualState { readonly name: 'default' | 'hover' | 'active' | 'disabled' | 'selected' | 'error' | 'success'; readonly styling: StylingOptions; readonly animation?: AnimationDefinition; } interface SceneTransition$1 { readonly toSceneId: string; readonly condition?: TransitionCondition; readonly animation?: TransitionAnimation; readonly delay?: number; readonly metadata?: Record<string, unknown>; } interface SceneActionChoice$1 { readonly id: string; readonly label: string; readonly description?: string; readonly nextSceneId?: string; readonly rewards?: SceneActionReward$1; readonly metadata?: Record<string, unknown>; readonly condition?: (state: unknown) => boolean; } interface SceneActionReward$1 { readonly score?: number; readonly health?: number; readonly items?: readonly string[]; readonly metadata?: Record<string, unknown>; } interface TransitionCondition { readonly type: 'always' | 'if' | 'score' | 'time' | 'interaction' | 'completion' | 'custom'; readonly params: Record<string, unknown>; readonly evaluator?: (context: unknown) => boolean; } interface TransitionAnimation { readonly type: 'fade' | 'slide' | 'zoom' | 'flip' | 'dissolve' | 'wipe' | 'custom'; readonly duration: number; readonly easing?: EasingFunction; readonly direction?: 'in' | 'out' | 'in-out'; readonly params?: Record<string, unknown>; } type EasingFunction = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'cubic-bezier' | 'spring' | 'bounce'; interface MediaElement { readonly id: string; readonly type: 'image' | 'video' | 'audio' | 'animation' | 'interactive' | '3d-model' | 'particle-system'; readonly url?: string; readonly prompt?: string; readonly alt?: string; readonly caption?: string; readonly dimensions?: Size2D; readonly position?: Vector2D; readonly transform?: Transform2D; readonly properties?: MediaProperties; readonly metadata?: Record<string, unknown>; } interface MediaProperties { readonly autoplay?: boolean; readonly loop?: boolean; readonly muted?: boolean; readonly volume?: number; readonly playbackRate?: number; readonly preload?: 'none' | 'metadata' | 'auto'; readonly quality?: QualitySettings; } interface QualitySettings { readonly resolution?: Size2D; readonly compression?: number; readonly formats?: readonly string[]; readonly adaptive?: boolean; } interface StylingOptions { readonly colorScheme?: 'light' | 'dark' | 'auto' | 'custom'; readonly fontFamily?: string; readonly fontSize?: string | number; readonly fontWeight?: 'normal' | 'bold' | 'lighter' | 'bolder' | number; readonly color?: string; readonly backgroundColor?: string; readonly border?: BorderStyle; readonly spacing?: SpacingStyle; readonly layout?: 'standard' | 'card' | 'fullscreen' | 'overlay' | 'inline'; readonly shadow?: ShadowStyle; readonly customClasses?: readonly string[]; readonly customStyles?: Record<string, string>; } interface BorderStyle { readonly width?: string | number; readonly style?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset'; readonly color?: string; readonly radius?: string | number; } interface SpacingStyle { readonly margin?: string | number; readonly padding?: string | number; readonly gap?: string | number; } interface ShadowStyle { readonly offsetX?: number; readonly offsetY?: number; readonly blur?: number; readonly spread?: number; readonly color?: string; readonly inset?: boolean; } interface AnimationConfig { readonly enabled: boolean; readonly defaultDuration?: number; readonly defaultEasing?: EasingFunction; readonly respectReducedMotion?: boolean; } interface AnimationDefinition { readonly name: string; readonly type: 'css' | 'javascript' | 'lottie' | 'spine' | 'custom'; readonly data: unknown; readonly duration?: number; readonly easing?: EasingFunction; readonly delay?: number; readonly iterations?: number | 'infinite'; readonly direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse'; } interface AudioConfig { readonly backgroundMusic?: AudioTrack; readonly soundEffects?: readonly AudioTrack[]; readonly narration?: AudioTrack; readonly ambient?: readonly AudioTrack[]; readonly settings?: AudioSettings; } interface AudioTrack { readonly id: string; readonly url: string; readonly name?: string; readonly volume?: number; readonly loop?: boolean; readonly fadeIn?: number; readonly fadeOut?: number; readonly metadata?: Record<string, unknown>; } interface AudioSettings { readonly masterVolume?: number; readonly musicVolume?: number; readonly effectsVolume?: number; readonly voiceVolume?: number; readonly spatialAudio?: boolean; readonly quality?: 'low' | 'medium' | 'high'; } interface LocalizationData { readonly defaultLanguage: string; readonly availableLanguages: readonly string[]; readonly localizedContent: Record<string, LocalizedContent>; } interface LocalizedContent { readonly language: string; readonly text: string; readonly media?: Record<string, string>; readonly interactions?: Record<string, string>; readonly custom?: Record<string, unknown>; } interface SceneMetadata { readonly estimatedDuration: number; readonly difficulty: DifficultyLevel; readonly learningObjectives: readonly string[]; readonly prerequisites: readonly string[]; readonly tags: readonly string[]; readonly relatedChunks?: readonly string[]; readonly assessmentWeight?: number; readonly replayable?: boolean; readonly accessibilityFeatures?: readonly string[]; readonly performanceNotes?: readonly string[]; readonly custom?: Record<string, unknown>; } interface GameFlow { readonly startSceneId: string; readonly endSceneIds: readonly string[]; readonly paths: readonly FlowPath[]; readonly breakpoints: readonly Breakpoint[]; readonly continuityElements: readonly ContinuityElement[]; readonly validation?: FlowValidation; readonly optimization?: FlowOptimization; } interface FlowPath { readonly id: string; readonly name: string; readonly sceneIds: readonly string[]; readonly conditions?: readonly PathCondition[]; readonly weight: number; readonly difficulty?: DifficultyLevel; readonly estimatedTime?: number; readonly metadata?: Record<string, unknown>; } interface Breakpoint { readonly id: string; readonly sceneId: string; readonly type: 'save-point' | 'chapter-end' | 'decision-point' | 'assessment' | 'reflection' | 'milestone' | 'checkpoint'; readonly title: string; readonly description: string; readonly allowPause: boolean; readonly showProgress: boolean; readonly estimatedTimeToReach?: number; readonly saveData?: SaveData; readonly metadata?: Record<string, unknown>; } interface SaveData { readonly id: string; readonly timestamp: Date; readonly progress: PlayerProgress; readonly gameState: Record<string, unknown>; readonly statistics?: PlayerStatistics; } interface PlayerProgress { readonly currentSceneId: string; readonly completedScenes: readonly string[]; readonly unlockedScenes: readonly string[]; readonly progressPercentage: number; readonly achievements?: readonly Achievement[]; readonly choices?: readonly PlayerChoice[]; } interface PlayerStatistics { readonly totalPlayTime: number; readonly sessionCount: number; readonly averageSessionTime: number; readonly correctAnswersPercentage?: number; readonly hintsUsed?: number; readonly custom?: Record<string, number>; } interface Achievement { readonly id: string; readonly name: string; readonly description: string; readonly icon?: string; readonly points?: number; readonly rarity?: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'; readonly unlockCondition: AchievementCondition; } interface AchievementCondition { readonly type: 'complete-scene' | 'complete-path' | 'score-threshold' | 'time-limit' | 'perfect-score' | 'custom'; readonly params: Record<string, unknown>; readonly evaluator?: (progress: PlayerProgress, statistics: PlayerStatistics) => boolean; } interface PlayerChoice { readonly sceneId: string; readonly interactionId: string; readonly choice: unknown; readonly timestamp: Date; readonly consequences?: readonly string[]; } interface ContinuityElement { readonly type: 'narrative-thread' | 'character-arc' | 'knowledge-building' | 'skill-progression' | 'theme-consistency' | 'difficulty-curve'; readonly description: string; readonly affectedScenes: readonly string[]; readonly strength: number; readonly implementation?: string; readonly validationRules?: readonly ContinuityRule[]; readonly metadata?: Record<string, unknown>; } interface ContinuityRule { readonly type: 'prerequisite' | 'sequence' | 'dependency' | 'consistency'; readonly description: string; readonly params: Record<string, unknown>; readonly validator?: (scenes: readonly NarrativeScene[]) => boolean; } interface PathCondition { readonly type: 'score' | 'choice' | 'completion' | 'time' | 'skill-level' | 'random' | 'adaptive' | 'custom'; readonly operator?: '>' | '<' | '=' | '!=' | '>=' | '<='; readonly value?: unknown; readonly weight?: number; readonly evaluator?: (context: unknown) => boolean; readonly metadata?: Record<string, unknown>; } interface FlowValidation { readonly isValid: boolean; readonly errors: readonly string[]; readonly warnings: readonly string[]; readonly statistics?: FlowStatistics; readonly suggestions?: readonly string[]; } interface FlowStatistics { readonly totalScenes: number; readonly decisionPoints: number; readonly pathCount: number; readonly averagePathLength: number; readonly complexityScore: number; readonly reachabilityAnalysis: ReachabilityAnalysis; readonly difficultyDistribution: Record<DifficultyLevel, number>; } interface ReachabilityAnalysis { readonly reachableScenes: readonly string[]; readonly unreachableScenes: readonly string[]; readonly deadEndScenes: readonly string[]; readonly criticalPathScenes: readonly string[]; readonly optionalPathScenes: readonly string[]; } interface FlowOptimization { readonly algorithm: string; readonly score: number; readonly suggestions: readonly OptimizationSuggestion[]; readonly performanceMetrics?: PerformanceMetrics; } interface OptimizationSuggestion { readonly type: 'reorder-scenes' | 'add-transition' | 'remove-redundancy' | 'balance-difficulty' | 'improve-pacing'; readonly description: string; readonly impact: number; readonly complexity: 'low' | 'medium' | 'high'; readonly affectedScenes?: readonly string[]; } interface PerformanceMetrics { readonly completionTimeRange: { min: number; max: number; average: number; }; readonly engagementPrediction: number; readonly difficultyCurveAnalysis: DifficultyAnalysis; readonly retentionProbability: number; } interface DifficultyAnalysis { readonly progressionType: 'linear' | 'exponential' | 'logarithmic' | 'stepped' | 'irregular'; readonly spikes: readonly DifficultySpike[]; readonly recommendedAdjustments: readonly string[]; } interface DifficultySpike { readonly sceneId: string; readonly severity: number; readonly type: 'sudden-increase' | 'sustained-high' | 'unexpected-drop'; readonly mitigation?: string; } interface GameAsset { readonly id: string; readonly name: string; readonly type: AssetType; readonly url: string; readonly size?: number; readonly dimensions?: Size2D; readonly format?: string; readonly priority?: 'low' | 'medium' | 'high' | 'critical'; readonly preload?: 'none' | 'metadata' | 'auto'; readonly dependencies?: readonly string[]; readonly metadata?: Record<string, unknown>; } type AssetType = 'image' | 'audio' | 'video' | 'font' | 'texture' | '3d-model' | 'animation' | 'shader' | 'data' | 'script' | 'style' | 'manifest'; interface GameMetadata { readonly createdAt: Date; readonly modifiedAt?: Date; readonly version: string; readonly targetAudience: TargetAudience; readonly estimatedPlayTime: number; readonly educationalGoals?: readonly string[]; readonly genre: GameCategory; readonly contentRating?: ContentRating; readonly platformCompatibility: readonly string[]; readonly accessibilityCompliance?: readonly AccessibilityStandard[]; readonly aiModel?: string; readonly generationParams?: Record<string, unknown>; readonly qualityMetrics?: QualityMetrics; readonly localizationSupport?: readonly string[]; readonly custom?: Record<string, unknown>; } interface ContentRating { readonly organization: 'ESRB' | 'PEGI' | 'CERO' | 'USK' | 'OFLC' | 'custom'; readonly rating: string; readonly descriptors?: readonly string[]; readonly ageRecommendation?: number; } type AccessibilityStandard = 'WCAG-2.1-A' | 'WCAG-2.1-AA' | 'WCAG-2.1-AAA' | 'Section-508' | 'EN-301-549'; interface QualityMetrics { readonly contentCoverage: number; readonly engagementScore: number; readonly educationalEffectiveness: number; readonly flowCoherence: number; readonly technicalQuality: number; readonly accessibilityScore: number; readonly overallScore: number; readonly analysisDetails?: QualityAnalysisDetails; } interface QualityAnalysisDetails { readonly contentAnalysis: ContentQualityAnalysis; readonly technicalAnalysis: TechnicalQualityAnalysis; readonly uxAnalysis: UXQualityAnalysis; readonly performanceAnalysis: PerformanceQualityAnalysis; } interface ContentQualityAnalysis { readonly narrativeCoherence: number; readonly educationalAlignment: number; readonly contentDepth: number; readonly languageQuality: number; readonly issues: readonly ContentIssue[]; } interface TechnicalQualityAnalysis { readonly performance: number; readonly compatibility: number; readonly assetOptimization: number; readonly codeQuality: number; readonly issues: readonly TechnicalIssue[]; } interface UXQualityAnalysis { readonly usability: number; readonly navigationClarity: number; readonly visualDesign: number; readonly interactionDesign: number; readonly issues: readonly UXIssue[]; } interface PerformanceQualityAnalysis { readonly loadingTime: number; readonly memoryUsage: number; readonly renderingPerformance: number; readonly networkEfficiency: number; readonly issues: readonly PerformanceIssue[]; } interface ContentIssue { readonly type: 'grammatical' | 'factual' | 'inconsistency' | 'inappropriate' | 'unclear'; readonly severity: IssueSeverity; readonly description: string; readonly location?: string; readonly suggestedFix?: string; } interface TechnicalIssue { readonly type: 'compatibility' | 'performance' | 'security' | 'accessibility' | 'standards'; readonly severity: IssueSeverity; readonly description: string; readonly affectedComponents?: readonly string[]; readonly suggestedFix?: string; } interface UXIssue { readonly type: 'navigation' | 'visual' | 'interaction' | 'feedback' | 'accessibility'; readonly severity: IssueSeverity; readonly description: string; readonly userImpact?: string; readonly suggestedImprovement?: string; } interface PerformanceIssue { readonly type: 'loading' | 'memory' | 'rendering' | 'network' | 'storage'; readonly severity: IssueSeverity; readonly description: string; readonly performanceImpact?: string; readonly 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?(): readonly string[]; getConfigurationSchema?(): Record<string, unknown>; previewContent?(context: GenerationContext): Promise<GamePreview>; } interface GamePreview { readonly id: string; readonly title: string; readonly description: string; readonly sceneSummaries: readonly SceneSummary[]; readonly estimatedGenerationTime: number; readonly qualityScore: number; readonly issues?: readonly string[]; } interface SceneSummary { readonly id: string; readonly title: string; readonly type: string; readonly summary: string; readonly estimatedDuration: number; } interface ISceneBuilder { buildScene(sceneConfig: SceneConfig, context: GenerationContext): Promise<NarrativeScene>; getSupportedSceneTypes(): readonly string[]; validateScene(scene: NarrativeScene): ValidationResult; enhanceScene?(scene: NarrativeScene, options: SceneEnhancementOptions): Promise<NarrativeScene>; getCapabilities?(): SceneBuilderCapabilities; buildScenes?(sceneConfigs: readonly SceneConfig[], context: GenerationContext): Promise<readonly NarrativeScene[]>; } interface IFlowDesigner { designFlow(scenes: readonly NarrativeScene[], strategy: FlowStrategy): Promise<GameFlow>; validateFlow(flow: GameFlow): ValidationResult; optimizeFlow(flow: GameFlow): Promise<GameFlow>; getCapabilities?(): FlowDesignerCapabilities; analyzeComplexity?(flow: GameFlow): FlowComplexityAnalysis; generateAlternativeFlows?(scenes: readonly NarrativeScene[], strategy: FlowStrategy, count: number): Promise<readonly GameFlow[]>; } interface IContentProcessor { processContent(content: LearningContent, gameType: string): Promise<ProcessedContent>; extractKeyConceptsStructure(content: LearningContent): Promise<readonly KeyConcept[]>; getSupportedContentTypes(): readonly ContentType[]; analyzeComplexity?(content: LearningContent): Promise<ContentComplexity>; extractAssessmentOpportunities?(content: LearningContent): Promise<readonly AssessmentPoint[]>; suggestGameMechanics?(content: LearningContent, gameType: string): Promise<readonly GameMechanic[]>; } interface SceneConfig { readonly id: string; readonly type: string; readonly title: string; readonly description: string; readonly gameType: string; readonly priority?: number; readonly contentRequirements?: ContentRequirements; readonly interactionRequirements?: InteractionRequirements; readonly visualRequirements?: VisualRequirements; readonly [key: string]: unknown; } interface ContentRequirements { readonly minLength?: number; readonly maxLength?: number; readonly requiredTypes?: readonly ContentType[]; readonly themes?: readonly string[]; readonly learningObjectives?: readonly string[]; } interface InteractionRequirements { readonly minInteractions?: number; readonly maxInteractions?: number; readonly requiredTypes?: readonly string[]; readonly requiresAssessment?: boolean; readonly requiresBranching?: boolean; } interface VisualRequirements { readonly requiredMedia?: readonly string[]; readonly visualStyle?: string; readonly accessibility?: readonly string[]; readonly platform?: readonly string[]; } interface EnhancementOptions { readonly addNarrativeHooks?: boolean; readonly optimizeForAudience?: TargetAudience; readonly ensureContinuity?: boolean; readonly addAssessments?: boolean; readonly includeAccessibility?: boolean; readonly addMultimedia?: boolean; readonly optimizePerformance?: boolean; readonly addLocalization?: boolean; readonly enhancementLevel?: 'basic' | 'standard' | 'advanced'; readonly custom?: Record<string, unknown>; } interface SceneEnhancementOptions { readonly addVisuals?: boolean; readonly enhanceInteractivity?: boolean; readonly addAudio?: boolean; readonly improveAccessibility?: boolean; readonly addAnimations?: boolean; readonly optimizeLayout?: boolean; readonly addProgressiveDisclosure?: boolean; readonly custom?: Record<string, unknown>; } interface FlowStrategy { readonly type: GameCategory; readonly allowBranching: boolean; readonly pattern?: 'linear' | 'branching' | 'hub-and-spoke' | 'open-world' | 'guided-exploration'; readonly pacing?: 'slow' | 'moderate' | 'fast' | 'variable' | 'adaptive'; readonly difficultyCurve?: 'flat' | 'rising' | 'peaks-and-valleys' | 'adaptive' | 'player-controlled'; readonly engagementStrategy?: 'narrative-driven' | 'challenge-based' | 'exploration-focused' | 'social-interaction'; readonly retryStrategy?: 'unlimited' | 'limited' | 'progressive-hints' | 'adaptive-difficulty'; readonly custom?: Record<string, unknown>; } interface ValidationResult { readonly isValid: boolean; readonly errors: readonly string[]; readonly warnings: readonly string[]; readonly score?: number; readonly suggestions?: readonly string[]; readonly context?: Record<string, unknown>; readonly metadata?: Record<string, unknown>; } interface SceneBuilderCapabilities { readonly supportedSceneTypes: readonly string[]; readonly supportedInteractions: readonly string[]; readonly supportedMedia: readonly string[]; readonly maxInteractionsPerScene: number; readonly supportsDynamicContent: boolean; readonly supportsAIEnhancement: boolean; readonly supportsBatchProcessing: boolean; readonly supportedComplexityLevels: readonly DifficultyLevel[]; readonly custom?: Record<string, unknown>; } interface FlowDesignerCapabilities { readonly supportedPatterns: readonly string[]; readonly maxPaths: number; readonly supportsAdaptiveDifficulty: boolean; readonly supportsDynamicBranching: boolean; readonly optimizationAlgorithms: readonly string[]; readonly supportsAlternativeGeneration: boolean; readonly maxAlternativeFlows?: number; readonly custom?: Record<string, unknown>; } interface FlowComplexityAnalysis { readonly overallComplexity: number; readonly branchingComplexity: number; readonly pathLengthVariance: number; readonly decisionPointDensity: number; readonly cognitiveLoad: number; readonly navigationComplexity: number; readonly contentComplexityDistribution: Record<DifficultyLevel, number>; readonly recommendations?: readonly string[]; readonly details?: Record<string, unknown>; } interface GameGenerationResult { readonly success: boolean; readonly outline?: GameOutline; readonly error?: string; readonly errorDetails?: ErrorDetails; readonly processingTime: number; readonly statistics?: GenerationStatistics; readonly qualityAssessment?: QualityAssessment; readonly metadata?: Record<string, unknown>; } interface ErrorDetails { readonly code: string; readonly category: 'input' | 'processing' | 'ai' | 'system' | 'timeout' | 'validation'; readonly context?: Record<string, unknown>; readonly stackTrace?: string; readonly recoverySuggestions?: readonly string[]; } interface GenerationStatistics { readonly totalScenes: number; readonly estimatedPlayTime: number; readonly gameType: string; readonly complexity: 'simple' | 'moderate' | 'complex'; readonly tokensConsumed?: number; readonly apiCalls?: number; readonly contentCoverage?: number; readonly efficiencyScore?: number; readonly assetStatistics?: AssetGenerationStatistics; readonly performanceStatistics?: PerformanceGenerationStatistics; } interface AssetGenerationStatistics { readonly totalAssets: number; readonly assetsByType: Record<AssetType, number>; readonly totalAssetSize: number; readonly averageGenerationTime: number; } interface PerformanceGenerationStatistics { readonly memoryUsage: MemoryUsageStatistics; readonly cpuUsage: number; readonly networkUsage: NetworkUsageStatistics; readonly bottlenecks: readonly PerformanceBottleneck[]; } interface MemoryUsageStatistics { readonly peak: number; readonly average: number; readonly growthRate: number; } interface NetworkUsageStatistics { readonly totalRequests: number; readonly totalDataTransferred: number; readonly averageRequestTime: number; readonly failedRequests: number; } interface PerformanceBottleneck { readonly type: 'cpu' | 'memory' | 'network' | 'ai' | 'disk'; readonly description: string; readonly impact: number; readonly optimizationSuggestions: readonly string[]; } interface QualityAssessment { readonly overallScore: number; readonly metrics: QualityMetrics; readonly issues?: readonly QualityIssue[]; readonly recommendations?: readonly string[]; readonly confidence?: number; readonly comparativeAnalysis?: ComparativeQualityAnalysis; } interface ComparativeQualityAnalysis { readonly similarGamesComparison: SimilarGamesComparison; readonly industryBenchmarks: IndustryBenchmarks; readonly bestPracticesCompliance: BestPracticesCompliance; } interface SimilarGamesComparison { readonly comparisonGames: readonly GameReference[]; readonly relativeQualityScore: number; readonly strengths: readonly string[]; readonly weaknesses: readonly string[]; } interface GameReference { readonly id: string; readonly name: string; readonly category: GameCategory; readonly qualityScore: number; readonly keyFeatures: readonly string[]; } interface IndustryBenchmarks { readonly industryAverageScore: number; readonly topTierThreshold: number; readonly qualityPercentile: number; readonly benchmarkCategories: Record<string, BenchmarkCategory>; } interface BenchmarkCategory { readonly name: string; readonly score: number; readonly industryAverage: number; readonly topPerformersAverage: number; } interface BestPracticesCompliance { readonly overallCompliance: number; readonly practiceAreas: readonly PracticeArea[]; readonly complianceGaps: readonly ComplianceGap[]; } interface PracticeArea { readonly name: string; readonly complianceScore: number; readonly practicesFollowed: readonly string[]; readonly practicesMissed: readonly string[]; } interface ComplianceGap { readonly area: string; readonly severity: IssueSeverity; readonly description: string; readonly qualityImpact: number; readonly remediationSteps: readonly string[]; } interface QualityIssue { readonly severity: IssueSeverity; readonly type: string; readonly category: 'content' | 'technical' | 'ux' | 'performance' | 'accessibility'; readonly description: string; readonly affectedScenes?: readonly string[]; readonly affectedComponents?: readonly string[]; readonly suggestedFix?: string; readonly fixComplexity?: 'low' | 'medium' | 'high'; readonly metadata?: Record<string, unknown>; } interface PluginConfig { readonly id: string; readonly name: string; readonly version: string; readonly type: PluginType; readonly description: string; readonly author: string; readonly requiredSystemVersion: string; readonly dependencies?: readonly PluginDependency[]; readonly permissions?: readonly PluginPermission[]; readonly configSchema?: Record<string, unknown>; readonly entryPoint: string; readonly assets?: readonly PluginAsset[]; readonly metadata?: Record<string, unknown>; } type PluginType = 'game-type' | 'scene-builder' | 'flow-designer' | 'content-processor' | 'enhancement' | 'asset-generator' | 'quality-analyzer' | 'export-format' | 'integration'; interface PluginDependency { readonly pluginId: string; readonly version: string; readonly optional?: boolean; readonly fallback?: PluginFallback; } interface PluginFallback { readonly type: 'disable-feature' | 'use-alternative' | 'graceful-degradation'; readonly description: string; readonly alternativePluginId?: string; } interface PluginPermission { readonly type: PermissionType; readonly description: string; readonly required: boolean; readonly scope?: string; readonly 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 { readonly id: string; readonly type: AssetType; readonly path: string; readonly description?: string; readonly size?: number; } interface ExtensionPoint { readonly id: string; readonly name: string; readonly description: string; readonly interface: string; readonly allowMultiple: boolean; readonly priority?: number; readonly version?: string; readonly 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> = { readonly [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 & { readonly __brand: B; }; type Nominal<T, N extends string> = T & { readonly __nominal: N; }; type GameGeneratorFactory = (config: GameTypeConfig) => IGameGenerator; type SceneBuilderFactory = (config: GameTypeConfig) => ISceneBuilder; type FlowDesignerFactory = (config: GameTypeConfig) => IFlowDesigner; type ContentProcessorFactory = (config: GameTypeConfig) => IContentProcessor; interface ComponentRegistry { readonly generators: Map<string, IGameGenerator>; readonly sceneBuilders: Map<string, ISceneBuilder>; readonly flowDesigners: Map<string, IFlowDesigner>; readonly contentProcessors: Map<string, IContentProcessor>; readonly gameTypeConfigs: Map<string, GameTypeConfig>; readonly plugins: Map<string, PluginConfig>; readonly extensionPoints: Map<string, ExtensionPoint>; } interface RegistrationOptions { readonly allowOverride?: boolean; readonly validationLevel?: 'strict' | 'moderate' | 'lenient'; readonly enableImmediately?: boolean; readonly priority?: number; readonly 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: NarrativeScene): GameOutlineBuilder; addScenes(scenes: readonly NarrativeScene[]): GameOutlineBuilder; setFlow(flow: GameFlow): GameOutlineBuilder; setMetadata(metadata: GameMetadata): GameOutlineBuilder; } interface SceneBuilderInterface extends Builder<NarrativeScene> { 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: readonly SceneInteraction[]): SceneBuilderInterface; addTransition(transition: SceneTransition$1): SceneBuilderInterface; addTransitions(transitions: readonly SceneTransition$1[]): SceneBuilderInterface; setLayout(layout: SceneLayout): SceneBuilderInterface; setMetadata(metadata: SceneMetadata): SceneBuilderInterface; } declare abstract class GameGenerationError extends Error { readonly code: string; readonly context?: Record<string, unknown>; readonly category: string; readonly 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 isNarrativeScene(obj: unknown): obj is NarrativeScene; 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;