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

game-randomizer

v1.0.10

Published

Node.js module to enable game selection, randomization, and interactivity

Readme

game-randomizer

A Node.js module for randomly selecting and launching retro games from your ROM collection. Supports multiple emulators including RetroArch, RALibretro, and BizHawk.

Features

  • 🎮 Multi-Emulator Support: Works with RetroArch, RALibretro, BizHawk, and more
  • 🎲 Smart Randomization: Randomly selects games from configured ROM directories
  • 🏷️ Console Filtering: Filter games by specific console/platform
  • 📁 Flexible ROM Scanning: Uses glob patterns to find ROMs in nested directories
  • ⚙️ Configurable Commands: Custom command line arguments per console
  • 🔄 Process Management: Automatically closes running emulators before launching new games

Installation

npm install game-randomizer

Quick Start

  1. Create Configuration File Copy game-config_example.json to game-config.json and update paths:
{
    "emulators": [
        {
            "name": "RALibretro",
            "executable": "C:/Emulators/RALibretro/RALibretro.exe",
            "commandLineOptions": "",
            "consoleTags": ["nes", "snes", "genesis"]
        }
    ],
    "consoles": [
        {
            "name": "Super Nintendo",
            "romRoots": ["C:/ROMs/SNES/**/*.+(smc|sfc)"],
            "commandLineOptions": "--core snes9x_libretro --system 3 --game",
            "tags": ["snes"]
        }
    ]
}
  1. Use as Module
import { GameRandomizer } from 'game-randomizer'

const randomizer = new GameRandomizer()
await randomizer.scanForGames('game-config.json')

const randomGame = await randomizer.pickRandomGame()
if (randomGame) {
    await randomGame.emulator.run(randomGame.console, randomGame.game)
}
  1. Run Standalone
RUN_GAME_RANDOMIZER_AT_LAUNCH=true node index.js

Configuration

Emulators

Define emulators with their executable paths and supported console tags:

{
    "name": "RALibretro",
    "executable": "path/to/RALibretro.exe",
    "commandLineOptions": "",
    "consoleTags": ["nes", "snes", "genesis"]
}

Consoles

Configure ROM directories and emulator-specific command line options:

{
    "name": "Super Nintendo",
    "romRoots": ["path/to/snes/roms/**/*.+(smc|sfc)"],
    "commandLineOptions": "--core snes9x_libretro --system 3 --game",
    "tags": ["snes"]
}

Glob Patterns

Use glob patterns to scan ROM directories:

  • **/*.smc - All .smc files in subdirectories
  • **/*.+(smc|sfc) - Multiple extensions
  • Retail Games/**/*.smc - Specific subdirectory

API Reference

GameRandomizer

constructor(config?)

Create a new randomizer instance.

async scanForGames(configPath?)

Scan ROM directories based on configuration file.

async pickRandomGame(options?)

Randomly select a game. Options can include consoleTag for filtering.

GameRandomizerOptions

constructor(consoleTag?)

Options for game selection. Pass consoleTag to filter by console.

Console Filtering

Filter games by specific console:

import { GameRandomizerOptions } from 'game-randomizer'

const options = new GameRandomizerOptions('snes')
const snesGame = await randomizer.pickRandomGame(options)

Supported Emulators

  • RALibretro: RetroAchievements-enabled RetroArch
  • RetroArch: Multi-system emulator
  • BizHawk: Multi-system emulator with tool-assisted speedrun features
  • Custom: Any emulator with command line support

Development

git clone https://github.com/MikeMayer/game-randomizer.git
cd game-randomizer
npm install
npm test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run npm test and npm run lint
  6. Submit a pull request

License

This project is licensed under the Unlicense - see the LICENSE file for details.

Related Projects

  • mayer-robo - Twitch bot that uses game-randomizer for !rg commands