npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@randsum/games

v4.0.0

Published

TTRPG game packages using RDN-conformant dice notation for the RANDSUM ecosystem

Downloads

279

Readme

@randsum/games

TTRPG game packages for the RANDSUM dice ecosystem. Each game subpath wraps @randsum/roller with game-specific input validation, roll configuration, and result interpretation.

ESM-only. The only dependency is @randsum/roller, which is RDN Level 4 (Full) Conformant. Game subpaths never depend on each other.

Install

bun add @randsum/games
# or
npm install @randsum/games

Available Games

| Subpath | Game System | Dice | | ----------------------------- | ------------------------- | ----------------- | | @randsum/games/blades | Blades in the Dark | 0-4d6 pool | | @randsum/games/daggerheart | Daggerheart | 2d12 Hope + Fear | | @randsum/games/fate | Fate Core | 4dF + modifier | | @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 |

Usage

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/fate"

const { result } = roll({ modifier: 2 })
// result: ladder rung, e.g. 'average' | 'fair' | 'good' | 'great' | 'superb' | ...
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({ modifier: 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 }

Error Handling

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) // e.g. 'INVALID_INPUT_TYPE'
  }
}

Type Exports

Each subpath exports its own game-specific result type (e.g. BladesRollResult, FateRollResult, FifthRollResult) plus the shared types:

  • GameRollResult -- the full return type from roll()
  • RollRecord -- raw dice data from the core roller
  • SchemaErrorCode -- union type of error codes

and the value:

  • SchemaError -- error class thrown on invalid input
import { roll, SchemaError } from "@randsum/games/blades"
import type { BladesRollResult, GameRollResult, RollRecord } from "@randsum/games/blades"

The salvageunion subpath additionally exports the values VALID_TABLE_NAMES (a const tuple of all table names) and ROLL_TABLE_ENTRIES (the full table data).

Schema

The @randsum/games/schema subpath exposes the validator and code generator for the .randsum.json spec files used to code-generate game packages:

import {
  validateSpec,
  resolveExternalRefs,
  generateCode,
  specToFilename,
  lookupByRange,
  SchemaError
} from "@randsum/games/schema"

It also exports the spec types (RandSumSpec, ValidationResult, ValidationError, SchemaErrorCode, and the spec-section types).

Documentation

Full documentation at randsum.dev.

License

MIT