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

@reldens/game-data-generator

v0.26.0

Published

Reldens - Game Data Generator

Readme

Reldens - GitHub - Release

Reldens - Game Data Generator

A comprehensive tool to generate balanced game data for RPG systems, including player progression, monster rewards, and attribute scaling.

Features

  • Player experience curve generation with dynamic growth factors
  • Monster/NPC experience reward tables with variations
  • Character attributes and stats scaling per level
  • Configurable templates and variations
  • JSON output for easy integration
  • Validation of all generator options
  • Timestamped output files to prevent overwriting

Installation

npm install @reldens/game-data-generator

Usage

PlayersExperiencePerLevel

Generates player level progression data with experience requirements.

const { PlayersExperiencePerLevel } = require('@reldens/game-data-generator');

let generator = new PlayersExperiencePerLevel({
    startExp: 100,
    baseGrowthFactor: 1.15,
    maxLevel: 100,
    growthIncrease: 0.01,
    jsonFileName: 'player-levels.json',
    generateFolderPath: 'generated'
});

generator.generate();

Required Options:

  • startExp: Experience required to reach level 2 from level 1
  • baseGrowthFactor: Initial growth factor per level (e.g., 1.15 = 15% increase)
  • maxLevel: Maximum level to calculate

Optional Options:

  • growthIncrease: Increase in growth factor per level (default: 0)
  • baseGrowthFactorPerLevel: Object with specific growth factors per level
  • jsonFileName: Output filename (default: auto-generated with timestamp)
  • generateFolderPath: Output folder path (default: 'generated')

Output Format:

{
    "1": {"req": 100, "total": 100, "growthFactor": 1.15},
    "2": {"diff": 15, "req": 115, "total": 215, "growthFactor": 1.16},
    ...
}

MonstersExperiencePerLevel

Generates monster/enemy experience reward tables with variations.

const { MonstersExperiencePerLevel } = require('@reldens/game-data-generator');

let generator = new MonstersExperiencePerLevel({
    levelsExperienceByKey: {
        "1": {"req": 100},
        "2": {"req": 115},
        ...
    },
    variations: {
        "weak": 0.5,
        "normal": 1.0,
        "strong": 1.5
    },
    decrementProportionPerLevel: {
        "1": 0.1,
        "2": 0.12,
        ...
    },
    jsonFileName: 'monster-rewards.json',
    generateFolderPath: 'generated'
});

generator.generate();

Required Options:

  • levelsExperienceByKey: Object with experience requirements per level
  • variations: Object with variation multipliers (e.g., weak, normal, strong)
  • decrementProportionPerLevel: Object with decrement proportions per level

Optional Options:

  • jsonFileName: Output filename (default: auto-generated with timestamp)
  • generateFolderPath: Output folder path (default: 'generated')

Output Format:

{
    "1": {
        "req": 100,
        "weak": {"decrementProportion": 0.1, "randomVariation": 0.5, "exp": 50, "kills": 2},
        "normal": {"decrementProportion": 0.1, "randomVariation": 1.0, "exp": 100, "kills": 1}
    },
    ...
}

AttributesPerLevel

Generates character stats/attributes per level with type templates and variations.

const { AttributesPerLevel } = require('@reldens/game-data-generator');

let generator = new AttributesPerLevel({
    templateBase: {
        "hp": 100,
        "mp": 50,
        "atk": 10,
        "def": 8
    },
    typeTemplates: {
        "warrior": {
            "hp": 2.0,
            "atk": 1.5,
            "def": 1.8
        },
        "mage": {
            "mp": 2.5,
            "atk": 1.2,
            "def": 0.8
        }
    },
    typesVariations: {
        "common": {"min": 0.8, "max": 1.0},
        "rare": {"min": 1.2, "max": 1.5}
    },
    maxLevel: 50,
    setBaseAsInitialLevel: true,
    jsonFileName: 'attributes.json',
    generateFolderPath: 'generated'
});

generator.generate();

Required Options:

  • templateBase: Base stats object with initial values
  • typeTemplates: Object with stat multipliers per entity type
  • typesVariations: Object with variation ranges (min/max)

Optional Options:

  • setBaseAsInitialLevel: Use base stats for level 1 (default: false)
  • maxLevel: Maximum level to generate (default: 100)
  • typeScaleFactorRandom: Random seed for scaling (default: Math.random())
  • scaleDivisor: Divisor for scale calculation (default: 10)
  • levelDivisor: Divisor for level calculation (default: 10)
  • jsonFileName: Output filename (default: auto-generated with timestamp)
  • generateFolderPath: Output folder path (default: 'generated')

Output Format:

{
    "statsByVariation": {
        "common": {
            "1": {"hp": 100, "mp": 50, "atk": 10, "def": 8},
            "2": {"hp": 112, "mp": 56, "atk": 11, "def": 9},
            ...
        },
        "rare": {
            ...
        }
    },
    "typeScaleFactorRandom": 0.6234567
}

API Reference

GameDataGenerator (Base Class)

Base class for all generators. Not used directly.

Methods:

  • setReady(props): Initializes generator with options and validates
  • setOptions(options): Sets generator options (implemented by subclasses)
  • validate(): Validates options using validator
  • generate(): Generates data and saves to file (implemented by subclasses)

Properties:

  • currentDate: Timestamp for file naming
  • optionsValidator: Validator instance
  • fileHandler: FileHandler from @reldens/server-utils
  • isReady: Boolean indicating if generator is ready

Validators

Each generator has a corresponding validator that checks required options:

  • PlayersExperiencePerLevelValidator
  • MonstersExperiencePerLevelValidator
  • AttributesPerLevelValidator

All validators have a validate(options) method that returns true if valid, false otherwise.

Dependencies

  • @reldens/utils: Logger and Shortcuts utilities
  • @reldens/server-utils: FileHandler for file operations

Output

All generators save JSON files to the generated folder by default. Files are timestamped to prevent overwriting previous generations.

Example output filename: players-experience-per-level-2025-11-20-14-30-45.json

Documentation

https://www.reldens.com/documentation/game-data-generator/

Need a Feature?

Request a feature here: https://www.reldens.com/features-request


Reldens

By DwDeveloper