rpg-event-generator 1.0.0 โ†’ 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +261 -6
  2. package/dist/index.js +1482 -54
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -416,14 +416,269 @@ MIT License - see LICENSE file for details.
416
416
  - Uses [Chance.js](https://chancejs.com/) for random number generation
417
417
  - Custom Markov chain implementation for procedural text generation
418
418
 
419
- ## ๐Ÿ”ฎ Future Enhancements
419
+ ## ๐ŸŽจ Thematic Training Sets
420
+
421
+ Choose from different genres and settings for your RPG events:
422
+
423
+ ```javascript
424
+ // Fantasy (default) - knights, magic, dragons
425
+ const fantasyGen = new RPGEventGenerator({ theme: 'fantasy' });
426
+
427
+ // Fantasy with Norse culture - vikings, runes, fjords
428
+ const norseGen = new RPGEventGenerator({
429
+ theme: 'fantasy',
430
+ culture: 'norse'
431
+ });
432
+
433
+ // Sci-fi - corporations, AI, space exploration
434
+ const sciFiGen = new RPGEventGenerator({ theme: 'sci-fi' });
435
+
436
+ // Cyberpunk sci-fi - neon lights, megacorps, hackers
437
+ const cyberpunkGen = new RPGEventGenerator({
438
+ theme: 'sci-fi',
439
+ culture: 'cyberpunk'
440
+ });
441
+
442
+ // Historical - medieval politics, exploration, warfare
443
+ const historicalGen = new RPGEventGenerator({ theme: 'historical' });
444
+
445
+ // Victorian historical - industrial revolution, social reform
446
+ const victorianGen = new RPGEventGenerator({
447
+ theme: 'historical',
448
+ culture: 'victorian'
449
+ });
450
+ ```
451
+
452
+ ## โ›“๏ธ Event Chains
453
+
454
+ Create multi-part story sequences where events trigger follow-ups:
455
+
456
+ ```javascript
457
+ const generator = new RPGEventGenerator();
458
+
459
+ // Start a bandit rising chain
460
+ const firstEvent = generator.startChain('BANDIT_RISING');
461
+ console.log(firstEvent.title); // "Treacherous Bandit Ambush"
462
+
463
+ // Advance chain based on player choice
464
+ const nextEvent = generator.advanceChain(firstEvent.chainId, 'bandit');
465
+ console.log(nextEvent.title); // "Perilous Bandit King's Challenge"
466
+
467
+ // Available chains: BANDIT_RISING, COURT_SCANDAL_CHAIN, CURSE_OF_THE_ARTIFACT, MERCHANT_EMPIRE
468
+ ```
469
+
470
+ Event chains create more engaging narratives with escalating consequences and multi-stage stories.
471
+
472
+ ## ๐Ÿ”ง Modular Event System
473
+
474
+ Create and manage custom event templates, training data, and chains:
475
+
476
+ ```javascript
477
+ const generator = new RPGEventGenerator();
478
+
479
+ // Register custom event templates
480
+ const customTemplate = {
481
+ title: 'Mystic Vision',
482
+ narrative: 'You experience a vivid prophetic dream showing future events.',
483
+ choices: [
484
+ { text: 'Seek out the prophecy', effect: { wisdom: 15, risk: 20 } },
485
+ { text: 'Dismiss it as a dream', effect: { stress: -10 } }
486
+ ]
487
+ };
488
+ generator.registerEventTemplate('MYSTIC_VISION', customTemplate);
489
+
490
+ // Add custom training data for better text generation
491
+ generator.addCustomTrainingData([
492
+ 'The ancient prophecy foretells of great change',
493
+ 'Mystic visions reveal hidden truths to the worthy',
494
+ 'Dreams of the future guide the destinies of heroes'
495
+ ], 'mystical');
496
+
497
+ // Create custom event chains
498
+ const visionChain = {
499
+ name: 'Prophetic Journey',
500
+ description: 'A chain of events triggered by mystic visions',
501
+ stages: [
502
+ { day: 1, template: 'MYSTIC_VISION' },
503
+ { day: 5, template: 'ANCIENT_RUINS' },
504
+ { day: 10, template: 'FINAL_PROPHECY' }
505
+ ]
506
+ };
507
+ generator.registerEventChain('PROPHECY_CHAIN', visionChain);
508
+
509
+ // Export/import custom content for sharing
510
+ const customContent = generator.exportCustomContent();
511
+ // Share with other developers or save for backup
512
+
513
+ const anotherGenerator = new RPGEventGenerator();
514
+ anotherGenerator.importCustomContent(customContent);
515
+ ```
516
+
517
+ **Custom Content Management:**
518
+ - **Templates**: `getCustomTemplates()`, `unregisterEventTemplate()`
519
+ - **Training Data**: Organized by categories for easy management
520
+ - **Event Chains**: `getCustomChains()`, `unregisterEventChain()`
521
+ - **Export/Import**: Full backup and sharing capabilities
522
+
523
+ ## โš–๏ธ Dynamic Difficulty Scaling
524
+
525
+ Events automatically scale based on player power level:
526
+
527
+ ```javascript
528
+ // Weak character (easy difficulty)
529
+ const weakling = { gold: 50, influence: 10 };
530
+ const easyEvent = generator.generateEvent(weakling);
531
+ // Rewards: 50% higher, penalties: 30% lower
532
+
533
+ // Powerful character (hard difficulty)
534
+ const hero = { gold: 50000, influence: 500, skills: { combat: 100 } };
535
+ const hardEvent = generator.generateEvent(hero);
536
+ // Rewards: 20% lower, penalties: 30% higher
537
+
538
+ // Legendary character (legendary difficulty)
539
+ const god = { gold: 200000, influence: 1000, skills: { combat: 200 } };
540
+ const epicEvent = generator.generateEvent(god);
541
+ // Rewards: 40% lower, penalties: 60% higher
542
+ ```
543
+
544
+ **Difficulty Tiers:**
545
+ - **Easy** (Power 0-50): Beginner-friendly events
546
+ - **Normal** (Power 25-150): Balanced challenges
547
+ - **Hard** (Power 100-300): Demanding encounters
548
+ - **Legendary** (Power 250+): Epic, high-stakes events
420
549
 
421
- - **Thematic Training Sets**: Fantasy, Sci-fi, Historical themes
550
+ ## โฐ Time-Based Events
551
+
552
+ Events evolve over time with seasonal changes and long-term story arcs:
553
+
554
+ ```javascript
555
+ const generator = new RPGEventGenerator();
556
+
557
+ // Advance game time
558
+ const timeEvents = generator.advanceTime(30); // Advance 30 days
559
+ console.log('Season:', generator.getCurrentTime().season); // May change
560
+
561
+ // Start evolving storylines
562
+ generator.startTimeBasedChain('POLITICAL_UPRISING');
563
+ // - Day 1: Whispers of dissent
564
+ // - Day 7: Public protests
565
+ // - Day 14: Open rebellion
566
+ // - Day 21: Revolutionary climax
567
+
568
+ // Generate time-aware events
569
+ const seasonalEvent = generator.generateTimeAwareEvent(playerContext);
570
+ // Events adapt to current season with appropriate themes
571
+ ```
572
+
573
+ **Available Time-Based Chains:**
574
+ - **`POLITICAL_UPRISING`**: Rebellion that builds over weeks
575
+ - **`ECONOMIC_COLLAPSE`**: Market crisis with escalating consequences
576
+ - **`MYSTICAL_AWAKENING`**: Supernatural events that intensify over time
577
+
578
+ **Seasonal Events:**
579
+ - **Spring**: Romance, renewal, festivals
580
+ - **Summer**: Tournaments, celebrations, activity
581
+ - **Autumn**: Harvest, preparation, scarcity
582
+ - **Winter**: Solstice rituals, survival challenges, warmth-seeking
583
+
584
+ ## ๐ŸŽฎ Game Integration
585
+
586
+ For real game integration, use these methods instead of timers:
587
+
588
+ ```javascript
589
+ const generator = new RPGEventGenerator();
590
+
591
+ // Each game day, advance time and check for events
592
+ function onNewGameDay() {
593
+ const dueEvents = generator.advanceGameDay();
594
+
595
+ // Process each due event in your game
596
+ dueEvents.forEach(event => {
597
+ if (event.type === 'time_based_chain') {
598
+ // Generate the actual event for your game
599
+ const chainData = generator.timeSystem.timeBasedEvents.get(event.chainId);
600
+ const gameEvent = generator.generateChainEvent(chainData);
601
+ // Add gameEvent to your game's event system
602
+ triggerInGameEvent(gameEvent);
603
+ } else if (event.type === 'seasonal_random') {
604
+ // Generate a seasonal event
605
+ const seasonalEvent = generator.generateTimeAwareEvent(playerContext);
606
+ triggerInGameEvent(seasonalEvent);
607
+ }
608
+ });
609
+ }
610
+
611
+ // Save/Load game state
612
+ function saveGame() {
613
+ const gameState = generator.getGameState();
614
+ // Save gameState to your game's save file
615
+ }
616
+
617
+ function loadGame(savedState) {
618
+ generator.loadGameState(savedState);
619
+ // Game is now restored with proper time/chain state
620
+ }
621
+
622
+ // Monitor active chains
623
+ const activeChains = generator.getActiveTimeChains();
624
+ // Shows all ongoing storylines with their progress
625
+ ```
626
+
627
+ **Key Benefits:**
628
+ - **Persistent State**: Chains survive game saves/loads
629
+ - **Event-Driven**: No timers, events trigger when you advance days
630
+ - **Game-Controlled**: You control when time passes
631
+ - **Multiple Events**: Handle multiple events per day
632
+
633
+ ## ๐Ÿ—บ๏ธ Cultural Context
634
+
635
+ Add regional/cultural flavor within each theme:
636
+
637
+ ### Fantasy Cultures
638
+ - **`norse`**: Vikings, runes, mead halls, thunder gods
639
+ - **`arabian`**: Sultans, djinn, bazaars, flying carpets
640
+ - **`celtic`**: Druids, fairy mounds, stone circles, clan warfare
641
+ - **`asian`**: Imperial courts, samurai, dragon spirits, tea ceremonies
642
+
643
+ ### Sci-Fi Cultures
644
+ - **`cyberpunk`**: Neon cities, megacorps, neural implants, hackers
645
+ - **`space_opera`**: Galactic empires, Jedi knights, hyperspace, alien ambassadors
646
+ - **`post_apocalyptic`**: Wastelands, mutants, vault dwellers, irradiated ruins
647
+
648
+ ### Historical Cultures
649
+ - **`medieval`**: Knights, castles, feudal lords, alchemists
650
+ - **`victorian`**: Industrial revolution, social reformers, steam power
651
+ - **`ancient_roman`**: Gladiators, senators, aqueducts, barbarian hordes
652
+
653
+ Cultural variants blend with base theme data for authentic regional flavor!
654
+
655
+ ## ๐Ÿงช Testing
656
+
657
+ This package includes comprehensive test coverage with **45+ automated tests** ensuring reliability and quality:
658
+
659
+ ```bash
660
+ npm test
661
+ ```
662
+
663
+ **Test Coverage Includes:**
664
+ - โœ… **Core Generation** - Event creation and validation
665
+ - โœ… **Context Adaptation** - Player stat responsiveness
666
+ - โœ… **Thematic Systems** - Theme and culture switching
667
+ - โœ… **Event Chains** - Multi-stage story progression
668
+ - โœ… **Difficulty Scaling** - Power-based event adjustment
669
+ - โœ… **Time Systems** - Seasonal and temporal mechanics
670
+ - โœ… **Modular Features** - Custom content registration
671
+ - โœ… **Edge Cases** - Error handling and validation
672
+ - โœ… **Integration** - Game state persistence
673
+
674
+ All features are thoroughly tested with both unit and integration tests for maximum reliability.
675
+
676
+ ## ๐Ÿ”ฎ Future Enhancements
422
677
  - **Multi-language Support**: Generate events in different languages
423
- - **Event Chains**: Multi-part event sequences
424
- - **Dynamic Difficulty**: Events scale with player power level
425
- - **Cultural Context**: Region-specific event generation
426
- - **Time-based Events**: Events that change over time
678
+ - **Event Dependencies**: Complex prerequisite systems
679
+ - **Event Modifiers**: Weather, season, and environmental effects
680
+ - **Character Relationships**: NPC interaction networks
681
+ - **Event Editor**: Visual template creation interface
427
682
 
428
683
  ---
429
684