Generate seeded world lore: continents, kingdoms, factions, landmarks, and historical events. Tier 3 — use for lore JSON, not as a live game backbone unless you wire it yourself.
const { RPGEventGenerator } = require('rpg-event-generator');
const generator = new RPGEventGenerator();
// Seeded, reproducible world
const world = generator.generateWorld(42);
console.log(world.regions.length); // continents + kingdoms
console.log(world.factions.length); // one faction per kingdom (varied types)
console.log(world.events.length); // initial historical events
// Events are stored on the instance
const history = generator.getHistoricalEvents();
// Advance time
generator.simulateWorldYears(50);
const extended = generator.getHistoricalEvents();
generator.generateWorld({
seed: 42, // reproducible output
continentCount: 3, // 2–8 continents (default: 5)
historyStartYear: 800, // first year for initial history
currentYear: 1000 // present year at generation
});
// Legacy: numeric seed still works
generator.generateWorld(42);
One faction per kingdom, rotated types: kingdom, guild, cult, tribe, merchants, nobles. Each has:
Types: war, alliance, discovery, disaster, ascension, fall, plague, famine, revolution, invasion, treaty, betrayal.
Descriptions reference actual region names, factions, and landmarks — not generic filler.
Events apply consequences (population, stability, relationships).
generator.getAllWorldRegions();
generator.getAllWorldFactions();
generator.getHistoricalEvents();
generator.getWorldStats();
generator.getFactionAllies(factionId);
generator.getFactionEnemies(factionId);
generator.getFactionDiplomacyStatus(id1, id2);
generator.getFactionPowerRanking();
generator.getFactionTradeRoutes(factionId);
const world = generator.generateWorld(42);
const kingdom = world.regions.find(r => r.type === 'kingdom');
const lore = generator.getWorldLore(kingdom.name);
// e.g. "In 920, war of northern marches — Armies of ..."
// Use in your game UI or prepend to event text yourself
const event = generator.generateEvent({ location: kingdom.name.split(' ')[0] });
getWorldLore() matches partial location strings against region names.
World sim is not connected to generateEvent() automatically. Typical workflow:
generateWorld(seed) at game start or in a tooling pipelinegetWorldLore(location) when showing events in known regionssimulateWorldYears() between game sessionsgenerateEvent() ignores faction politics unless you add that logic