TTRPG game packages for the RANDSUM dice ecosystem. Each game subpath wraps @randsum/roller with game-specific input validation, roll configuration, and result interpretation.
Built on @randsum/roller, which is RDN v1.0 Level 4 (Full) Conformant. All game packages use RANDSUM Dice Notation (RDN) for dice mechanics.
bun add @randsum/games
# or
npm install @randsum/games| Subpath | Game System | Dice |
|---|---|---|
@randsum/games/blades |
Blades in the Dark | 0-4d6 pool |
@randsum/games/daggerheart |
Daggerheart | 2d12 Hope + Fear |
@randsum/games/fifth |
D&D 5th Edition | 1d20 + modifier |
@randsum/games/pbta |
Powered by the Apocalypse | 2d6 + stat |
@randsum/games/root-rpg |
Root RPG | 2d6 + bonus |
@randsum/games/salvageunion |
Salvage Union | 1d20 table lookup |
import { roll } from "@randsum/games/blades"
const { result } = roll(3)
// result: 'critical' | 'success' | 'partial' | 'failure'import { roll } from "@randsum/games/fifth"
const { result } = roll({ modifier: 5, rollingWith: "Advantage" })
// result: number (d20 + modifier)import { roll } from "@randsum/games/pbta"
const { result } = roll({ stat: 2 })
// result: 'strong_hit' | 'weak_hit' | 'miss'import { roll } from "@randsum/games/daggerheart"
const { result } = roll({ modifier: 3 })
// result: 'hope' | 'fear' | 'critical hope'import { roll } from "@randsum/games/root-rpg"
const { result } = roll(2)
// result: 'Strong Hit' | 'Weak Hit' | 'Miss'import { roll } from "@randsum/games/salvageunion"
const { result } = roll("Core Mechanic")
// result: { key, label, description, table, tableName, roll }All game subpaths throw SchemaError on invalid input:
import { roll, SchemaError } from "@randsum/games/fifth"
try {
roll({ modifier: Infinity })
} catch (error) {
if (error instanceof SchemaError) {
console.log(error.code) // 'INVALID_INPUT_TYPE'
}
}Every subpath exports:
RollResult-- the game-specific result typeGameRollResult-- the full return type fromroll()RollRecord-- raw dice data from the core rollerSchemaError-- error class thrown on invalid inputSchemaErrorCode-- union type of error codes
import type { RollResult, GameRollResult, RollRecord } from "@randsum/games/blades"
import { SchemaError } from "@randsum/games/blades"The salvageunion subpath also exports VALID_TABLE_NAMES (a const tuple of all table names) and ROLL_TABLE_ENTRIES (the full table data).
The @randsum/games/schema subpath provides the JSON Schema definition, validator, and loader for .randsum.json spec files used to code-generate game packages.
import { validateSpec, loadSpec } from "@randsum/games/schema"Full documentation at randsum.dev.
MIT