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

tiny-rpg-studio-sdk

v1.3.0

Published

SDK for creating RPG games and generating playable URLs for [Tiny RPG Studio](https://andredarcie.github.io/tiny-rpg-studio/).

Downloads

207

Readme

tiny-rpg-studio-sdk

SDK for creating RPG games and generating playable URLs for Tiny RPG Studio.

npm install tiny-rpg-studio-sdk

Usage

import { TinyRPG } from 'tiny-rpg-studio-sdk';

const game = new TinyRPG()
  .setTitle('My RPG')
  .setAuthor('You')
  .setPlayerStart({ x: 1, y: 1, room: 0 });

game.room(0)
  .ground([
    [1, 1, 1, 1, 1, 1, 1, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 0, 0, 0, 0, 0, 0, 1],
    [1, 1, 1, 1, 1, 1, 1, 1],
  ])
  .addEnemy({ type: 'skeleton', x: 3, y: 3 })
  .addNPC({ type: 'villager-man', x: 2, y: 2, text: 'Hello!' })
  .addKey({ x: 6, y: 6 });

game.room(8)
  .addEnd({ x: 4, y: 4, message: 'You won!' });

const url = game.buildURL();
// https://andredarcie.github.io/tiny-rpg-studio/#v25.g...

API

new TinyRPG() — game builder

All methods return this for chaining, except room(), toSharePayload(), toShareCode() and buildURL().

| Method | Signature | Description | |---|---|---| | setTitle | (title: string): this | Sets the game title. Max 80 characters — throws if exceeded. | | setAuthor | (author: string): this | Sets the author name. Max 60 characters — throws if exceeded. | | setPlayerStart | ({ x, y, room }: { x: number; y: number; room: number }): this | Sets the player's starting position. x and y must be integers in [0, 7], room in [0, 8]. Throws otherwise. | | setPalette | (colors: string[]): this | Sets a custom 16-color palette. Must be exactly 16 strings matching #RRGGBB. Throws otherwise. | | hideHUD | (hide?: boolean): this | Hides the game HUD. Defaults to true. | | room | (index: number): RoomBuilder | Returns the RoomBuilder for room index. index must be an integer in [0, 8]. Throws otherwise. Rooms are created lazily. | | toSharePayload | (): SdkSharePayload | Returns the raw data object passed to the encoder. | | toShareCode | (): string | Returns the encoded share hash string. | | buildURL | (baseUrl?: string): string | Returns the full playable URL. Uses the official studio URL by default. |


room(i)RoomBuilder

All methods return this for chaining. Each call validates coordinates and types immediately — errors point to the exact call that caused them.

Tiles

| Method | Signature | Description | |---|---|---| | ground | (matrix: number[][]): this | Sets the ground tile layer. Must be an 8×8 matrix of integers. Throws if dimensions are wrong. | | overlay | (matrix: (number \| null)[][]): this | Sets the overlay tile layer. Must be an 8×8 matrix of integers or null. Throws if dimensions are wrong. |

Entities

| Method | Signature | Description | |---|---|---| | addEnemy | ({ type: EnemyType; x: number; y: number }): this | Adds an enemy at position (x, y). Max 9 enemies per room. Throws if type is invalid, coordinates are out of range, or room is full. | | addNPC | ({ type: NpcType; x: number; y: number; text?: string }): this | Adds an NPC at position (x, y) with optional dialog text. Throws if type is invalid or coordinates are out of range. |

Items (unique per room — throws if called twice for the same type)

| Method | Signature | Description | |---|---|---| | addKey | ({ x: number; y: number }): this | Places a key at (x, y). | | addDoor | ({ x: number; y: number }): this | Places a door at (x, y). Requires a key to open. | | addPotion | ({ x: number; y: number }): this | Places a life potion at (x, y). | | addSword | ({ x: number; y: number; tier?: 'wood' \| 'bronze' \| 'iron' }): this | Places a sword at (x, y). tier defaults to 'iron'. Each tier counts as a separate unique item. | | addEnd | ({ x: number; y: number; message?: string }): this | Places the game-ending tile at (x, y) with an optional victory message. |


Types

EnemyType

'giant-rat' | 'bandit' | 'skeleton' | 'dark-knight' |
'necromancer' | 'dragon' | 'fallen-king' | 'ancient-demon'

NpcType

// Human variants
'old-mage' | 'villager-man' | 'villager-woman' | 'child' |
'king' | 'knight' | 'thief' | 'blacksmith' |

// Elf variants
'old-mage-elf' | 'villager-man-elf' | 'villager-woman-elf' | 'child-elf' |
'king-elf' | 'knight-elf' | 'thief-elf' | 'blacksmith-elf' |

// Dwarf variants
'old-mage-dwarf' | 'villager-man-dwarf' | 'villager-woman-dwarf' | 'child-dwarf' |
'king-dwarf' | 'knight-dwarf' | 'thief-dwarf' | 'blacksmith-dwarf' |

// Fixed
'thought-bubble' | 'wooden-sign'

SdkSharePayload

type SdkSharePayload = {
  title?: string;
  author?: string;
  hideHud?: boolean;
  start?: { x: number; y: number; roomIndex: number };
  enemies?: { type: string; x: number; y: number; roomIndex: number }[];
  sprites?: { type: string; x: number; y: number; roomIndex: number; text: string; placed: boolean }[];
  objects?: SdkObject[];
  tileset?: { maps: Array<{ ground?: number[][]; overlay?: (number | null)[][] }> };
  customPalette?: string[];
};

Links