RPG Event Generator - v5.0.0
    Preparing search index...

    Changelog

    All notable changes to this project will be documented in this file.

    The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

    • Zero runtime dependencies: Removed chance, compromise, and natural; all randomness and sentence helpers are built in
    • GeneratorOptions.chance renamed to GeneratorOptions.rng: Pass a SeededRandom instance for reproducible generation
    • Numeric seeds produce different output than v4: Same-seed reproducibility still holds within v5, but world/event output will not match v4 values
    • External Chance instances no longer supported: Use the exported SeededRandom class instead
    1. Replace chance: new Chance(seed) with rng: new SeededRandom(seed).
    2. Re-baseline tests or saved worlds that assumed v4 PRNG output (same numeric seed gives different results in v5).
    3. Remove chance, compromise, and natural from your app if you added them only for this package.

    See MIGRATION.md for code examples and a full checklist.

    • World building overhaul: Seeded generation via Chance, WorldGenerationOptions (continentCount, historyStartYear, currentYear), climate-aware resources, neighbor-biased faction relationships, varied landmark/faction/leader names, and template-based historical event descriptions
    • getWorldLore(location): One-line lore hook for matching regions (also on WorldBuildingSystem.getLoreSnippet)
    • TypeDoc guides: Eight markdown guides in typedoc-pages/ (getting started, custom content, event types, feature tiers, world building, templates & rules, configuration, advanced tooling) plus migration/changelog in the docs nav
    • Tests: test/world-building.test.js (19 tests) for world sim upgrades; integration tests for seed reproducibility, history persistence, and player weather modifiers
    • README: Shortened to quick start + tier summary; wiki replaced with in-repo TypeDoc guides
    • TypeDoc: projectDocuments and documents-first sort; homepage still from README.md; new Examples guide with copy-paste snippets by tier
    • demo.js: Replaced ~1,000-line feature tour with a short Tier 1 + world lore smoke script
    • GeneratorCore: Trimmed redundant JSDoc (behaviour unchanged)
    • generateWorld(): Honors seed for reproducible worlds; initial historical events persisted on the instance (getHistoricalEvents() after generateWorld())
    • Environmental modifiers: Use player weather, timeOfDay, and season instead of hardcoded clear / day; weather aliases (rainyrain, stormystorm, midnightnight)
    • generateEvent(): Null/undefined playerContext no longer throws when modifiers are enabled
    • Complete GeneratorCore Rebuild: Transformed from basic template system into robust, context-aware procedural content generator
    • Massive Content Expansion:
      • Titles: Expanded from 8 to 50+ unique titles per event type (17 types × 50 = 850+ titles)
      • Descriptions: Expanded from 5 to 30+ detailed descriptions per event type (17 types × 30 = 510+ descriptions)
      • Choices: Expanded from 4 generic to 30+ specific choices per event type (17 types × 30 = 510+ choices)
      • Total Content: 1,870+ unique narrative elements
    • Enhanced Thematic Consistency: Perfect choice-description matching with type-specific content
    • Contextual Enhancements: Dynamic prefixes for location, weather, time-of-day, class, and race
    • Content Variety: Proven 100% unique titles, 98% unique descriptions in 50-event batches
    • Grammar Quality: Maintained 95%+ grammar pass rate across all expanded content
    • Context Integration:
      • Location: 30% → 70% integration rate
      • Weather: 25% → 60% integration rate
      • Time of Day: 20% → 50% integration rate
      • Class/Race: 15% → 40% integration rate
    • Architecture: Simplified design with direct event type → content mapping (replaced default Markov chains with reliable content library; Markov chains still available via pureMarkovMode option)
    • Multi-Theme Support: Custom content retrieval now checks all available themes, not just 'default'
    • Event Type Coverage: Added MAGIC and SPELLCASTING to selectable event types
    • GeneratorCore Architecture: Complete rebuild from 408 to 2,041 lines with simplified, reliable design
    • Content Structure: Each event type now has uniquely themed, extensive content library
    • Choice Generation: Choices now perfectly align with event descriptions (e.g., scouting descriptions get military choices)
    • Generation Method: Default generation now uses direct content mapping instead of Markov chains for more reliable output (Markov chains remain available via pureMarkovMode option)
    • Context Integration Bug: Fixed addContextualEnhancements method to properly return modified descriptions
    • Multi-Theme Support: Fixed custom content retrieval to check all available themes
    • Test Coverage: Updated test files to include new event types in validation lists
    • Comprehensive GeneratorCore Tests: Added extensive test coverage for:
      • Context integration (location, weather, time, class, race)
      • Multi-theme support for custom content
      • Custom titles, descriptions, and choices usage
      • Event type coverage including MAGIC and SPELLCASTING
      • Context enhancement return value verification
    • Quality Assurance:
      • Uniqueness testing (1000+ events)
      • Grammar and coherence validation
      • Performance benchmarking
      • Backward compatibility verification
    • No Performance Degradation: Maintained generation speed despite 10x content increase
    • Infinite Potential: With 1000 events tested, maintained 87.5% description uniqueness
    • Scalability: Supports massive procedural worlds and campaigns
    • Context Integration Bug: Fixed addContextualEnhancements method to properly return modified descriptions with contextual phrases (location, weather, time, class, race)
    • Multi-Theme Support: Fixed custom content retrieval to check all available themes, not just 'default' theme
    • Event Type Coverage: Added MAGIC and SPELLCASTING to selectable event types (previously supported in descriptions/choices but not selectable)
    • Test Coverage: Updated test files to include new event types in validation lists
    • Context Integration Rates: Increased likelihood of context enhancements being added to descriptions:
      • Location: 30% → 70%
      • Weather: 25% → 60%
      • Time of Day: 20% → 50%
      • Class/Race: 15% → 40%
    • Custom Content Detection: Improved test detection logic to recognize all custom content emojis and patterns
    • Comprehensive GeneratorCore Tests: Added extensive test coverage for:
      • Context integration (location, weather, time, class, race)
      • Multi-theme support for custom content
      • Custom titles, descriptions, and choices usage
      • Event type coverage including MAGIC and SPELLCASTING
      • Context enhancement return value verification
    • Infinite Extensibility: Added index signature to PlayerContext allowing unlimited custom properties
    • Custom Handler System: Register custom handlers for processing any context property
    • Automatic Property Processing: Custom properties are automatically detected and processed without manual handler registration
    • Expanded Title Generation: Significantly expanded vocabulary (150+ adjectives, 40+ nouns per type, 40+ suffixes) for 99%+ unique titles
    • Description Coherence: Fixed description generation to use proper sentence structures with noun extraction
    • Title Uniqueness: Improved from ~19% to 99%+ unique titles across 1000 events
    • Custom Property Integration: Custom properties automatically influence event generation (tags, event types, modifiers)
    • Context Analysis: All custom properties are now preserved through the analysis cycle
    • Event Modifiers: Custom properties automatically generate tags and influence event type preferences
    • Fixed type safety in public API - replaced any types with proper PlayerContext and Event types
    • Fixed cross-platform compatibility for clean script (now works on Windows, macOS, and Linux)
    • Removed compiled files from source directory (.js, .js.map, .d.ts, .d.ts.map files)
    • Enabled TypeScript strict mode for better type safety and code quality
    • Consolidated README documentation - removed duplicate sections
    • Updated all version references to be consistent across the codebase
    • Improved .gitignore to prevent compiled files from being committed
    • Minor bug fixes and stability improvements
    • Fixed template database adapter initialization issues
    • Resolved world building system edge cases
    • Updated API documentation
    • Improved code examples
    • Pluggable Database Adapters: Scalable storage with pluggable adapters for large-scale applications
    • Template Storage: Store and retrieve templates from databases
    • Template Search: Search templates in database with flexible query options
    • Memory Database Adapter: Built-in in-memory database adapter for development and testing
    • Database Methods: storeTemplateInDatabase(), getTemplateFromDatabase(), searchTemplatesInDatabase()
    • Automated World Generation: Generate complete game worlds with regions, factions, and history
    • Faction System: Dynamic faction creation with power rankings and relationships
    • Historical Simulation: Simulate world history over multiple years
    • World Methods: generateWorld(), simulateWorldYears(), getFactionPowerRanking(), getHistoricalEvents()
    • Conditional Templates: Create templates with complex conditional logic
    • Template Composition: Combine multiple templates with merge strategies
    • Template Inheritance: Template inheritance and mixin support
    • Conditional Choices: Dynamic choices based on player state and conditions
    • Template Caching: Advanced template caching for improved performance
    • Event Caching: Cache generated events for faster retrieval
    • Parallel Generation: Generate events in parallel with configurable thread count
    • Batched Processing: Generate events in batches for memory efficiency
    • Performance Methods: generateEventsParallel(), generateEventsBatched()
    • Architecture Refactoring: Complete composition-based architecture overhaul
    • Modular Systems: Improved separation of concerns with dependency injection
    • Type System: Enhanced TypeScript type definitions throughout
    • Complete API Documentation: Full TypeDoc reference for all new features
    • Usage Examples: Comprehensive examples for database, world building, and advanced templates
    • Migration Guide: Updated migration guide for v3.0.0
    • Massive Template Library: 429 professionally crafted event templates included
    • 7 Complete Genres: Fantasy, Sci-Fi, Horror, Historical, Modern, Cyberpunk, Space Opera
    • Quality Assurance: All templates include proper difficulty, choices, and context requirements
    • NPM Package Inclusion: All templates distributed with the package for immediate use
    • Advanced Rule Builder: Create sophisticated conditional rules with visual interface
    • Dynamic Rule Evaluation: Real-time rule processing with complex condition logic
    • Rule Effects System: Modify event titles, choices, difficulty, and add custom tags
    • Rule Management: Add, remove, and organize custom rules with persistence
    • Condition Types: Support for stat requirements, location checks, time-based rules, and more
    • Custom Theme Builder: Design unique game worlds with training data
    • Pure Markov Mode: Generate events using only custom training sentences
    • Theme Settings: Configure rule engine, template library, and generation modes
    • Training Data Input: Visual interface for entering theme-specific sentences
    • Theme Testing: Test custom themes with real event generation
    • User-Generated Content Sharing: Theme and rule pack marketplace
    • Content Pack Creation: Bundle themes and rules into complete configurations
    • Quality Metrics: Automatic quality scoring for shared content
    • Export/Import System: Easy sharing via JSON files
    • Unity C# Export: Generate Unity ScriptableObject classes with full event data
    • Godot GDScript Export: Create Godot Resource scripts with event implementations
    • TypeScript Export: Strongly-typed event definitions for TypeScript projects
    • Export System: Automated generation via scripts/export-templates.js
    • Working Integrations: Direct code generation for Unity and Godot projects
    • Future Plans: Unity Package Manager plugin and Godot Asset Library addon (planned)
    • Complete Feature Integration: All v2.0.0 features working together
    • Interactive Rule Engine: Full rule creation and management interface
    • Theme Creator Interface: Build and test custom themes visually
    • Mobile Responsive Design: Optimized for all device sizes
    • Template Generation Tools: CLI tools for generating events across 7 genres
    • Embedded Documentation: Complete changelog and migration guide accessible in demo
    • Command-Line Demo: Comprehensive demo.js showcasing all 21 features
    • Stable API: All methods properly implemented and tested
    • Error Handling: Robust error handling throughout the system
    • Performance Optimizations: Efficient event generation and rule evaluation
    • Cross-Browser Support: Works in all modern browsers
    • CLI Tools: Command-line utilities for content management and export
    • NPM Scripts: Convenient npm commands for common operations
    • Global Installation: Bin entries for global CLI tool access
    • Complete Architecture Overhaul: Modular design with improved maintainability
    • Enhanced Browser Compatibility: Works across all modern browsers
    • Performance Optimizations: Efficient event generation and rule evaluation
    • Code Organization: Better separation of concerns and cleaner architecture
    • Rule Engine Functionality: Fixed all rule creation and evaluation bugs
    • Event Generation: Resolved fallback issues and improved template loading
    • NPC Relationships: Implemented complete relationship system
    • Template System: Fixed template loading and management issues
    • Method Compatibility: Added all missing API methods and error handling
    • Demo Integration: Fixed all web interface bugs and missing functionality
    • Complete README Overhaul: Comprehensive feature documentation with examples
    • Production-Ready Demo: Full web interface with all features working
    • API Documentation: Complete method documentation and usage examples
    • Migration Guide: Clear upgrade path from v1.x to v2.0.0
    • Integration Guides: Unity, Godot, and TypeScript integration examples
    • Genre-Specific Templates: Pre-built event collections for fantasy, sci-fi, horror, and historical genres
    • Template Library System: Load and use professionally crafted event templates
    • Template Generation: generateFromTemplate() and generateFromGenre() methods
    • Template Management: getAvailableTemplates() for discovering available content
    • Extensible Framework: Easy to add new genres and templates
    • Quality Assurance: All templates include proper difficulty, choices, and context requirements
    • Template Documentation: Complete guide for using the template library
    • Genre Descriptions: Detailed information about each template genre
    • API Examples: Comprehensive usage examples for template functionality
    • Translation System: Complete internationalisation framework with locale support
    • Built-in Languages: English (default), Spanish (es), French (fr)
    • Dynamic Language Switching: setLanguage() method for runtime language changes
    • Custom Language Packs: loadLanguagePack() for adding new languages
    • Variable Substitution: Support for parameterised translations ({{variable}} syntax)
    • Cultural Adaptation: Language-specific cultural context and formatting
    • Weather Effects: Rain, storm, snow, and clear weather modifiers
    • Seasonal Effects: Spring, summer, autumn, winter environmental impacts
    • Modifier Stacking: Combined weather and seasonal effects
    • Dynamic Event Modification: Health drains, movement penalties, atmosphere changes
    • Configurable Modifiers: Custom modifier creation and application
    • Prerequisite System: Complex event unlocking requirements
    • Logical Operators: AND/OR conditions for dependency chains
    • Multiple Dependency Types:
      • event_completed: Require specific events to be finished
      • stat_requirement: Player stat thresholds (level, reputation, etc.)
      • relationship_requirement: NPC relationship requirements
      • item_requirement: Inventory-based prerequisites
    • Dependency Validation: Runtime checking of event availability
    • Dynamic Relationships: Strength-based NPC relationships (-100 to +100)
    • Relationship Evolution: Automatic relationship changes based on player actions
    • Built-in Evolution Rules: Predefined rules for common interactions (save_life, betray_trust, etc.)
    • Custom Relationship Rules: Extensible system for adding new interaction types
    • Relationship Tracking: History and analytics for NPC relationships
    • Network Analysis: Relationship web visualisation and analysis
    • Combined Feature Integration: All new systems work together seamlessly
    • Contextual Enhancements: Events adapt based on environmental, relational, and dependency context
    • Performance Optimisations: Efficient caching and processing for complex scenarios
    • Improved Code Organisation: Better separation of concerns with modular architecture
    • Enhanced Error Handling: More robust error handling throughout the system
    • Performance Improvements: Optimised event generation and modifier application
    • Event Chain Advancement: Fixed chain progression logic using correct chain IDs
    • Modifier Application: Corrected modifier effect calculations and stacking
    • Test Coverage: Comprehensive test suite covering all new features (69 tests total)
    • Complete README Overhaul: Comprehensive feature documentation with examples
    • Enhanced Demo: Full demonstration of all v1.0.0 and v1.2.0 features
    • API Documentation: Detailed JSDoc comments for all new methods
    • Migration Guide: Backward compatibility notes and upgrade instructions
    • Input Validation: Enhanced validation for all new input parameters
    • Safe Defaults: Conservative defaults for all new features (opt-in by default)
    • Minor bug fixes and stability improvements
    • Updated installation instructions
    • Improved code examples
    • Markov chain generation edge cases
    • Template validation improvements
    • Additional event templates
    • Enhanced difficulty scaling
    • Template loading performance
    • Memory usage optimisations
    • Event Chains: Multi-part story sequences with startChain() and advanceChain()
    • Time-Based Events: Seasonal events and time-evolving chains
    • Game State Management: Save/load functionality with getGameState() and loadGameState()
    • Modular Event System: Custom templates, training data, and export/import
    • Dynamic Difficulty Scaling: Events scale based on player power level
    • Enhanced Context Awareness: More sophisticated player state analysis
    • Core Event Generation: Basic procedural event creation with Markov chains
    • Player-Aware Events: Events adapt to player stats, career, and relationships
    • 14+ Event Types: Comprehensive set of adventure, social, and economic events
    • Text Generation: Custom training data for enhanced narrative quality
    • Difficulty Scaling: Basic power-based event adjustment
    • Game Integration: Save/load state support
    • Complete README with usage examples
    • API reference documentation
    • Integration guides for different game engines

    This project uses Semantic Versioning:

    • MAJOR version for incompatible API changes
    • MINOR version for backwards-compatible functionality additions
    • PATCH version for backwards-compatible bug fixes

    All changes in v1.3.0 are backwards compatible. The template library is opt-in:

    // Before (still works)
    const generator = new RPGEventGenerator();

    // With template library
    const generator = new RPGEventGenerator({
    enableTemplates: true,
    templateLibrary: 'fantasy' // Load fantasy templates
    });

    // Generate from templates
    const dragonEvent = generator.generateFromTemplate('dragon_lair');
    const fantasyEvent = generator.generateFromGenre('fantasy');
    const generator = new RPGEventGenerator({
    // Core options (v1.0.0+)
    theme: 'fantasy',
    culture: 'norse',
    trainingData: [...],

    // Enhanced options (v1.2.0+)
    enableModifiers: true,
    enableRelationships: true,
    enableDependencies: true,
    language: 'en',

    // New options (v1.3.0+)
    enableTemplates: true, // Enable template library
    templateLibrary: 'fantasy' // Genre to load: 'fantasy', 'sci-fi', 'horror', 'historical'
    });

    Legend:

    • 🚀 Added for new features
    • Added for smaller additions
    • 🔧 Changed for changes in existing functionality
    • 🐛 Fixed for any bug fixes
    • 📚 Documentation for documentation updates
    • 🔒 Security for security-related changes