rpg-event-generator 2.0.1 โ 3.0.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.
- package/README.md +235 -1159
- package/demo.js +379 -57
- package/dist/RPGEventGenerator.d.ts +246 -0
- package/dist/RPGEventGenerator.d.ts.map +1 -0
- package/dist/RPGEventGenerator.js +824 -0
- package/dist/RPGEventGenerator.js.map +1 -0
- package/dist/ai/enhancer.d.ts +16 -0
- package/dist/ai/enhancer.d.ts.map +1 -0
- package/dist/ai/enhancer.js +76 -0
- package/dist/ai/enhancer.js.map +1 -0
- package/dist/ai/index.d.ts +4 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +20 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/interfaces.d.ts +23 -0
- package/dist/ai/interfaces.d.ts.map +1 -0
- package/dist/ai/interfaces.js +3 -0
- package/dist/ai/interfaces.js.map +1 -0
- package/dist/ai/providers.d.ts +27 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +142 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/chains/ChainSystem.d.ts +84 -0
- package/dist/chains/ChainSystem.d.ts.map +1 -0
- package/dist/chains/ChainSystem.js +250 -0
- package/dist/chains/ChainSystem.js.map +1 -0
- package/dist/chains/index.d.ts +2 -0
- package/dist/chains/index.d.ts.map +1 -0
- package/dist/chains/index.js +8 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/core/ContextAnalyzer.d.ts +48 -0
- package/dist/core/ContextAnalyzer.d.ts.map +1 -0
- package/dist/core/ContextAnalyzer.js +204 -0
- package/dist/core/ContextAnalyzer.js.map +1 -0
- package/dist/core/DifficultyScaler.d.ts +86 -0
- package/dist/core/DifficultyScaler.d.ts.map +1 -0
- package/dist/core/DifficultyScaler.js +270 -0
- package/dist/core/DifficultyScaler.js.map +1 -0
- package/dist/core/GeneratorCore.d.ts +89 -0
- package/dist/core/GeneratorCore.d.ts.map +1 -0
- package/dist/core/GeneratorCore.js +248 -0
- package/dist/core/GeneratorCore.js.map +1 -0
- package/dist/core/MarkovEngine.d.ts +70 -0
- package/dist/core/MarkovEngine.d.ts.map +1 -0
- package/dist/core/MarkovEngine.js +213 -0
- package/dist/core/MarkovEngine.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +14 -0
- package/dist/core/index.js.map +1 -0
- package/dist/database/MemoryDatabaseAdapter.d.ts +16 -0
- package/dist/database/MemoryDatabaseAdapter.d.ts.map +1 -0
- package/dist/database/MemoryDatabaseAdapter.js +75 -0
- package/dist/database/MemoryDatabaseAdapter.js.map +1 -0
- package/dist/database/TemplateDatabase.d.ts +25 -0
- package/dist/database/TemplateDatabase.d.ts.map +1 -0
- package/dist/database/TemplateDatabase.js +141 -0
- package/dist/database/TemplateDatabase.js.map +1 -0
- package/dist/database/index.d.ts +3 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/index.js +8 -0
- package/dist/database/index.js.map +1 -0
- package/dist/environment/EnvironmentalSystem.d.ts +110 -0
- package/dist/environment/EnvironmentalSystem.d.ts.map +1 -0
- package/dist/environment/EnvironmentalSystem.js +302 -0
- package/dist/environment/EnvironmentalSystem.js.map +1 -0
- package/dist/environment/index.d.ts +2 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +8 -0
- package/dist/environment/index.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -3601
- package/dist/index.js.map +1 -0
- package/dist/interfaces/core.d.ts +22 -0
- package/dist/interfaces/core.d.ts.map +1 -0
- package/dist/interfaces/core.js +5 -0
- package/dist/interfaces/core.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +21 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/systems.d.ts +103 -0
- package/dist/interfaces/systems.d.ts.map +1 -0
- package/dist/interfaces/systems.js +5 -0
- package/dist/interfaces/systems.js.map +1 -0
- package/dist/localization/LocalizationSystem.d.ts +101 -0
- package/dist/localization/LocalizationSystem.d.ts.map +1 -0
- package/dist/localization/LocalizationSystem.js +257 -0
- package/dist/localization/LocalizationSystem.js.map +1 -0
- package/dist/localization/index.d.ts +2 -0
- package/dist/localization/index.d.ts.map +1 -0
- package/dist/localization/index.js +8 -0
- package/dist/localization/index.js.map +1 -0
- package/dist/relationships/RelationshipSystem.d.ts +123 -0
- package/dist/relationships/RelationshipSystem.d.ts.map +1 -0
- package/dist/relationships/RelationshipSystem.js +349 -0
- package/dist/relationships/RelationshipSystem.js.map +1 -0
- package/dist/relationships/index.d.ts +2 -0
- package/dist/relationships/index.d.ts.map +1 -0
- package/dist/relationships/index.js +8 -0
- package/dist/relationships/index.js.map +1 -0
- package/dist/rules/RuleEngine.d.ts +137 -0
- package/dist/rules/RuleEngine.d.ts.map +1 -0
- package/dist/rules/RuleEngine.js +406 -0
- package/dist/rules/RuleEngine.js.map +1 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +8 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/scripts/event-economy.d.ts +7 -0
- package/dist/scripts/event-economy.d.ts.map +1 -0
- package/dist/scripts/event-economy.js +353 -0
- package/dist/scripts/event-economy.js.map +1 -0
- package/dist/scripts/export-templates.d.ts +7 -0
- package/dist/scripts/export-templates.d.ts.map +1 -0
- package/dist/scripts/export-templates.js +352 -0
- package/dist/scripts/export-templates.js.map +1 -0
- package/dist/scripts/generate-templates.d.ts +7 -0
- package/dist/scripts/generate-templates.d.ts.map +1 -0
- package/dist/scripts/generate-templates.js +394 -0
- package/dist/scripts/generate-templates.js.map +1 -0
- package/dist/src/ai/enhancer.d.ts +16 -0
- package/dist/src/ai/enhancer.d.ts.map +1 -0
- package/dist/src/ai/enhancer.js +76 -0
- package/dist/src/ai/enhancer.js.map +1 -0
- package/dist/src/ai/index.d.ts +4 -0
- package/dist/src/ai/index.d.ts.map +1 -0
- package/dist/src/ai/index.js +20 -0
- package/dist/src/ai/index.js.map +1 -0
- package/dist/src/ai/interfaces.d.ts +23 -0
- package/dist/src/ai/interfaces.d.ts.map +1 -0
- package/dist/src/ai/interfaces.js +3 -0
- package/dist/src/ai/interfaces.js.map +1 -0
- package/dist/src/ai/providers.d.ts +27 -0
- package/dist/src/ai/providers.d.ts.map +1 -0
- package/dist/src/ai/providers.js +142 -0
- package/dist/src/ai/providers.js.map +1 -0
- package/dist/src/types/config.d.ts +107 -0
- package/dist/src/types/config.d.ts.map +1 -0
- package/dist/src/types/config.js +5 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/environment.d.ts +20 -0
- package/dist/src/types/environment.d.ts.map +1 -0
- package/dist/src/types/environment.js +5 -0
- package/dist/src/types/environment.js.map +1 -0
- package/dist/src/types/events.d.ts +98 -0
- package/dist/src/types/events.d.ts.map +1 -0
- package/dist/src/types/events.js +5 -0
- package/dist/src/types/events.js.map +1 -0
- package/dist/src/types/index.d.ts +9 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +35 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/localization.d.ts +16 -0
- package/dist/src/types/localization.d.ts.map +1 -0
- package/dist/src/types/localization.js +5 -0
- package/dist/src/types/localization.js.map +1 -0
- package/dist/src/types/npcs.d.ts +21 -0
- package/dist/src/types/npcs.d.ts.map +1 -0
- package/dist/src/types/npcs.js +5 -0
- package/dist/src/types/npcs.js.map +1 -0
- package/dist/src/types/rules.d.ts +25 -0
- package/dist/src/types/rules.d.ts.map +1 -0
- package/dist/src/types/rules.js +5 -0
- package/dist/src/types/rules.js.map +1 -0
- package/dist/src/types/templates.d.ts +70 -0
- package/dist/src/types/templates.d.ts.map +1 -0
- package/dist/src/types/templates.js +5 -0
- package/dist/src/types/templates.js.map +1 -0
- package/dist/src/types/world.d.ts +62 -0
- package/dist/src/types/world.d.ts.map +1 -0
- package/dist/src/types/world.js +5 -0
- package/dist/src/types/world.js.map +1 -0
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +21 -0
- package/dist/src/types.js.map +1 -0
- package/dist/templates/TemplateSystem.d.ts +182 -0
- package/dist/templates/TemplateSystem.d.ts.map +1 -0
- package/dist/templates/TemplateSystem.js +779 -0
- package/dist/templates/TemplateSystem.js.map +1 -0
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +8 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/time/TimeSystem.d.ts +128 -0
- package/dist/time/TimeSystem.d.ts.map +1 -0
- package/dist/time/TimeSystem.js +286 -0
- package/dist/time/TimeSystem.js.map +1 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/time/index.js +8 -0
- package/dist/time/index.js.map +1 -0
- package/dist/types/config.d.ts +107 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +5 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/environment.d.ts +20 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/environment.js +5 -0
- package/dist/types/environment.js.map +1 -0
- package/dist/types/events.d.ts +98 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +5 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/localization.d.ts +16 -0
- package/dist/types/localization.d.ts.map +1 -0
- package/dist/types/localization.js +5 -0
- package/dist/types/localization.js.map +1 -0
- package/dist/types/npcs.d.ts +21 -0
- package/dist/types/npcs.d.ts.map +1 -0
- package/dist/types/npcs.js +5 -0
- package/dist/types/npcs.js.map +1 -0
- package/dist/types/rules.d.ts +25 -0
- package/dist/types/rules.d.ts.map +1 -0
- package/dist/types/rules.js +5 -0
- package/dist/types/rules.js.map +1 -0
- package/dist/types/templates.d.ts +70 -0
- package/dist/types/templates.d.ts.map +1 -0
- package/dist/types/templates.js +5 -0
- package/dist/types/templates.js.map +1 -0
- package/dist/types/world.d.ts +62 -0
- package/dist/types/world.d.ts.map +1 -0
- package/dist/types/world.js +5 -0
- package/dist/types/world.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/array.d.ts +81 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +208 -0
- package/dist/utils/array.js.map +1 -0
- package/dist/utils/constants.d.ts +113 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +133 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/file.d.ts +78 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +273 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/random.d.ts +52 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/random.js +125 -0
- package/dist/utils/random.js.map +1 -0
- package/dist/utils/text.d.ts +74 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +186 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/validation.d.ts +41 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +318 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/workers/event-generator-worker.d.ts +2 -0
- package/dist/workers/event-generator-worker.d.ts.map +1 -0
- package/dist/workers/event-generator-worker.js +19 -0
- package/dist/workers/event-generator-worker.js.map +1 -0
- package/dist/workers/index.d.ts +2 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +18 -0
- package/dist/workers/index.js.map +1 -0
- package/dist/world/WorldBuildingSystem.d.ts +61 -0
- package/dist/world/WorldBuildingSystem.d.ts.map +1 -0
- package/dist/world/WorldBuildingSystem.js +517 -0
- package/dist/world/WorldBuildingSystem.js.map +1 -0
- package/dist/world/index.d.ts +2 -0
- package/dist/world/index.d.ts.map +1 -0
- package/dist/world/index.js +6 -0
- package/dist/world/index.js.map +1 -0
- package/package.json +73 -22
- package/scripts/{event-economy.js โ event-economy.ts} +12 -6
- package/scripts/{export-templates.js โ export-templates.ts} +105 -12
- package/scripts/{generate-templates.js โ generate-templates.ts} +34 -16
- package/templates/cyberpunk/event_100.json +0 -43
- package/templates/cyberpunk/event_11.json +0 -42
- package/templates/cyberpunk/event_14.json +0 -42
- package/templates/cyberpunk/event_15.json +0 -43
- package/templates/cyberpunk/event_16.json +0 -43
- package/templates/cyberpunk/event_18.json +0 -44
- package/templates/cyberpunk/event_2.json +0 -42
- package/templates/cyberpunk/event_26.json +0 -42
- package/templates/cyberpunk/event_27.json +0 -43
- package/templates/cyberpunk/event_3.json +0 -43
- package/templates/cyberpunk/event_30.json +0 -42
- package/templates/cyberpunk/event_32.json +0 -42
- package/templates/cyberpunk/event_36.json +0 -43
- package/templates/cyberpunk/event_37.json +0 -42
- package/templates/cyberpunk/event_39.json +0 -42
- package/templates/cyberpunk/event_4.json +0 -42
- package/templates/cyberpunk/event_40.json +0 -42
- package/templates/cyberpunk/event_42.json +0 -43
- package/templates/cyberpunk/event_46.json +0 -43
- package/templates/cyberpunk/event_49.json +0 -44
- package/templates/cyberpunk/event_5.json +0 -44
- package/templates/cyberpunk/event_50.json +0 -42
- package/templates/cyberpunk/event_51.json +0 -42
- package/templates/cyberpunk/event_54.json +0 -43
- package/templates/cyberpunk/event_55.json +0 -44
- package/templates/cyberpunk/event_57.json +0 -42
- package/templates/cyberpunk/event_58.json +0 -42
- package/templates/cyberpunk/event_61.json +0 -43
- package/templates/cyberpunk/event_62.json +0 -43
- package/templates/cyberpunk/event_64.json +0 -42
- package/templates/cyberpunk/event_65.json +0 -42
- package/templates/cyberpunk/event_66.json +0 -42
- package/templates/cyberpunk/event_68.json +0 -43
- package/templates/cyberpunk/event_69.json +0 -43
- package/templates/cyberpunk/event_71.json +0 -42
- package/templates/cyberpunk/event_72.json +0 -42
- package/templates/cyberpunk/event_73.json +0 -42
- package/templates/cyberpunk/event_74.json +0 -42
- package/templates/cyberpunk/event_75.json +0 -44
- package/templates/cyberpunk/event_76.json +0 -43
- package/templates/cyberpunk/event_78.json +0 -43
- package/templates/cyberpunk/event_79.json +0 -42
- package/templates/cyberpunk/event_8.json +0 -42
- package/templates/cyberpunk/event_80.json +0 -43
- package/templates/cyberpunk/event_81.json +0 -43
- package/templates/cyberpunk/event_83.json +0 -44
- package/templates/cyberpunk/event_84.json +0 -43
- package/templates/cyberpunk/event_86.json +0 -44
- package/templates/cyberpunk/event_88.json +0 -43
- package/templates/cyberpunk/event_9.json +0 -42
- package/templates/cyberpunk/event_91.json +0 -42
- package/templates/cyberpunk/event_92.json +0 -43
- package/templates/cyberpunk/event_93.json +0 -42
- package/templates/cyberpunk/event_95.json +0 -42
- package/templates/cyberpunk/event_96.json +0 -43
- package/templates/cyberpunk/event_97.json +0 -43
- package/templates/cyberpunk/event_98.json +0 -42
- package/templates/cyberpunk/event_99.json +0 -42
- package/templates/fantasy/dragon_lair.json +0 -28
- package/templates/fantasy/event_1.json +0 -44
- package/templates/fantasy/event_10.json +0 -43
- package/templates/fantasy/event_11.json +0 -43
- package/templates/fantasy/event_12.json +0 -42
- package/templates/fantasy/event_13.json +0 -43
- package/templates/fantasy/event_16.json +0 -44
- package/templates/fantasy/event_20.json +0 -42
- package/templates/fantasy/event_21.json +0 -42
- package/templates/fantasy/event_22.json +0 -42
- package/templates/fantasy/event_23.json +0 -42
- package/templates/fantasy/event_24.json +0 -43
- package/templates/fantasy/event_27.json +0 -43
- package/templates/fantasy/event_29.json +0 -43
- package/templates/fantasy/event_3.json +0 -42
- package/templates/fantasy/event_30.json +0 -43
- package/templates/fantasy/event_31.json +0 -42
- package/templates/fantasy/event_33.json +0 -42
- package/templates/fantasy/event_34.json +0 -43
- package/templates/fantasy/event_36.json +0 -43
- package/templates/fantasy/event_38.json +0 -43
- package/templates/fantasy/event_39.json +0 -42
- package/templates/fantasy/event_4.json +0 -44
- package/templates/fantasy/event_41.json +0 -43
- package/templates/fantasy/event_44.json +0 -42
- package/templates/fantasy/event_45.json +0 -42
- package/templates/fantasy/event_46.json +0 -42
- package/templates/fantasy/event_47.json +0 -42
- package/templates/fantasy/event_48.json +0 -42
- package/templates/fantasy/event_5.json +0 -42
- package/templates/fantasy/event_50.json +0 -44
- package/templates/fantasy/event_51.json +0 -43
- package/templates/fantasy/event_54.json +0 -43
- package/templates/fantasy/event_55.json +0 -43
- package/templates/fantasy/event_57.json +0 -44
- package/templates/fantasy/event_58.json +0 -44
- package/templates/fantasy/event_6.json +0 -42
- package/templates/fantasy/event_64.json +0 -42
- package/templates/fantasy/event_68.json +0 -42
- package/templates/fantasy/event_69.json +0 -43
- package/templates/fantasy/event_70.json +0 -42
- package/templates/fantasy/event_71.json +0 -42
- package/templates/fantasy/event_72.json +0 -43
- package/templates/fantasy/event_73.json +0 -42
- package/templates/fantasy/event_76.json +0 -43
- package/templates/fantasy/event_77.json +0 -43
- package/templates/fantasy/event_79.json +0 -42
- package/templates/fantasy/event_88.json +0 -42
- package/templates/fantasy/event_9.json +0 -44
- package/templates/fantasy/event_90.json +0 -43
- package/templates/fantasy/event_91.json +0 -42
- package/templates/fantasy/event_92.json +0 -42
- package/templates/fantasy/event_94.json +0 -43
- package/templates/fantasy/event_96.json +0 -42
- package/templates/fantasy/event_97.json +0 -42
- package/templates/fantasy/event_98.json +0 -42
- package/templates/fantasy/event_99.json +0 -42
- package/templates/fantasy/magic_shop.json +0 -28
- package/templates/historical/court_intrigue.json +0 -28
- package/templates/historical/event_1.json +0 -44
- package/templates/historical/event_10.json +0 -42
- package/templates/historical/event_11.json +0 -44
- package/templates/historical/event_14.json +0 -44
- package/templates/historical/event_17.json +0 -44
- package/templates/historical/event_2.json +0 -43
- package/templates/historical/event_20.json +0 -43
- package/templates/historical/event_21.json +0 -44
- package/templates/historical/event_22.json +0 -43
- package/templates/historical/event_25.json +0 -43
- package/templates/historical/event_26.json +0 -42
- package/templates/historical/event_3.json +0 -43
- package/templates/historical/event_30.json +0 -42
- package/templates/historical/event_33.json +0 -44
- package/templates/historical/event_34.json +0 -42
- package/templates/historical/event_39.json +0 -42
- package/templates/historical/event_4.json +0 -44
- package/templates/historical/event_40.json +0 -42
- package/templates/historical/event_42.json +0 -42
- package/templates/historical/event_44.json +0 -43
- package/templates/historical/event_45.json +0 -43
- package/templates/historical/event_48.json +0 -42
- package/templates/historical/event_50.json +0 -42
- package/templates/historical/event_52.json +0 -42
- package/templates/historical/event_53.json +0 -44
- package/templates/historical/event_54.json +0 -44
- package/templates/historical/event_56.json +0 -42
- package/templates/historical/event_57.json +0 -42
- package/templates/historical/event_59.json +0 -42
- package/templates/historical/event_60.json +0 -43
- package/templates/historical/event_61.json +0 -42
- package/templates/historical/event_62.json +0 -44
- package/templates/historical/event_63.json +0 -42
- package/templates/historical/event_64.json +0 -43
- package/templates/historical/event_65.json +0 -44
- package/templates/historical/event_66.json +0 -42
- package/templates/historical/event_67.json +0 -43
- package/templates/historical/event_69.json +0 -43
- package/templates/historical/event_7.json +0 -42
- package/templates/historical/event_70.json +0 -42
- package/templates/historical/event_71.json +0 -43
- package/templates/historical/event_74.json +0 -42
- package/templates/historical/event_75.json +0 -43
- package/templates/historical/event_79.json +0 -42
- package/templates/historical/event_8.json +0 -44
- package/templates/historical/event_80.json +0 -43
- package/templates/historical/event_82.json +0 -42
- package/templates/historical/event_87.json +0 -43
- package/templates/historical/event_89.json +0 -43
- package/templates/historical/event_9.json +0 -43
- package/templates/historical/event_90.json +0 -44
- package/templates/historical/event_91.json +0 -42
- package/templates/historical/event_92.json +0 -43
- package/templates/historical/event_94.json +0 -42
- package/templates/historical/event_97.json +0 -42
- package/templates/horror/event_1.json +0 -42
- package/templates/horror/event_100.json +0 -42
- package/templates/horror/event_12.json +0 -42
- package/templates/horror/event_13.json +0 -43
- package/templates/horror/event_14.json +0 -44
- package/templates/horror/event_15.json +0 -42
- package/templates/horror/event_16.json +0 -43
- package/templates/horror/event_17.json +0 -43
- package/templates/horror/event_18.json +0 -42
- package/templates/horror/event_2.json +0 -44
- package/templates/horror/event_20.json +0 -43
- package/templates/horror/event_23.json +0 -42
- package/templates/horror/event_27.json +0 -43
- package/templates/horror/event_28.json +0 -42
- package/templates/horror/event_29.json +0 -42
- package/templates/horror/event_3.json +0 -42
- package/templates/horror/event_30.json +0 -42
- package/templates/horror/event_32.json +0 -42
- package/templates/horror/event_34.json +0 -42
- package/templates/horror/event_35.json +0 -43
- package/templates/horror/event_36.json +0 -43
- package/templates/horror/event_37.json +0 -43
- package/templates/horror/event_38.json +0 -44
- package/templates/horror/event_39.json +0 -42
- package/templates/horror/event_40.json +0 -42
- package/templates/horror/event_41.json +0 -42
- package/templates/horror/event_42.json +0 -43
- package/templates/horror/event_43.json +0 -43
- package/templates/horror/event_45.json +0 -42
- package/templates/horror/event_46.json +0 -44
- package/templates/horror/event_47.json +0 -42
- package/templates/horror/event_50.json +0 -43
- package/templates/horror/event_52.json +0 -44
- package/templates/horror/event_53.json +0 -43
- package/templates/horror/event_55.json +0 -43
- package/templates/horror/event_56.json +0 -44
- package/templates/horror/event_58.json +0 -42
- package/templates/horror/event_59.json +0 -42
- package/templates/horror/event_60.json +0 -43
- package/templates/horror/event_61.json +0 -44
- package/templates/horror/event_62.json +0 -42
- package/templates/horror/event_63.json +0 -43
- package/templates/horror/event_65.json +0 -42
- package/templates/horror/event_67.json +0 -43
- package/templates/horror/event_68.json +0 -44
- package/templates/horror/event_72.json +0 -42
- package/templates/horror/event_73.json +0 -44
- package/templates/horror/event_74.json +0 -43
- package/templates/horror/event_77.json +0 -42
- package/templates/horror/event_79.json +0 -43
- package/templates/horror/event_8.json +0 -42
- package/templates/horror/event_82.json +0 -43
- package/templates/horror/event_83.json +0 -42
- package/templates/horror/event_84.json +0 -42
- package/templates/horror/event_86.json +0 -43
- package/templates/horror/event_88.json +0 -42
- package/templates/horror/event_89.json +0 -43
- package/templates/horror/event_9.json +0 -43
- package/templates/horror/event_90.json +0 -44
- package/templates/horror/event_91.json +0 -43
- package/templates/horror/event_93.json +0 -42
- package/templates/horror/event_95.json +0 -42
- package/templates/horror/event_96.json +0 -43
- package/templates/horror/event_99.json +0 -42
- package/templates/horror/haunted_mansion.json +0 -28
- package/templates/index.json +0 -475
- package/templates/modern/event_10.json +0 -42
- package/templates/modern/event_100.json +0 -43
- package/templates/modern/event_11.json +0 -44
- package/templates/modern/event_13.json +0 -42
- package/templates/modern/event_15.json +0 -43
- package/templates/modern/event_16.json +0 -42
- package/templates/modern/event_17.json +0 -42
- package/templates/modern/event_19.json +0 -43
- package/templates/modern/event_2.json +0 -42
- package/templates/modern/event_20.json +0 -42
- package/templates/modern/event_21.json +0 -43
- package/templates/modern/event_22.json +0 -43
- package/templates/modern/event_23.json +0 -43
- package/templates/modern/event_25.json +0 -43
- package/templates/modern/event_27.json +0 -42
- package/templates/modern/event_28.json +0 -42
- package/templates/modern/event_31.json +0 -42
- package/templates/modern/event_32.json +0 -43
- package/templates/modern/event_34.json +0 -44
- package/templates/modern/event_35.json +0 -42
- package/templates/modern/event_36.json +0 -44
- package/templates/modern/event_37.json +0 -42
- package/templates/modern/event_39.json +0 -42
- package/templates/modern/event_4.json +0 -42
- package/templates/modern/event_41.json +0 -42
- package/templates/modern/event_42.json +0 -44
- package/templates/modern/event_43.json +0 -42
- package/templates/modern/event_44.json +0 -44
- package/templates/modern/event_45.json +0 -44
- package/templates/modern/event_46.json +0 -44
- package/templates/modern/event_47.json +0 -43
- package/templates/modern/event_48.json +0 -42
- package/templates/modern/event_49.json +0 -43
- package/templates/modern/event_5.json +0 -43
- package/templates/modern/event_51.json +0 -42
- package/templates/modern/event_52.json +0 -42
- package/templates/modern/event_55.json +0 -43
- package/templates/modern/event_56.json +0 -42
- package/templates/modern/event_57.json +0 -42
- package/templates/modern/event_59.json +0 -42
- package/templates/modern/event_6.json +0 -43
- package/templates/modern/event_60.json +0 -43
- package/templates/modern/event_61.json +0 -42
- package/templates/modern/event_63.json +0 -42
- package/templates/modern/event_64.json +0 -42
- package/templates/modern/event_66.json +0 -42
- package/templates/modern/event_67.json +0 -42
- package/templates/modern/event_69.json +0 -42
- package/templates/modern/event_7.json +0 -43
- package/templates/modern/event_70.json +0 -42
- package/templates/modern/event_72.json +0 -43
- package/templates/modern/event_74.json +0 -43
- package/templates/modern/event_78.json +0 -42
- package/templates/modern/event_8.json +0 -42
- package/templates/modern/event_80.json +0 -44
- package/templates/modern/event_81.json +0 -43
- package/templates/modern/event_82.json +0 -42
- package/templates/modern/event_83.json +0 -42
- package/templates/modern/event_84.json +0 -44
- package/templates/modern/event_85.json +0 -42
- package/templates/modern/event_86.json +0 -42
- package/templates/modern/event_87.json +0 -44
- package/templates/modern/event_89.json +0 -42
- package/templates/modern/event_94.json +0 -42
- package/templates/modern/event_97.json +0 -43
- package/templates/modern/event_98.json +0 -42
- package/templates/modern/event_99.json +0 -44
- package/templates/schema.json +0 -87
- package/templates/sci-fi/alien_encounter.json +0 -28
- package/templates/sci-fi/event_1.json +0 -42
- package/templates/sci-fi/event_11.json +0 -43
- package/templates/sci-fi/event_13.json +0 -43
- package/templates/sci-fi/event_15.json +0 -43
- package/templates/sci-fi/event_18.json +0 -42
- package/templates/sci-fi/event_19.json +0 -43
- package/templates/sci-fi/event_2.json +0 -44
- package/templates/sci-fi/event_22.json +0 -42
- package/templates/sci-fi/event_23.json +0 -42
- package/templates/sci-fi/event_24.json +0 -43
- package/templates/sci-fi/event_25.json +0 -42
- package/templates/sci-fi/event_27.json +0 -43
- package/templates/sci-fi/event_28.json +0 -43
- package/templates/sci-fi/event_30.json +0 -43
- package/templates/sci-fi/event_31.json +0 -42
- package/templates/sci-fi/event_32.json +0 -42
- package/templates/sci-fi/event_33.json +0 -44
- package/templates/sci-fi/event_34.json +0 -42
- package/templates/sci-fi/event_35.json +0 -42
- package/templates/sci-fi/event_36.json +0 -42
- package/templates/sci-fi/event_37.json +0 -44
- package/templates/sci-fi/event_39.json +0 -43
- package/templates/sci-fi/event_4.json +0 -43
- package/templates/sci-fi/event_41.json +0 -42
- package/templates/sci-fi/event_45.json +0 -42
- package/templates/sci-fi/event_47.json +0 -43
- package/templates/sci-fi/event_48.json +0 -42
- package/templates/sci-fi/event_50.json +0 -43
- package/templates/sci-fi/event_51.json +0 -42
- package/templates/sci-fi/event_53.json +0 -42
- package/templates/sci-fi/event_54.json +0 -43
- package/templates/sci-fi/event_55.json +0 -42
- package/templates/sci-fi/event_56.json +0 -43
- package/templates/sci-fi/event_59.json +0 -42
- package/templates/sci-fi/event_6.json +0 -42
- package/templates/sci-fi/event_60.json +0 -43
- package/templates/sci-fi/event_64.json +0 -44
- package/templates/sci-fi/event_65.json +0 -43
- package/templates/sci-fi/event_67.json +0 -42
- package/templates/sci-fi/event_7.json +0 -42
- package/templates/sci-fi/event_72.json +0 -42
- package/templates/sci-fi/event_73.json +0 -43
- package/templates/sci-fi/event_74.json +0 -44
- package/templates/sci-fi/event_75.json +0 -43
- package/templates/sci-fi/event_78.json +0 -42
- package/templates/sci-fi/event_80.json +0 -42
- package/templates/sci-fi/event_82.json +0 -43
- package/templates/sci-fi/event_83.json +0 -44
- package/templates/sci-fi/event_85.json +0 -42
- package/templates/sci-fi/event_87.json +0 -42
- package/templates/sci-fi/event_89.json +0 -42
- package/templates/sci-fi/event_9.json +0 -42
- package/templates/sci-fi/event_90.json +0 -43
- package/templates/sci-fi/event_92.json +0 -44
- package/templates/sci-fi/event_93.json +0 -42
- package/templates/sci-fi/event_94.json +0 -42
- package/templates/sci-fi/event_95.json +0 -43
- package/templates/sci-fi/event_96.json +0 -43
- package/templates/sci-fi/event_97.json +0 -42
- package/templates/space-opera/event_1.json +0 -44
- package/templates/space-opera/event_10.json +0 -42
- package/templates/space-opera/event_100.json +0 -42
- package/templates/space-opera/event_12.json +0 -42
- package/templates/space-opera/event_13.json +0 -44
- package/templates/space-opera/event_14.json +0 -43
- package/templates/space-opera/event_15.json +0 -43
- package/templates/space-opera/event_17.json +0 -42
- package/templates/space-opera/event_18.json +0 -43
- package/templates/space-opera/event_19.json +0 -42
- package/templates/space-opera/event_20.json +0 -43
- package/templates/space-opera/event_21.json +0 -42
- package/templates/space-opera/event_24.json +0 -44
- package/templates/space-opera/event_25.json +0 -42
- package/templates/space-opera/event_26.json +0 -43
- package/templates/space-opera/event_27.json +0 -43
- package/templates/space-opera/event_28.json +0 -43
- package/templates/space-opera/event_29.json +0 -44
- package/templates/space-opera/event_31.json +0 -42
- package/templates/space-opera/event_32.json +0 -42
- package/templates/space-opera/event_33.json +0 -42
- package/templates/space-opera/event_35.json +0 -42
- package/templates/space-opera/event_36.json +0 -44
- package/templates/space-opera/event_38.json +0 -43
- package/templates/space-opera/event_40.json +0 -42
- package/templates/space-opera/event_41.json +0 -42
- package/templates/space-opera/event_43.json +0 -43
- package/templates/space-opera/event_44.json +0 -42
- package/templates/space-opera/event_47.json +0 -42
- package/templates/space-opera/event_48.json +0 -43
- package/templates/space-opera/event_49.json +0 -44
- package/templates/space-opera/event_5.json +0 -44
- package/templates/space-opera/event_50.json +0 -42
- package/templates/space-opera/event_51.json +0 -42
- package/templates/space-opera/event_52.json +0 -42
- package/templates/space-opera/event_53.json +0 -43
- package/templates/space-opera/event_55.json +0 -42
- package/templates/space-opera/event_58.json +0 -43
- package/templates/space-opera/event_6.json +0 -43
- package/templates/space-opera/event_60.json +0 -44
- package/templates/space-opera/event_61.json +0 -42
- package/templates/space-opera/event_62.json +0 -43
- package/templates/space-opera/event_65.json +0 -42
- package/templates/space-opera/event_67.json +0 -42
- package/templates/space-opera/event_68.json +0 -43
- package/templates/space-opera/event_69.json +0 -42
- package/templates/space-opera/event_7.json +0 -44
- package/templates/space-opera/event_71.json +0 -44
- package/templates/space-opera/event_73.json +0 -42
- package/templates/space-opera/event_74.json +0 -42
- package/templates/space-opera/event_77.json +0 -43
- package/templates/space-opera/event_78.json +0 -43
- package/templates/space-opera/event_8.json +0 -43
- package/templates/space-opera/event_81.json +0 -42
- package/templates/space-opera/event_82.json +0 -42
- package/templates/space-opera/event_83.json +0 -43
- package/templates/space-opera/event_85.json +0 -42
- package/templates/space-opera/event_87.json +0 -42
- package/templates/space-opera/event_88.json +0 -42
- package/templates/space-opera/event_90.json +0 -42
- package/templates/space-opera/event_93.json +0 -43
- package/templates/space-opera/event_97.json +0 -42
- package/templates/space-opera/event_98.json +0 -43
package/README.md
CHANGED
|
@@ -1,1297 +1,373 @@
|
|
|
1
|
-
# RPG Event Generator
|
|
1
|
+
# RPG Event Generator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/rpg-event-generator)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A powerful procedural content generation system for dynamic, context aware narratives and interactive experiences. Perfect for games, simulations, and creative applications.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- ๐ง **Rule Engine**: Create conditional rules that modify event generation
|
|
9
|
-
- ๐ฒ **Pure Markov Mode**: Generate events purely from custom text (no templates)
|
|
10
|
-
- ๐ **Cross-Platform Export**: Unity C#, Godot GDScript, TypeScript support
|
|
11
|
-
- ๐ **Template Library**: 429 professionally crafted event templates included across 7 genres (fantasy, sci-fi, horror, historical, modern, cyberpunk, space-opera)
|
|
12
|
-
- ๐๏ธ **Creative Tools**: Visual tools for event customization
|
|
8
|
+
## โ Support
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
If RPG Event Generator has been helpful to your project, consider buying me a coffee!
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
npm install rpg-event-generator
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Quick Start
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
import { RPGEventGenerator, generateRPGEvent } from 'rpg-event-generator';
|
|
26
|
-
|
|
27
|
-
// Simple event generation
|
|
28
|
-
const event = generateRPGEvent({
|
|
29
|
-
age: 25,
|
|
30
|
-
gold: 500,
|
|
31
|
-
influence: 15,
|
|
32
|
-
career: 'merchant'
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
console.log(event.title); // "Golden Opportunity"
|
|
36
|
-
console.log(event.description); // Procedurally generated narrative
|
|
37
|
-
console.log(event.choices); // Array of meaningful choices
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Demo
|
|
41
|
-
|
|
42
|
-
Run the included demo to see the RPG Event Generator in action:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Using npm script (recommended)
|
|
46
|
-
npm run demo
|
|
47
|
-
|
|
48
|
-
# Direct script call
|
|
49
|
-
node demo.js
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
This will demonstrate various features including event generation, chains, time progression, and customization options.
|
|
53
|
-
|
|
54
|
-
## Maintenance & Updates
|
|
55
|
-
|
|
56
|
-
Since this is a personal project with a private repository:
|
|
57
|
-
- **Check npm regularly** for new versions and features
|
|
58
|
-
- **Monitor the changelog** in package updates for breaking changes
|
|
59
|
-
- **Run the demo** to explore new functionality
|
|
60
|
-
- **No direct bug reports** or feature requests can be accepted
|
|
61
|
-
|
|
62
|
-
## Features
|
|
63
|
-
|
|
64
|
-
- **Infinite Event Generation**: Custom Markov chains create unique, contextual events
|
|
65
|
-
- **Player-Aware**: Events adapt to stats, career, relationships, reputation, and social standing
|
|
66
|
-
- **14+ Event Types**: Court scandals, noble duels, ancient curses, bandit kings, and more
|
|
67
|
-
- **Immersive Storytelling**: Rich narratives with atmospheric descriptions and meaningful consequences
|
|
68
|
-
- **Dynamic Difficulty Scaling**: Events automatically scale based on player power level
|
|
69
|
-
- **Thematic Training Sets**: Fantasy, sci-fi, and historical themes with cultural variants
|
|
70
|
-
- **Event Chains**: Multi-part story sequences with escalating consequences
|
|
71
|
-
- **Time-Based Events**: Seasonal changes and evolving long-term storylines
|
|
72
|
-
- **Modular Event System**: Create and manage custom templates, training data, and chains
|
|
73
|
-
- **Game Integration**: Proper save/load state management for real games
|
|
74
|
-
- **Comprehensive Testing**: 45+ automated tests ensuring reliability
|
|
75
|
-
|
|
76
|
-
### Enhanced Features (v1.2.0+)
|
|
12
|
+
<a href="https://www.buymeacoffee.com/Decept1kon" target="_blank">
|
|
13
|
+
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;">
|
|
14
|
+
</a>
|
|
77
15
|
|
|
78
|
-
|
|
79
|
-
- **Event Dependencies**: Complex prerequisite systems for event triggering
|
|
80
|
-
- **Environmental Modifiers**: Weather, season, and location-based event modifications
|
|
81
|
-
- **NPC Relationships**: Dynamic character relationship networks and social consequences
|
|
82
|
-
- **Event Templates Library** (v1.3.0): Pre-built genre-specific event collections for fantasy, sci-fi, horror, and historical themes, with support for custom template creation
|
|
16
|
+
## โจ Features
|
|
83
17
|
|
|
84
|
-
|
|
18
|
+
- **๐ง Intelligent Generation** - Context aware events that adapt to user state
|
|
19
|
+
- **๐ฏ Advanced Templates** - Conditional templates, composition, inheritance, mixins
|
|
20
|
+
- **๐ World Building** - Automated world generation with factions and history
|
|
21
|
+
- **โก Performance** - Template caching, parallel generation, batched processing
|
|
22
|
+
- **๐ Pluggable AI** - Optional AI/ML integration with multiple providers
|
|
23
|
+
- **๐พ Database Support** - Scalable storage with pluggable adapters
|
|
24
|
+
- **๐ฎ Game Engine Export** - Unity C#, Godot GDScript, Unreal Engine C++
|
|
25
|
+
- **๐ Multi Language** - Generate content in different languages
|
|
26
|
+
- **โฐ Time Systems** - Seasonal changes and temporal progression
|
|
27
|
+
- **๐ค Relationship Networks** - Dynamic character relationships
|
|
28
|
+
- **๐ฒ Markov Chains** - Natural sounding narratives
|
|
85
29
|
|
|
86
|
-
|
|
87
|
-
- **๐ง Rule Engine**: Create sophisticated conditional rules that dynamically modify events based on player state, location, stats, and more
|
|
88
|
-
- **๐ฒ Pure Markov Mode**: Generate completely custom events using only your provided text - no templates required
|
|
89
|
-
- **๐ฐ Event Economy**: User-generated content marketplace with theme sharing, rule packs, and quality metrics
|
|
90
|
-
- **๐ Template Library**: Generate hundreds of events across 7 genres using included CLI export tools
|
|
91
|
-
- **๐ Cross-Platform Export**: Export events in JSON and TypeScript formats (Unity/Godot integration guides available)
|
|
92
|
-
- **โ๏ธ Creative Tools**: Visual interfaces for theme building, rule creation, and advanced customization
|
|
30
|
+
## ๐ฆ Installation
|
|
93
31
|
|
|
94
|
-
### Planned Engine Integrations (Future Release)
|
|
95
|
-
|
|
96
|
-
- **๐ฎ Unity Plugin**: Package Manager compatible integration (planned)
|
|
97
|
-
- **๐ฏ Godot Addon**: Asset Library compatible addon (planned)
|
|
98
|
-
- **๐ Game Engine Guides**: Integration patterns and API examples available now
|
|
99
|
-
|
|
100
|
-
## Event Economy System ๐ฐ
|
|
101
|
-
|
|
102
|
-
The Event Economy enables **user-generated content sharing** and marketplace functionality for custom themes, rules, and content packs.
|
|
103
|
-
|
|
104
|
-
### Key Features
|
|
105
|
-
|
|
106
|
-
- **๐จ Theme Marketplace**: Save, share, and import custom themes with training data
|
|
107
|
-
- **๐ง Rule Pack Sharing**: Exchange collections of custom rules between users
|
|
108
|
-
- **๐ฆ Content Packs**: Bundle themes and rules into complete game configurations
|
|
109
|
-
- **โญ Quality Metrics**: Automatic quality scoring for shared content
|
|
110
|
-
- **๐ค Export/Import**: Easy sharing via JSON files
|
|
111
|
-
|
|
112
|
-
### Basic Usage
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
const EventEconomy = require('./scripts/event-economy');
|
|
116
|
-
|
|
117
|
-
// Initialize the system
|
|
118
|
-
const economy = new EventEconomy('./my-user-content');
|
|
119
|
-
|
|
120
|
-
// Save a custom theme
|
|
121
|
-
const themeData = {
|
|
122
|
-
author: 'YourName',
|
|
123
|
-
description: 'Cyberpunk western theme',
|
|
124
|
-
tags: ['cyberpunk', 'western', 'scifi'],
|
|
125
|
-
theme: 'cyberpunk',
|
|
126
|
-
culture: 'western',
|
|
127
|
-
trainingData: [
|
|
128
|
-
'neon signs flicker in the dusty saloon',
|
|
129
|
-
'robotic sheriffs patrol the asteroid streets',
|
|
130
|
-
'cyborg outlaws ride mechanical horses'
|
|
131
|
-
],
|
|
132
|
-
enableRuleEngine: true,
|
|
133
|
-
customRules: [] // your custom rules here
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const filepath = economy.saveTheme('CyberWestern', themeData);
|
|
137
|
-
console.log(`Theme saved to: ${filepath}); // ./my-user-content/themes/cyberwestern.json
|
|
138
|
-
|
|
139
|
-
// List available themes
|
|
140
|
-
const themes = economy.listThemes();
|
|
141
|
-
console.log('Available themes:', themes);
|
|
142
|
-
|
|
143
|
-
// Load and use a theme
|
|
144
|
-
const loadedTheme = economy.loadTheme('CyberWestern');
|
|
145
|
-
// Use with generator...
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### CLI Tools
|
|
149
|
-
|
|
150
|
-
The Event Economy includes command-line tools for content management:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# Using npm scripts (recommended)
|
|
154
|
-
npm run economy:list
|
|
155
|
-
npm run economy:stats
|
|
156
|
-
|
|
157
|
-
# Using direct script calls
|
|
158
|
-
node scripts/event-economy.js list-themes
|
|
159
|
-
node scripts/event-economy.js stats
|
|
160
|
-
|
|
161
|
-
# Save a theme (API integration needed)
|
|
162
|
-
node scripts/event-economy.js save-theme "MyTheme"
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
For global installation, you can also use:
|
|
166
32
|
```bash
|
|
167
|
-
|
|
168
|
-
npx rpg-export unity fantasy
|
|
33
|
+
npm install rpg-event-generator
|
|
169
34
|
```
|
|
170
35
|
|
|
171
|
-
|
|
36
|
+
## ๐ Quick Start
|
|
172
37
|
|
|
173
38
|
```javascript
|
|
174
|
-
|
|
175
|
-
const packData = {
|
|
176
|
-
author: 'ContentCreator',
|
|
177
|
-
description: 'Complete cyberpunk western adventure pack',
|
|
178
|
-
theme: themeData, // include your theme
|
|
179
|
-
rulePacks: ['combat-rules', 'dialogue-rules'] // reference rule packs
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const packPath = economy.createContentPack('CyberWesternAdventure', packData);
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### File Formats
|
|
186
|
-
|
|
187
|
-
#### Theme Files (`themes/*.json`)
|
|
188
|
-
```json
|
|
189
|
-
{
|
|
190
|
-
"name": "CyberWestern",
|
|
191
|
-
"version": "1.0.0",
|
|
192
|
-
"author": "YourName",
|
|
193
|
-
"description": "Cyberpunk western theme",
|
|
194
|
-
"tags": ["cyberpunk", "western"],
|
|
195
|
-
"settings": {
|
|
196
|
-
"theme": "cyberpunk",
|
|
197
|
-
"culture": "western",
|
|
198
|
-
"enableRuleEngine": true,
|
|
199
|
-
"pureMarkovMode": false
|
|
200
|
-
},
|
|
201
|
-
"trainingData": ["sentence 1", "sentence 2"],
|
|
202
|
-
"customRules": [],
|
|
203
|
-
"statistics": {
|
|
204
|
-
"trainingSentences": 2,
|
|
205
|
-
"estimatedQuality": 85
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
39
|
+
const { RPGEventGenerator } = require('rpg-event-generator');
|
|
209
40
|
|
|
210
|
-
|
|
211
|
-
```json
|
|
212
|
-
{
|
|
213
|
-
"name": "CombatRules",
|
|
214
|
-
"rules": [
|
|
215
|
-
{
|
|
216
|
-
"name": "weak_enemy_bonus",
|
|
217
|
-
"conditions": [
|
|
218
|
-
{"type": "stat_less_than", "stat": "level", "value": 5}
|
|
219
|
-
],
|
|
220
|
-
"effects": [
|
|
221
|
-
{"type": "modify_difficulty", "value": -1}
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Quality Metrics
|
|
229
|
-
|
|
230
|
-
Themes are automatically scored on:
|
|
231
|
-
- **Training Data Quality**: Sentence variety and length
|
|
232
|
-
- **Rule Complexity**: Advanced rule usage
|
|
233
|
-
- **Completeness**: All required fields present
|
|
234
|
-
- **Metadata**: Author info, tags, descriptions
|
|
235
|
-
|
|
236
|
-
### Integration with Generator
|
|
237
|
-
|
|
238
|
-
```javascript
|
|
239
|
-
// Load theme and apply to generator
|
|
240
|
-
const theme = economy.loadTheme('CyberWestern');
|
|
41
|
+
// Create generator
|
|
241
42
|
const generator = new RPGEventGenerator({
|
|
242
|
-
theme:
|
|
243
|
-
culture: theme.settings.culture,
|
|
244
|
-
trainingData: theme.trainingData,
|
|
245
|
-
customRules: theme.customRules,
|
|
246
|
-
enableRuleEngine: theme.settings.enableRuleEngine
|
|
43
|
+
theme: 'fantasy'
|
|
247
44
|
});
|
|
248
45
|
|
|
249
|
-
// Generate
|
|
250
|
-
const event = generator.generateEvent(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
### Basic Event Generation
|
|
256
|
-
|
|
257
|
-
```javascript
|
|
258
|
-
const generator = new RPGEventGenerator();
|
|
259
|
-
const event = generator.generateEvent();
|
|
46
|
+
// Generate context aware event
|
|
47
|
+
const event = generator.generateEvent({
|
|
48
|
+
level: 15,
|
|
49
|
+
gold: 2500,
|
|
50
|
+
class: 'wizard'
|
|
51
|
+
});
|
|
260
52
|
|
|
261
|
-
console.log(event);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
// title: "Perilous Bandit King's Challenge",
|
|
265
|
-
// description: "Generated narrative based on Markov chains...",
|
|
266
|
-
// choices: [
|
|
267
|
-
// { text: "Fight back", effect: { health: -20, reputation: 25 } },
|
|
268
|
-
// { text: "Pay tribute", effect: { gold: -200, safe_passage: true } }
|
|
269
|
-
// ],
|
|
270
|
-
// type: "BANDIT_KING",
|
|
271
|
-
// difficulty: "normal"
|
|
272
|
-
// }
|
|
53
|
+
console.log(event.title);
|
|
54
|
+
console.log(event.description);
|
|
55
|
+
console.log(event.choices);
|
|
273
56
|
```
|
|
274
57
|
|
|
275
|
-
|
|
58
|
+
## ๐จ Advanced Usage
|
|
276
59
|
|
|
60
|
+
### World Building
|
|
277
61
|
```javascript
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
influence: 40,
|
|
282
|
-
reputation: 25,
|
|
283
|
-
career: 'noble',
|
|
284
|
-
skills: { diplomacy: 70, combat: 45, intrigue: 30 },
|
|
285
|
-
relationships: [
|
|
286
|
-
{ name: 'Lord Harrington', type: 'ally', relationship: 60 }
|
|
287
|
-
],
|
|
288
|
-
location: 'capital',
|
|
289
|
-
season: 'winter'
|
|
290
|
-
};
|
|
62
|
+
// Generate complete game world
|
|
63
|
+
const world = await generator.generateWorld();
|
|
64
|
+
console.log(`World: ${world.regions.length} regions, ${world.factions.length} factions`);
|
|
291
65
|
|
|
292
|
-
|
|
293
|
-
|
|
66
|
+
// Simulate history
|
|
67
|
+
await generator.simulateWorldYears(50);
|
|
68
|
+
const history = generator.getHistoricalEvents();
|
|
294
69
|
```
|
|
295
70
|
|
|
296
|
-
### Custom
|
|
297
|
-
|
|
298
|
-
Enhance text generation with your own story fragments:
|
|
299
|
-
|
|
71
|
+
### Custom Templates
|
|
300
72
|
```javascript
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
'The enchanted forest whispers secrets to those who listen carefully'
|
|
309
|
-
];
|
|
310
|
-
|
|
311
|
-
const generator = new RPGEventGenerator({
|
|
312
|
-
trainingData: customTrainingData
|
|
73
|
+
// Register conditional template
|
|
74
|
+
generator.registerTemplate('merchant', {
|
|
75
|
+
title: "Merchant Encounter",
|
|
76
|
+
conditional_choices: [{
|
|
77
|
+
condition: { player_gold: { gt: 1000 } },
|
|
78
|
+
choice: { text: "Buy rare artifact", effect: { gold: -500 } }
|
|
79
|
+
}]
|
|
313
80
|
});
|
|
314
|
-
|
|
315
|
-
// Events will now incorporate your custom story elements
|
|
316
|
-
const event = generator.generateEvent();
|
|
317
|
-
// May generate: "In the shadowed alleys of the ancient city, a mysterious stranger approaches..."
|
|
318
81
|
```
|
|
319
82
|
|
|
320
|
-
###
|
|
321
|
-
|
|
83
|
+
### AI Enhancement
|
|
322
84
|
```javascript
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
theme: 'fantasy',
|
|
329
|
-
culture: 'norse'
|
|
330
|
-
});
|
|
331
|
-
const norseEvent = norseGen.generateEvent();
|
|
332
|
-
// Generates: "The longships sail into the fjord under the northern lights..."
|
|
333
|
-
|
|
334
|
-
// Sci-fi - corporations, AI, space exploration
|
|
335
|
-
const sciFiGen = new RPGEventGenerator({ theme: 'sci-fi' });
|
|
336
|
-
|
|
337
|
-
// Cyberpunk sci-fi - neon cities, megacorps, hackers
|
|
338
|
-
const cyberpunkGen = new RPGEventGenerator({
|
|
339
|
-
theme: 'sci-fi',
|
|
340
|
-
culture: 'cyberpunk'
|
|
341
|
-
});
|
|
342
|
-
const cyberEvent = cyberpunkGen.generateEvent();
|
|
343
|
-
// Generates: "Neon lights reflect off rain-slicked streets in the megacity sprawl..."
|
|
344
|
-
|
|
345
|
-
// Historical - medieval politics, exploration, warfare
|
|
346
|
-
const historicalGen = new RPGEventGenerator({ theme: 'historical' });
|
|
347
|
-
|
|
348
|
-
// Victorian historical - industrial revolution, social reform
|
|
349
|
-
const victorianGen = new RPGEventGenerator({
|
|
350
|
-
theme: 'historical',
|
|
351
|
-
culture: 'victorian'
|
|
85
|
+
const aiGenerator = new RPGEventGenerator({
|
|
86
|
+
aiEnhancement: {
|
|
87
|
+
provider: 'openai',
|
|
88
|
+
apiKey: process.env.OPENAI_API_KEY
|
|
89
|
+
}
|
|
352
90
|
});
|
|
353
|
-
const victorianEvent = victorianGen.generateEvent();
|
|
354
|
-
// Generates: "Steam engines power the industrial revolution across soot-stained cities..."
|
|
355
91
|
```
|
|
356
92
|
|
|
357
|
-
|
|
93
|
+
## ๐ง Configuration
|
|
358
94
|
|
|
359
95
|
```javascript
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const activeChains = generator.getActiveChains();
|
|
373
|
-
console.log(`Active chains: ${activeChains.length}`);
|
|
374
|
-
|
|
375
|
-
// Available built-in chains:
|
|
376
|
-
// - BANDIT_RISING: Highway robbery escalating to kingdom threat
|
|
377
|
-
// - COURT_SCANDAL_CHAIN: Royal intrigue with multiple betrayals
|
|
378
|
-
// - CURSE_OF_THE_ARTIFACT: Ancient curse with escalating effects
|
|
379
|
-
// - MERCHANT_EMPIRE: Trade empire building with setbacks
|
|
96
|
+
const config = {
|
|
97
|
+
theme: 'fantasy',
|
|
98
|
+
enableAI: false,
|
|
99
|
+
enableDatabase: false,
|
|
100
|
+
enableCaching: true,
|
|
101
|
+
maxParallelGeneration: 4,
|
|
102
|
+
|
|
103
|
+
aiEnhancement: {
|
|
104
|
+
provider: 'openai',
|
|
105
|
+
apiKey: 'your-key'
|
|
106
|
+
}
|
|
107
|
+
};
|
|
380
108
|
```
|
|
381
109
|
|
|
382
|
-
|
|
110
|
+
## ๐ API
|
|
383
111
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (event.type === 'time_based_chain') {
|
|
390
|
-
const chainData = generator.timeSystem.timeBasedEvents.get(event.chainId);
|
|
391
|
-
const gameEvent = generator.generateChainEvent(chainData);
|
|
392
|
-
// Add to your game's event system
|
|
393
|
-
}
|
|
394
|
-
});
|
|
112
|
+
- `generateEvent(context)` - Generate single event
|
|
113
|
+
- `generateEvents(context, count)` - Generate multiple events
|
|
114
|
+
- `generateWorld()` - Create game world
|
|
115
|
+
- `registerTemplate(id, template)` - Add custom template
|
|
116
|
+
- `exportTemplates(format, path)` - Export to game engines
|
|
395
117
|
|
|
396
|
-
|
|
397
|
-
generator.startTimeBasedChain('POLITICAL_UPRISING');
|
|
398
|
-
// - Day 1: Whispers of dissent appear
|
|
399
|
-
// - Day 7: Public protests erupt
|
|
400
|
-
// - Day 14: Open rebellion begins
|
|
401
|
-
// - Day 21: Revolutionary climax
|
|
118
|
+
Full API docs: [Documentation](https://decept1kon.github.io/rpg-event-generator/)
|
|
402
119
|
|
|
403
|
-
|
|
404
|
-
const currentTime = generator.getCurrentTime();
|
|
405
|
-
console.log(`Day ${currentTime.day}, Season: ${currentTime.season}`);
|
|
406
|
-
```
|
|
120
|
+
## ๐ License
|
|
407
121
|
|
|
408
|
-
|
|
122
|
+
MIT License - see [LICENSE](LICENSE) file.
|
|
409
123
|
|
|
410
|
-
|
|
124
|
+
## ๐ฏ Use Cases & Examples
|
|
411
125
|
|
|
126
|
+
### Gaming Applications
|
|
412
127
|
```javascript
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
128
|
+
// RPG Character Interactions
|
|
129
|
+
const generator = new RPGEventGenerator({ theme: 'fantasy' });
|
|
130
|
+
const playerState = {
|
|
131
|
+
level: 15,
|
|
132
|
+
class: 'wizard',
|
|
133
|
+
gold: 2500,
|
|
134
|
+
reputation: 75
|
|
135
|
+
};
|
|
421
136
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
console.log(event.title); // "Embuscade de Brigands"
|
|
137
|
+
const event = generator.generateEvent(playerState);
|
|
138
|
+
// Result: "The ancient tome pulses with magical energy..."
|
|
425
139
|
```
|
|
426
140
|
|
|
427
|
-
###
|
|
428
|
-
|
|
429
|
-
Weather, season, and location affect event generation:
|
|
430
|
-
|
|
141
|
+
### Business Simulations
|
|
431
142
|
```javascript
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
143
|
+
// Customer Service Scenarios
|
|
144
|
+
const businessGenerator = new RPGEventGenerator({
|
|
145
|
+
trainingData: [
|
|
146
|
+
'Customer reports billing discrepancy',
|
|
147
|
+
'Technical support ticket resolved',
|
|
148
|
+
'Product feedback received and processed'
|
|
149
|
+
]
|
|
439
150
|
});
|
|
440
151
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
152
|
+
const scenario = businessGenerator.generateEvent({
|
|
153
|
+
department: 'support',
|
|
154
|
+
priority: 'high',
|
|
155
|
+
customerValue: 85
|
|
444
156
|
});
|
|
445
157
|
```
|
|
446
158
|
|
|
447
|
-
###
|
|
448
|
-
|
|
449
|
-
Complex prerequisite systems control when events can occur:
|
|
450
|
-
|
|
159
|
+
### Educational Tools
|
|
451
160
|
```javascript
|
|
452
|
-
//
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
161
|
+
// Interactive Learning Scenarios
|
|
162
|
+
const educationGenerator = new RPGEventGenerator({
|
|
163
|
+
theme: 'historical',
|
|
164
|
+
culture: 'educational'
|
|
456
165
|
});
|
|
457
166
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
{ type: 'event_completed', eventId: 'BASIC_QUEST' }
|
|
463
|
-
]
|
|
167
|
+
const lesson = educationGenerator.generateEvent({
|
|
168
|
+
subject: 'history',
|
|
169
|
+
difficulty: 'intermediate',
|
|
170
|
+
learningObjectives: ['critical_thinking', 'decision_making']
|
|
464
171
|
});
|
|
465
|
-
|
|
466
|
-
// Only generate events whose dependencies are met
|
|
467
|
-
const gameState = { completedEvents: new Set(['COURT_INTRODUCTION']) };
|
|
468
|
-
const event = generator.generateEnhancedEvent({ gameState });
|
|
469
172
|
```
|
|
470
173
|
|
|
471
|
-
###
|
|
472
|
-
|
|
473
|
-
Dynamic character relationships that evolve based on player actions:
|
|
474
|
-
|
|
174
|
+
### Research & Data Simulation
|
|
475
175
|
```javascript
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
id: 'king_arthur',
|
|
481
|
-
name: 'King Arthur',
|
|
482
|
-
type: 'noble'
|
|
176
|
+
// User Behavior Modeling
|
|
177
|
+
const researchGenerator = new RPGEventGenerator({
|
|
178
|
+
enableRelationships: true,
|
|
179
|
+
enableModifiers: true
|
|
483
180
|
});
|
|
484
181
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
generator.updateRelationship('merchant_john', 'player', -10, 'stole goods');
|
|
490
|
-
// Relationship with merchant deteriorates
|
|
491
|
-
|
|
492
|
-
// Generate events that consider relationship context
|
|
493
|
-
const event = generator.generateEnhancedEvent({
|
|
494
|
-
player: { id: 'player' }
|
|
182
|
+
const simulation = researchGenerator.generateEvent({
|
|
183
|
+
userType: 'research_subject',
|
|
184
|
+
conditions: ['experimental', 'controlled'],
|
|
185
|
+
variables: ['time_pressure', 'cognitive_load']
|
|
495
186
|
});
|
|
496
187
|
```
|
|
497
188
|
|
|
498
|
-
|
|
189
|
+
## ๐ Latest Features (v2.0.0)
|
|
499
190
|
|
|
500
|
-
|
|
191
|
+
### Database Integration
|
|
192
|
+
Store and retrieve templates from databases for large-scale applications:
|
|
501
193
|
|
|
502
194
|
```javascript
|
|
503
|
-
const generator = new RPGEventGenerator({
|
|
504
|
-
enableTemplates: true,
|
|
505
|
-
templateLibrary: 'fantasy' // Load fantasy templates
|
|
506
|
-
});
|
|
195
|
+
const generator = new RPGEventGenerator({ enableDatabase: true });
|
|
507
196
|
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
// Generate random event from genre
|
|
513
|
-
const fantasyEvent = generator.generateFromGenre('fantasy');
|
|
514
|
-
|
|
515
|
-
// Discover available templates
|
|
516
|
-
const availableTemplates = generator.getAvailableTemplates();
|
|
517
|
-
console.log(Object.keys(availableTemplates)); // ['fantasy', 'sci-fi', etc.]
|
|
197
|
+
await generator.storeTemplateInDatabase(customTemplate);
|
|
198
|
+
const retrieved = await generator.getTemplateFromDatabase('template_id');
|
|
199
|
+
const searchResults = await generator.searchTemplatesInDatabase({ type: 'combat' });
|
|
518
200
|
```
|
|
519
201
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
```bash
|
|
523
|
-
# Export templates for different engines
|
|
524
|
-
npm run export:unity fantasy # Unity C# ScriptableObjects
|
|
525
|
-
npm run export:godot cyberpunk # Godot GDScript Resources
|
|
526
|
-
npm run export:typescript space-opera # TypeScript interfaces
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
Each template includes:
|
|
530
|
-
- **Rich narratives** with atmospheric descriptions
|
|
531
|
-
- **Multiple meaningful choices** with consequences
|
|
532
|
-
- **Difficulty scaling** and context requirements
|
|
533
|
-
- **Professional quality** event design
|
|
534
|
-
|
|
535
|
-
**Available genres**: 'fantasy', 'sci-fi', 'horror', 'historical', 'modern', 'cyberpunk', 'space-opera'
|
|
536
|
-
|
|
537
|
-
#### Custom Template Creation
|
|
538
|
-
Add your own templates to the library system:
|
|
202
|
+
### World Building System
|
|
203
|
+
Generate entire game worlds with factions, regions, and historical events:
|
|
539
204
|
|
|
540
205
|
```javascript
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
narrative: 'Critical system failure detected. Alarms blare throughout the station.',
|
|
545
|
-
choices: [
|
|
546
|
-
{
|
|
547
|
-
text: 'Attempt emergency repair',
|
|
548
|
-
effect: { risk: 30, engineering: 20 },
|
|
549
|
-
consequence: 'repair_attempt'
|
|
550
|
-
},
|
|
551
|
-
{
|
|
552
|
-
text: 'Abandon the station',
|
|
553
|
-
effect: { survival: 10, resources: -50 },
|
|
554
|
-
consequence: 'abandon_station'
|
|
555
|
-
}
|
|
556
|
-
],
|
|
557
|
-
type: 'TECHNICAL_CRISIS',
|
|
558
|
-
difficulty: 'hard',
|
|
559
|
-
tags: ['space', 'technology', 'emergency']
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
// Add to your game's template collection
|
|
563
|
-
// Templates can be saved as JSON files in custom directories
|
|
206
|
+
const world = await generator.generateWorld();
|
|
207
|
+
await generator.simulateWorldYears(50); // Advance world history
|
|
208
|
+
const factionPower = generator.getFactionPowerRanking();
|
|
564
209
|
```
|
|
565
210
|
|
|
566
|
-
###
|
|
211
|
+
### Advanced Template Features
|
|
212
|
+
Create complex, conditional templates with inheritance and composition:
|
|
567
213
|
|
|
568
214
|
```javascript
|
|
569
|
-
//
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
{
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
consequence: 'visionary'
|
|
578
|
-
},
|
|
579
|
-
{
|
|
580
|
-
text: 'Dismiss it as a dream',
|
|
581
|
-
effect: { stress: -10 },
|
|
582
|
-
consequence: 'skeptical'
|
|
583
|
-
}
|
|
584
|
-
]
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
generator.registerEventTemplate('MYSTIC_VISION', customTemplate);
|
|
588
|
-
|
|
589
|
-
// Add custom training data for better text generation
|
|
590
|
-
generator.addCustomTrainingData([
|
|
591
|
-
'The ancient prophecy foretells of great change',
|
|
592
|
-
'Mystic visions reveal hidden truths to the worthy',
|
|
593
|
-
'Dreams of the future guide the destinies of heroes'
|
|
594
|
-
], 'mystical');
|
|
595
|
-
|
|
596
|
-
// Create custom event chains
|
|
597
|
-
const visionChain = {
|
|
598
|
-
name: 'Prophetic Journey',
|
|
599
|
-
description: 'A chain of events triggered by mystic visions',
|
|
600
|
-
stages: [
|
|
601
|
-
{ day: 1, template: 'MYSTIC_VISION' },
|
|
602
|
-
{ day: 5, template: 'ANCIENT_RUINS' },
|
|
603
|
-
{ day: 10, template: 'FINAL_PROPHECY' }
|
|
604
|
-
]
|
|
215
|
+
// Conditional templates
|
|
216
|
+
const conditionalTemplate = {
|
|
217
|
+
id: 'level_based_event',
|
|
218
|
+
conditions: [{ type: 'stat_requirement', field: 'level', operator: 'gte', value: 10 }],
|
|
219
|
+
conditional_choices: [{
|
|
220
|
+
condition: { type: 'has_item', item: 'magic_sword' },
|
|
221
|
+
choice: { text: 'Use magic sword', effect: { damage: 50 } }
|
|
222
|
+
}]
|
|
605
223
|
};
|
|
606
224
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
### Dynamic Difficulty Scaling
|
|
619
|
-
|
|
620
|
-
Events automatically scale based on player power level:
|
|
621
|
-
|
|
622
|
-
```javascript
|
|
623
|
-
// Weak character (easy difficulty)
|
|
624
|
-
const weakling = {
|
|
625
|
-
gold: 50,
|
|
626
|
-
influence: 10,
|
|
627
|
-
skills: { combat: 20 }
|
|
628
|
-
};
|
|
629
|
-
const easyEvent = generator.generateEvent(weakling);
|
|
630
|
-
console.log(`Difficulty: ${easyEvent.difficulty}`); // "easy"
|
|
631
|
-
// Effects scaled for beginners: higher rewards, lower penalties
|
|
632
|
-
|
|
633
|
-
// Powerful character (hard difficulty)
|
|
634
|
-
const hero = {
|
|
635
|
-
gold: 50000,
|
|
636
|
-
influence: 500,
|
|
637
|
-
skills: { combat: 100, diplomacy: 80 },
|
|
638
|
-
relationships: [{ name: 'King', type: 'ally', relationship: 80 }]
|
|
225
|
+
// Template composition
|
|
226
|
+
const composedTemplate = {
|
|
227
|
+
id: 'weather_merchant',
|
|
228
|
+
composition: [{
|
|
229
|
+
template_id: 'merchant_base',
|
|
230
|
+
merge_strategy: 'append_narrative'
|
|
231
|
+
}, {
|
|
232
|
+
template_id: 'weather_effects',
|
|
233
|
+
conditions: [{ type: 'random_chance', probability: 0.6 }]
|
|
234
|
+
}]
|
|
639
235
|
};
|
|
640
|
-
const hardEvent = generator.generateEvent(hero);
|
|
641
|
-
console.log(`Difficulty: ${hardEvent.difficulty}`); // "hard"
|
|
642
|
-
// Effects scaled for challenge: lower rewards, higher penalties
|
|
643
|
-
|
|
644
|
-
// Legendary character (legendary difficulty)
|
|
645
|
-
const godlike = {
|
|
646
|
-
gold: 200000,
|
|
647
|
-
influence: 1000,
|
|
648
|
-
skills: { combat: 200, diplomacy: 150 },
|
|
649
|
-
age: 120,
|
|
650
|
-
reputation: 95
|
|
651
|
-
};
|
|
652
|
-
const epicEvent = generator.generateEvent(godlike);
|
|
653
|
-
console.log(`Difficulty: ${epicEvent.difficulty}`); // "legendary"
|
|
654
|
-
// Effects scaled for epic gameplay: minimal rewards, maximum penalties
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
**Difficulty Tiers:**
|
|
658
|
-
- **Easy** (Power 0-50): Generous rewards, forgiving penalties
|
|
659
|
-
- **Normal** (Power 25-150): Standard scaling, balanced challenges
|
|
660
|
-
- **Hard** (Power 100-300): Reduced rewards, harsher penalties
|
|
661
|
-
- **Legendary** (Power 250+): Minimal rewards, extreme challenges
|
|
662
|
-
|
|
663
|
-
## ๐ง API Reference
|
|
664
|
-
|
|
665
|
-
### Constructor Options
|
|
666
|
-
|
|
667
|
-
```javascript
|
|
668
|
-
const generator = new RPGEventGenerator({
|
|
669
|
-
// Core options
|
|
670
|
-
stateSize: 2, // Markov chain state size (default: 2)
|
|
671
|
-
trainingData: [...], // Custom training data array
|
|
672
|
-
theme: 'fantasy', // 'fantasy', 'sci-fi', 'historical'
|
|
673
|
-
culture: 'norse', // Cultural variant within theme
|
|
674
|
-
|
|
675
|
-
// Enhanced features (all enabled by default)
|
|
676
|
-
enableDependencies: true, // Complex event prerequisites
|
|
677
|
-
enableModifiers: true, // Weather/season/location modifiers
|
|
678
|
-
enableRelationships: true, // NPC relationship networks
|
|
679
|
-
language: 'en' // Default language for events
|
|
680
|
-
});
|
|
681
|
-
```
|
|
682
|
-
|
|
683
|
-
### Core Methods
|
|
684
|
-
|
|
685
|
-
- `generateEvent(playerContext)` - Generate single event
|
|
686
|
-
- `generateEvents(playerContext, count)` - Generate multiple events
|
|
687
|
-
- `generateTimeAwareEvent(playerContext)` - Generate season-aware event
|
|
688
|
-
|
|
689
|
-
### Event Chain Methods
|
|
690
|
-
|
|
691
|
-
- `startChain(chainId)` - Start choice-based event chain
|
|
692
|
-
- `advanceChain(chainId, choice)` - Advance chain based on choice
|
|
693
|
-
- `getActiveChains()` - Get all active chains
|
|
694
|
-
|
|
695
|
-
### Time-Based Methods
|
|
696
|
-
|
|
697
|
-
- `advanceGameDay()` - Advance time and return due events
|
|
698
|
-
- `startTimeBasedChain(chainId)` - Start time-evolving chain
|
|
699
|
-
- `getCurrentTime()` - Get current game time/season
|
|
700
|
-
- `getActiveTimeChains()` - Get active time-based chains
|
|
701
|
-
|
|
702
|
-
### Game State Methods
|
|
703
|
-
|
|
704
|
-
- `getGameState()` - Export complete game state
|
|
705
|
-
- `loadGameState(state)` - Import saved game state
|
|
706
|
-
|
|
707
|
-
### Modular Methods
|
|
708
|
-
|
|
709
|
-
- `registerEventTemplate(id, template)` - Add custom event template
|
|
710
|
-
- `addCustomTrainingData(data, category)` - Add custom training data
|
|
711
|
-
- `registerEventChain(id, chainConfig)` - Add custom event chain
|
|
712
|
-
- `exportCustomContent()` - Export custom templates/chains/data
|
|
713
|
-
- `importCustomContent(content)` - Import custom content
|
|
714
|
-
|
|
715
|
-
### Player Context Object
|
|
716
|
-
|
|
717
|
-
```javascript
|
|
718
|
-
{
|
|
719
|
-
age: number, // Player age
|
|
720
|
-
gold: number, // Player wealth
|
|
721
|
-
influence: number, // Political/social influence
|
|
722
|
-
reputation: number, // Social reputation
|
|
723
|
-
career: string, // Player's career/job ('noble', 'merchant', 'warrior', etc.)
|
|
724
|
-
skills: { // Skill levels object
|
|
725
|
-
combat: number, // 0-100 scale
|
|
726
|
-
diplomacy: number,
|
|
727
|
-
intrigue: number,
|
|
728
|
-
magic: number,
|
|
729
|
-
survival: number
|
|
730
|
-
},
|
|
731
|
-
relationships: [{ // Array of NPC relationships
|
|
732
|
-
name: string, // NPC name
|
|
733
|
-
type: string, // 'friend', 'lover', 'ally', 'enemy', 'rival'
|
|
734
|
-
relationship: number // Relationship strength (0-100)
|
|
735
|
-
}],
|
|
736
|
-
location: string, // Current location ('capital', 'village', 'forest', etc.)
|
|
737
|
-
season: string // Current season ('spring', 'summer', 'autumn', 'winter')
|
|
738
|
-
}
|
|
739
|
-
```
|
|
740
|
-
|
|
741
|
-
### Complete Event Object Structure
|
|
742
|
-
|
|
743
|
-
```javascript
|
|
744
|
-
{
|
|
745
|
-
id: "event_1704567890123_xyz789", // Unique event identifier
|
|
746
|
-
title: "Perilous Bandit King's Challenge", // Dynamic, context-aware title
|
|
747
|
-
description: "The infamous bandit king blocks your path, offering you a choice...", // Rich procedural description
|
|
748
|
-
narrative: "The infamous bandit king blocks your path, offering you a choice: join his band or face certain death.",
|
|
749
|
-
choices: [
|
|
750
|
-
{
|
|
751
|
-
text: "Join the bandits",
|
|
752
|
-
effect: { gold: 375, reputation: -23, combat_skill: 12 },
|
|
753
|
-
consequence: "bandit"
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
text: "Challenge him to single combat",
|
|
757
|
-
effect: { reputation: 32, health: -18 },
|
|
758
|
-
requirements: { combat_skill: 60 },
|
|
759
|
-
consequence: "hero"
|
|
760
|
-
},
|
|
761
|
-
{
|
|
762
|
-
text: "Bribe your way past",
|
|
763
|
-
effect: { gold: -320, safe_passage: true },
|
|
764
|
-
consequence: "diplomat"
|
|
765
|
-
}
|
|
766
|
-
],
|
|
767
|
-
type: "BANDIT_KING",
|
|
768
|
-
consequence: null,
|
|
769
|
-
context: { /* Full context used for generation */ },
|
|
770
|
-
urgency: "normal",
|
|
771
|
-
theme: "adventure",
|
|
772
|
-
difficulty: "normal"
|
|
773
|
-
|
|
774
|
-
}
|
|
775
236
|
```
|
|
776
237
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
Create completely custom game worlds with your own atmospheric text and storytelling style.
|
|
780
|
-
|
|
781
|
-
### Custom Theme Creation
|
|
238
|
+
### Performance Optimizations
|
|
239
|
+
Handle large-scale generation with advanced caching and parallel processing:
|
|
782
240
|
|
|
783
241
|
```javascript
|
|
784
242
|
const generator = new RPGEventGenerator({
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
'Neon-lit cantinas echo with the hum of quantum pianos',
|
|
788
|
-
'Laser revolvers fire streams of pure starlight',
|
|
789
|
-
'Alien saloons serve drinks that change your memories',
|
|
790
|
-
'Robotic sheriffs maintain order in floating colonies'
|
|
791
|
-
],
|
|
792
|
-
theme: 'sci-fi',
|
|
793
|
-
culture: 'western'
|
|
243
|
+
enableTemplateCaching: true,
|
|
244
|
+
enableEventCaching: true
|
|
794
245
|
});
|
|
795
246
|
|
|
796
|
-
//
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
});
|
|
247
|
+
// Generate events in parallel
|
|
248
|
+
const events = await generator.generateEventsParallel(100, context, 4); // 4 threads
|
|
249
|
+
// Generate in batches for memory efficiency
|
|
250
|
+
const batchedEvents = generator.generateEventsBatched(1000, context, 50); // 50 events per batch
|
|
801
251
|
```
|
|
802
252
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
Generate events using only your custom training data - completely bypassing templates.
|
|
806
|
-
|
|
807
|
-
```javascript
|
|
808
|
-
const pureGenerator = new RPGEventGenerator({
|
|
809
|
-
trainingData: [
|
|
810
|
-
'Crystal caves echo with ancient magic',
|
|
811
|
-
'Shadowy figures move through fog-shrouded forests',
|
|
812
|
-
'Forgotten ruins hide treasures and traps',
|
|
813
|
-
'Mysterious merchants offer enchanted artifacts',
|
|
814
|
-
'Wandering bards sing tales of lost kingdoms'
|
|
815
|
-
],
|
|
816
|
-
pureMarkovMode: true, // No templates used
|
|
817
|
-
enableTemplates: false
|
|
818
|
-
});
|
|
253
|
+
## Installation
|
|
819
254
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
// Type: "MARKOV_GENERATED"
|
|
823
|
-
// Title: "Crystal caves echo with ancient magic."
|
|
824
|
-
// Description: Generated purely from your atmospheric training sentences
|
|
255
|
+
```bash
|
|
256
|
+
npm install rpg-event-generator
|
|
825
257
|
```
|
|
826
258
|
|
|
827
|
-
|
|
259
|
+
### Requirements
|
|
260
|
+
- Node.js 16+
|
|
261
|
+
- TypeScript 4.5+ (for development)
|
|
828
262
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
### Basic Rule Creation
|
|
263
|
+
## Quick Start
|
|
832
264
|
|
|
833
265
|
```javascript
|
|
834
|
-
|
|
835
|
-
enableRuleEngine: true
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
// Add a wealthy player bonus
|
|
839
|
-
generator.addCustomRule('wealthy_bonus', {
|
|
840
|
-
conditions: [
|
|
841
|
-
{ type: 'stat_greater_than', params: { stat: 'gold', value: 1000 } }
|
|
842
|
-
],
|
|
843
|
-
effects: {
|
|
844
|
-
addTags: ['wealthy_player'],
|
|
845
|
-
modifyChoices: {
|
|
846
|
-
multiply: { gold: 1.3 }, // 30% more gold rewards
|
|
847
|
-
add: { reputation: 5 } // Bonus reputation
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
|
|
852
|
-
// Events for wealthy players get enhanced
|
|
853
|
-
const wealthyEvent = generator.generateEvent({ gold: 2000 });
|
|
854
|
-
console.log(wealthyEvent.tags); // Includes 'wealthy_player'
|
|
855
|
-
```
|
|
856
|
-
|
|
857
|
-
### Advanced Rule Conditions
|
|
266
|
+
import { RPGEventGenerator, generateRPGEvent } from 'rpg-event-generator';
|
|
858
267
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
{ type: 'career_is', params: { career: 'noble' } },
|
|
866
|
-
{ type: 'location_is', params: { location: 'castle' } },
|
|
867
|
-
{ type: 'stat_greater_than', params: { stat: 'influence', value: 50 } }
|
|
868
|
-
]
|
|
869
|
-
}}
|
|
870
|
-
],
|
|
871
|
-
effects: {
|
|
872
|
-
modifyTitle: { append: ' (Royal Privilege)' },
|
|
873
|
-
setDifficulty: 'hard',
|
|
874
|
-
addTags: ['noble_bonus', 'court_influence']
|
|
875
|
-
}
|
|
268
|
+
// Simple event generation
|
|
269
|
+
const event = generateRPGEvent({
|
|
270
|
+
age: 25,
|
|
271
|
+
gold: 500,
|
|
272
|
+
influence: 15,
|
|
273
|
+
career: 'merchant'
|
|
876
274
|
});
|
|
877
275
|
|
|
878
|
-
//
|
|
879
|
-
//
|
|
880
|
-
//
|
|
881
|
-
// - has_item, relationship_status
|
|
882
|
-
// - random_chance
|
|
883
|
-
// - and, or, not (for combining conditions)
|
|
884
|
-
```
|
|
885
|
-
|
|
886
|
-
### Rule Management
|
|
887
|
-
|
|
888
|
-
```javascript
|
|
889
|
-
// Validate rules before adding
|
|
890
|
-
const rule = { /* your rule */ };
|
|
891
|
-
const validation = generator.validateCustomRule(rule);
|
|
892
|
-
if (validation.valid) {
|
|
893
|
-
generator.addCustomRule('my_rule', rule);
|
|
894
|
-
} else {
|
|
895
|
-
console.log('Rule errors:', validation.errors);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
// Manage rules
|
|
899
|
-
console.log(generator.getCustomRules()); // View all rules
|
|
900
|
-
generator.removeCustomRule('my_rule'); // Remove specific rule
|
|
901
|
-
generator.clearCustomRules(); // Remove all rules
|
|
902
|
-
```
|
|
903
|
-
|
|
904
|
-
## ๐ v2.0.0 Cross-Platform Export
|
|
905
|
-
|
|
906
|
-
Export your events directly to game engines.
|
|
907
|
-
|
|
908
|
-
### Unity Integration
|
|
909
|
-
|
|
910
|
-
```javascript
|
|
911
|
-
// Programmatic export
|
|
912
|
-
const exporter = require('./scripts/export-templates.js');
|
|
913
|
-
exporter.exportTemplates('unity', 'fantasy');
|
|
914
|
-
|
|
915
|
-
// Creates: templates/unity/fantasy/event_1.cs
|
|
916
|
-
// Result: Event1.cs - Unity ScriptableObject
|
|
917
|
-
```
|
|
918
|
-
|
|
919
|
-
```bash
|
|
920
|
-
# Using npm scripts
|
|
921
|
-
npm run export:unity fantasy
|
|
922
|
-
|
|
923
|
-
# Direct script call
|
|
924
|
-
node scripts/export-templates.js unity fantasy
|
|
925
|
-
```
|
|
926
|
-
|
|
927
|
-
### Godot Integration
|
|
928
|
-
|
|
929
|
-
```javascript
|
|
930
|
-
// Export for Godot
|
|
931
|
-
const exporter = require('./scripts/export-templates.js');
|
|
932
|
-
exporter.exportTemplates('godot', 'cyberpunk');
|
|
933
|
-
|
|
934
|
-
// Creates: templates/godot/cyberpunk/event_1.gd
|
|
935
|
-
// Result: Event1.gd - Godot Resource script
|
|
936
|
-
```
|
|
937
|
-
|
|
938
|
-
```bash
|
|
939
|
-
# Using npm scripts
|
|
940
|
-
npm run export:godot cyberpunk
|
|
941
|
-
|
|
942
|
-
# Direct script call
|
|
943
|
-
node scripts/export-templates.js godot cyberpunk
|
|
276
|
+
console.log(event.title); // "Golden Opportunity"
|
|
277
|
+
console.log(event.description); // Procedurally generated narrative
|
|
278
|
+
console.log(event.choices); // Array of meaningful choices
|
|
944
279
|
```
|
|
945
280
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
```javascript
|
|
949
|
-
// Export as TypeScript interfaces
|
|
950
|
-
const exporter = require('./scripts/export-templates.js');
|
|
951
|
-
exporter.exportTemplates('typescript', 'space-opera');
|
|
281
|
+
## Demo
|
|
952
282
|
|
|
953
|
-
|
|
954
|
-
// Result: Strongly-typed event definitions
|
|
955
|
-
```
|
|
283
|
+
Run the included demo to explore all features:
|
|
956
284
|
|
|
957
285
|
```bash
|
|
958
|
-
# Using npm
|
|
959
|
-
npm run
|
|
286
|
+
# Using npm script (recommended)
|
|
287
|
+
npm run demo
|
|
960
288
|
|
|
961
289
|
# Direct script call
|
|
962
|
-
node
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
## ๐ v2.0.0 Enhanced Template Library
|
|
966
|
-
|
|
967
|
-
Generate 400+ professionally crafted events across 7 genres:
|
|
968
|
-
|
|
969
|
-
- **Fantasy**: Knights, dragons, magic, medieval politics
|
|
970
|
-
- **Sci-Fi**: Space exploration, technology, alien encounters
|
|
971
|
-
- **Horror**: Supernatural terror, psychological horror
|
|
972
|
-
- **Historical**: Medieval courts, exploration, diplomacy
|
|
973
|
-
- **Modern**: Contemporary settings, urban adventures
|
|
974
|
-
- **Cyberpunk**: Neon cities, hackers, megacorporations
|
|
975
|
-
- **Space Opera**: Galactic empires, starships, cosmic conflicts
|
|
976
|
-
|
|
977
|
-
### Template Integration
|
|
978
|
-
|
|
979
|
-
```javascript
|
|
980
|
-
// Load genre-specific templates
|
|
981
|
-
const fantasyGen = new RPGEventGenerator({
|
|
982
|
-
enableTemplates: true,
|
|
983
|
-
templateLibrary: 'fantasy'
|
|
984
|
-
});
|
|
985
|
-
|
|
986
|
-
// Generate from specific genre
|
|
987
|
-
const fantasyEvent = fantasyGen.generateFromGenre('fantasy');
|
|
988
|
-
const horrorEvent = fantasyGen.generateFromTemplate('haunted_mansion');
|
|
989
|
-
|
|
990
|
-
// Available templates
|
|
991
|
-
console.log(fantasyGen.getAvailableTemplates());
|
|
992
|
-
// { fantasy: [...], sci-fi: [...], horror: [...], etc. }
|
|
993
|
-
```
|
|
994
|
-
|
|
995
|
-
## ๐ฏ v2.0.0 API Reference
|
|
996
|
-
|
|
997
|
-
### Constructor Options (v2.0.0 additions)
|
|
998
|
-
|
|
999
|
-
```javascript
|
|
1000
|
-
const generator = new RPGEventGenerator({
|
|
1001
|
-
// v1.x options still supported
|
|
1002
|
-
theme: 'fantasy',
|
|
1003
|
-
culture: 'norse',
|
|
1004
|
-
trainingData: [...],
|
|
1005
|
-
enableModifiers: true,
|
|
1006
|
-
|
|
1007
|
-
// v2.0.0 new options
|
|
1008
|
-
enableRuleEngine: true, // Enable custom rules system
|
|
1009
|
-
customRules: {}, // Pre-load custom rules
|
|
1010
|
-
pureMarkovMode: false, // Generate purely from training data
|
|
1011
|
-
templateLibrary: null, // Load specific template genre
|
|
1012
|
-
chance: new Chance() // Custom Chance.js instance (optional)
|
|
1013
|
-
});
|
|
1014
|
-
```
|
|
1015
|
-
|
|
1016
|
-
### New Methods (v2.0.0)
|
|
1017
|
-
|
|
1018
|
-
```javascript
|
|
1019
|
-
// Rule Engine
|
|
1020
|
-
generator.addCustomRule(name, ruleDefinition);
|
|
1021
|
-
generator.removeCustomRule(name);
|
|
1022
|
-
generator.getCustomRules();
|
|
1023
|
-
generator.clearCustomRules();
|
|
1024
|
-
generator.validateCustomRule(rule);
|
|
1025
|
-
|
|
1026
|
-
// Template System
|
|
1027
|
-
generator.generateFromTemplate(templateId);
|
|
1028
|
-
generator.generateFromGenre(genre);
|
|
1029
|
-
generator.getAvailableTemplates();
|
|
1030
|
-
|
|
1031
|
-
// Export System (via export-templates.js)
|
|
1032
|
-
exporter.exportTemplates('unity', 'fantasy');
|
|
1033
|
-
exporter.exportTemplates('godot', 'cyberpunk');
|
|
1034
|
-
exporter.exportTemplates('typescript', 'space-opera');
|
|
290
|
+
node demo.js
|
|
1035
291
|
```
|
|
1036
292
|
|
|
1037
|
-
|
|
293
|
+
This will demonstrate event generation, chains, time progression, customization, and more.
|
|
1038
294
|
|
|
1039
|
-
|
|
295
|
+
## ๐ง Getting Started
|
|
1040
296
|
|
|
1041
|
-
|
|
1042
|
-
- All existing code continues to work unchanged
|
|
1043
|
-
- v1.x features remain fully functional
|
|
1044
|
-
- No breaking changes to existing API
|
|
297
|
+
### Basic Usage
|
|
1045
298
|
|
|
1046
|
-
**๐ New Features are Opt-in**
|
|
1047
299
|
```javascript
|
|
1048
|
-
// v1.x code - still works perfectly
|
|
1049
300
|
const generator = new RPGEventGenerator();
|
|
1050
301
|
|
|
1051
|
-
//
|
|
1052
|
-
const
|
|
1053
|
-
enableRuleEngine: true, // New feature
|
|
1054
|
-
pureMarkovMode: false, // New feature
|
|
1055
|
-
templateLibrary: 'fantasy' // Enhanced feature
|
|
1056
|
-
});
|
|
1057
|
-
```
|
|
1058
|
-
|
|
1059
|
-
**๐ Performance Improvements**
|
|
1060
|
-
- Optimized rule evaluation
|
|
1061
|
-
- Efficient template loading
|
|
1062
|
-
- Better memory management for large template libraries
|
|
1063
|
-
|
|
1064
|
-
**๐ฒ Custom Randomness Control**
|
|
1065
|
-
```javascript
|
|
1066
|
-
// For games that need deterministic randomness or custom seeding
|
|
1067
|
-
const customChance = new Chance('your-seed-here');
|
|
1068
|
-
const generator = new RPGEventGenerator({
|
|
1069
|
-
chance: customChance // Optional: pass your own Chance instance
|
|
1070
|
-
});
|
|
302
|
+
// Generate a random event
|
|
303
|
+
const event = generator.generateEvent();
|
|
1071
304
|
|
|
1072
|
-
//
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
|
|
305
|
+
// Generate with context
|
|
306
|
+
const contextualEvent = generator.generateEvent({
|
|
307
|
+
age: 30,
|
|
308
|
+
career: 'merchant',
|
|
309
|
+
location: 'market'
|
|
1076
310
|
});
|
|
1077
311
|
```
|
|
1078
312
|
|
|
1079
|
-
##
|
|
313
|
+
## ๐ Documentation & Resources
|
|
1080
314
|
|
|
1081
|
-
###
|
|
315
|
+
### ๐ Comprehensive Guides
|
|
316
|
+
- [Getting Started Guide](./docs/getting-started.md) - Quick start and basic concepts
|
|
317
|
+
- [Basic Usage](./docs/basic-usage.md) - Core functionality and examples
|
|
318
|
+
- [Customization Guide](./docs/customization.md) - Training data and configuration
|
|
319
|
+
- [Advanced Features](./docs/advanced-features.md) - Event chains, time systems, relationships
|
|
320
|
+
- [Template Creation Guide](./docs/template-creation-guide.md) - Creating custom event templates
|
|
321
|
+
- [Game Engine Integration](./docs/game-engine-integration.md) - Unity, Godot, Unreal Engine guides
|
|
322
|
+
- [Troubleshooting](./docs/troubleshooting.md) - Common issues and solutions
|
|
1082
323
|
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
dueEvents.forEach(event => {
|
|
1088
|
-
if (event.type === 'time_based_chain') {
|
|
1089
|
-
const chainData = generator.timeSystem.timeBasedEvents.get(event.chainId);
|
|
1090
|
-
const gameEvent = generator.generateChainEvent(chainData);
|
|
1091
|
-
triggerInGameEvent(gameEvent);
|
|
1092
|
-
} else if (event.type === 'seasonal_random') {
|
|
1093
|
-
const seasonalEvent = generator.generateTimeAwareEvent(playerContext);
|
|
1094
|
-
triggerInGameEvent(seasonalEvent);
|
|
1095
|
-
}
|
|
1096
|
-
});
|
|
1097
|
-
}
|
|
1098
|
-
```
|
|
324
|
+
### ๐ง API Documentation
|
|
325
|
+
- [TypeDoc API Reference](./docs/api/) - Complete API documentation with examples
|
|
326
|
+
- [Quick Reference](./docs/quick-reference.md) - Fast lookup for common operations
|
|
1099
327
|
|
|
1100
|
-
###
|
|
328
|
+
### ๐ ๏ธ Development & Testing
|
|
329
|
+
- Run `npm run demo` to see all 30+ features in action
|
|
330
|
+
- Run `npm run docs` to regenerate API documentation
|
|
331
|
+
- Run `npm test` to execute the comprehensive test suite
|
|
332
|
+
- Check the `demo.js` file for interactive examples
|
|
333
|
+
- Check the `test/` directory for usage examples
|
|
1101
334
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
useEffect(() => {
|
|
1111
|
-
// Generate event when time advances
|
|
1112
|
-
const event = generator.generateEvent(playerStats);
|
|
1113
|
-
setCurrentEvent(event);
|
|
1114
|
-
}, [playerStats, generator]);
|
|
1115
|
-
|
|
1116
|
-
const handleChoice = (choiceIndex) => {
|
|
1117
|
-
const choice = currentEvent.choices[choiceIndex];
|
|
1118
|
-
// Apply effects to player stats
|
|
1119
|
-
applyEffects(choice.effect);
|
|
1120
|
-
setCurrentEvent(null); // Clear event
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
if (!currentEvent) return <div>No active events</div>;
|
|
1124
|
-
|
|
1125
|
-
return (
|
|
1126
|
-
<div className="event-dialog">
|
|
1127
|
-
<h2>{currentEvent.title}</h2>
|
|
1128
|
-
<p>{currentEvent.description}</p>
|
|
1129
|
-
<div className="choices">
|
|
1130
|
-
{currentEvent.choices.map((choice, index) => (
|
|
1131
|
-
<button
|
|
1132
|
-
key={index}
|
|
1133
|
-
onClick={() => handleChoice(index)}
|
|
1134
|
-
className="choice-button"
|
|
1135
|
-
>
|
|
1136
|
-
{choice.text}
|
|
1137
|
-
</button>
|
|
1138
|
-
))}
|
|
1139
|
-
</div>
|
|
1140
|
-
</div>
|
|
1141
|
-
);
|
|
1142
|
-
}
|
|
1143
|
-
```
|
|
335
|
+
### ๐ Key Directories
|
|
336
|
+
- `src/` - Modular TypeScript source code
|
|
337
|
+
- `docs/` - Complete documentation and guides
|
|
338
|
+
- `templates/` - Built-in event templates
|
|
339
|
+
- `test/` - Comprehensive test suite
|
|
340
|
+
- `exports/` - Game engine export formats
|
|
341
|
+
- `test/` - Comprehensive test suite
|
|
1144
342
|
|
|
1145
|
-
|
|
343
|
+
## ๐ค Contributing
|
|
1146
344
|
|
|
1147
|
-
|
|
1148
|
-
// Action Types
|
|
1149
|
-
export const GENERATE_EVENT = 'GENERATE_EVENT';
|
|
1150
|
-
export const RESOLVE_EVENT = 'RESOLVE_EVENT';
|
|
1151
|
-
export const ADVANCE_GAME_DAY = 'ADVANCE_GAME_DAY';
|
|
1152
|
-
|
|
1153
|
-
// Action Creators
|
|
1154
|
-
export const generateEvent = (playerContext) => ({
|
|
1155
|
-
type: GENERATE_EVENT,
|
|
1156
|
-
payload: { playerContext }
|
|
1157
|
-
});
|
|
345
|
+
We welcome contributions! Please feel free to submit issues, feature requests, and pull requests.
|
|
1158
346
|
|
|
1159
|
-
|
|
1160
|
-
type: RESOLVE_EVENT,
|
|
1161
|
-
payload: { eventId, choiceIndex }
|
|
1162
|
-
});
|
|
1163
|
-
|
|
1164
|
-
export const advanceGameDay = () => ({
|
|
1165
|
-
type: ADVANCE_GAME_DAY
|
|
1166
|
-
});
|
|
1167
|
-
|
|
1168
|
-
// Reducer
|
|
1169
|
-
const initialState = {
|
|
1170
|
-
generator: new RPGEventGenerator(),
|
|
1171
|
-
currentEvent: null,
|
|
1172
|
-
gameTime: { day: 1, season: 'spring' }
|
|
1173
|
-
};
|
|
347
|
+
### Development Setup
|
|
1174
348
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
return { ...state, currentEvent: event };
|
|
1180
|
-
|
|
1181
|
-
case RESOLVE_EVENT:
|
|
1182
|
-
// Apply choice effects to player state
|
|
1183
|
-
const choice = state.currentEvent.choices[action.payload.choiceIndex];
|
|
1184
|
-
const newPlayerState = applyChoiceEffects(choice.effect);
|
|
1185
|
-
return {
|
|
1186
|
-
...state,
|
|
1187
|
-
currentEvent: null,
|
|
1188
|
-
playerState: newPlayerState
|
|
1189
|
-
};
|
|
1190
|
-
|
|
1191
|
-
case ADVANCE_GAME_DAY:
|
|
1192
|
-
const dueEvents = state.generator.advanceGameDay();
|
|
1193
|
-
return {
|
|
1194
|
-
...state,
|
|
1195
|
-
gameTime: state.generator.getCurrentTime(),
|
|
1196
|
-
dueEvents: dueEvents
|
|
1197
|
-
};
|
|
1198
|
-
|
|
1199
|
-
default:
|
|
1200
|
-
return state;
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
```
|
|
349
|
+
```bash
|
|
350
|
+
# Clone the repository
|
|
351
|
+
git clone https://github.com/ContextWeaver/context-weaver.git
|
|
352
|
+
cd context-weaver
|
|
1204
353
|
|
|
1205
|
-
|
|
354
|
+
# Install dependencies
|
|
355
|
+
npm install
|
|
1206
356
|
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
function saveGame(playerState) {
|
|
1210
|
-
const gameState = {
|
|
1211
|
-
player: playerState,
|
|
1212
|
-
events: generator.getGameState(),
|
|
1213
|
-
timestamp: Date.now()
|
|
1214
|
-
};
|
|
1215
|
-
|
|
1216
|
-
localStorage.setItem('rpgGameSave', JSON.stringify(gameState));
|
|
1217
|
-
console.log('Game saved successfully');
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
// Load complete game state
|
|
1221
|
-
function loadGame() {
|
|
1222
|
-
try {
|
|
1223
|
-
const savedGame = JSON.parse(localStorage.getItem('rpgGameSave'));
|
|
1224
|
-
if (!savedGame) return false;
|
|
1225
|
-
|
|
1226
|
-
// Restore generator state
|
|
1227
|
-
generator.loadGameState(savedGame.events);
|
|
1228
|
-
|
|
1229
|
-
// Restore player state
|
|
1230
|
-
return savedGame.player;
|
|
1231
|
-
|
|
1232
|
-
} catch (error) {
|
|
1233
|
-
console.error('Failed to load game:', error);
|
|
1234
|
-
return false;
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
```
|
|
357
|
+
# Run tests
|
|
358
|
+
npm test
|
|
1238
359
|
|
|
1239
|
-
|
|
360
|
+
# Run demo
|
|
361
|
+
npm run demo
|
|
1240
362
|
|
|
1241
|
-
|
|
1242
|
-
npm
|
|
363
|
+
# Build for distribution
|
|
364
|
+
npm run build
|
|
1243
365
|
```
|
|
1244
366
|
|
|
1245
|
-
**Comprehensive test coverage (70+ tests):**
|
|
1246
|
-
- โ
Core event generation and validation
|
|
1247
|
-
- โ
Context adaptation and player responsiveness
|
|
1248
|
-
- โ
Thematic systems and cultural variants
|
|
1249
|
-
- โ
Event chains and multi-stage progression
|
|
1250
|
-
- โ
Dynamic difficulty scaling
|
|
1251
|
-
- โ
Time systems and seasonal mechanics
|
|
1252
|
-
- โ
Modular features and custom content
|
|
1253
|
-
- โ
Edge cases and error handling
|
|
1254
|
-
- โ
Game state persistence and integration
|
|
1255
|
-
- โ
**Event Economy system (25+ tests)**
|
|
1256
|
-
- Theme saving/loading/export/import
|
|
1257
|
-
- Rule pack management
|
|
1258
|
-
- Content pack creation
|
|
1259
|
-
- Quality metrics and statistics
|
|
1260
|
-
- File I/O operations and validation
|
|
1261
|
-
|
|
1262
|
-
## ๐ฏ Event Types
|
|
1263
|
-
|
|
1264
|
-
### Court & Political
|
|
1265
|
-
- **Court Scandal**: Royal intrigue with betrayal and scandal
|
|
1266
|
-
- **Noble Duel**: Honour challenges and duels of reputation
|
|
1267
|
-
- **Market Crash**: Economic disasters affecting trade
|
|
1268
|
-
- **Trade War**: Merchant rivalries and economic warfare
|
|
1269
|
-
|
|
1270
|
-
### Criminal Underworld
|
|
1271
|
-
- **Thieves' Guild**: Criminal organisation recruitment
|
|
1272
|
-
- **Blackmail Opportunity**: Leverage compromising information
|
|
1273
|
-
- **Bandit King Challenge**: Highway robbery confrontations
|
|
1274
|
-
|
|
1275
|
-
### Supernatural & Mysterious
|
|
1276
|
-
- **Ancient Curse**: Cursed artefacts and afflictions
|
|
1277
|
-
- **Ghostly Visitation**: Spirits seeking justice
|
|
1278
|
-
- **Lost Civilisation**: Archaeological discoveries
|
|
1279
|
-
|
|
1280
|
-
### Personal & Dramatic
|
|
1281
|
-
- **Forbidden Love**: Romance across social boundaries
|
|
1282
|
-
- **Family Secret**: Hidden lineage revelations
|
|
1283
|
-
- **Desertion Temptation**: Military loyalty crises
|
|
1284
|
-
- **Mercenary Contract**: Dangerous employment opportunities
|
|
1285
|
-
|
|
1286
367
|
## ๐ License
|
|
1287
368
|
|
|
1288
369
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
1289
370
|
|
|
1290
|
-
## ๐ Acknowledgments
|
|
1291
|
-
|
|
1292
|
-
- [Chance.js](https://chancejs.com/) for random number generation
|
|
1293
|
-
- Custom Markov chain implementation for procedural text generation
|
|
1294
|
-
|
|
1295
371
|
---
|
|
1296
372
|
|
|
1297
|
-
**Generate infinite
|
|
373
|
+
**Generate infinite possibilities with RPG Event Generator!** ๐ฒโจ
|