Offline procedural RPG events with context flavoured text and a built in content library. No API key required. Zero runtime dependencies.
npm install rpg-event-generator
Requires Node.js 16+.
const { generateRPGEvent } = require('rpg-event-generator');
const event = generateRPGEvent({
level: 10,
location: 'forest',
weather: 'rainy',
class: 'fighter'
});
console.log(event.title); // e.g. "Heroic Quest"
console.log(event.description); // context prefixes: location, weather, time, class, race
console.log(event.choices); // [{ text, effect }, ...]
console.log(event.type); // e.g. "COMBAT"
Or with a configured instance:
const { RPGEventGenerator } = require('rpg-event-generator');
const generator = new RPGEventGenerator({ theme: 'fantasy' });
const event = generator.generateEvent({ level: 15, class: 'wizard', location: 'tower' });
generator.addTrainingData({
titles: { COMBAT: ['Epic Duel'] },
descriptions: { COMBAT: ['Two warriors circle each other...'] },
choices: { COMBAT: ['Fight', 'Flee', 'Negotiate'] }
}, 'my_theme');
Use structured objects (titles, descriptions, choices). Raw string arrays are ignored in v4.
Start with Tier 1. Everything else is optional.
| Tier | What | Use when |
|---|---|---|
| 1 — Core | generateRPGEvent() / generateEvent(), built-in library, addTrainingData() |
Game jams, first ship |
| 2 — Orchestrator | Templates, rules, environmental modifiers, optional AI | Custom event logic |
| 3 — Toolkit | World sim, DB adapters, engine export scripts | Lore JSON, tooling experiments |
Tier 3 (generateWorld(seed) or { seed, continentCount }) produces seeded lore JSON — regions, factions, history. Use getWorldLore(location) for a one-line hook into player events. Not a live sim backbone.
Full guides ship with the repo — no wiki required.
| Guide | Topic |
|---|---|
| Getting Started | Install, quick start, context fields |
| Examples | Copy-paste snippets by tier |
| Custom Content | addTrainingData() |
| Feature Tiers | What to use when |
| World Building | Seeded world lore |
| Templates & Rules | Tier 2 orchestrator |
| Configuration | Generator options |
| Advanced Tooling | DB, export, AI |
Build locally: npm run docs → open docs/index.html
npm run build && npm run demo — short CLI check, not a feature tourMIT — see LICENSE.