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

@magmacrunch/adenosine-rpg

v0.5.0

Published

Lightweight 2D tile-based RPG engine

Readme

@magmacrunch/adenosine-rpg

Lightweight 2D tile-based RPG engine: game loop, movement, camera, collision, dialogue, inventory and entities. No runtime dependencies.

npm install @magmacrunch/adenosine-rpg

Use

import {
  initCanvas, player, createGameLoop, initInput,
  updateCamera, renderWorld, setCurrentMap, setMap,
  setGameStarted, handleMovement,
} from '@magmacrunch/adenosine-rpg';

initCanvas(document.getElementById('gameCanvas'));
player.x = 10;
player.y = 10;

const map = [
  [2,2,2,2,2],
  [2,0,0,0,2],
  [2,0,0,0,2],
  [2,2,2,2,2],
];
setCurrentMap('level1');
setMap(map);
initInput();

const loop = createGameLoop({
  update: (dt) => {
    updateCamera({ target: player, tileSize: 16, mapWidth: 5, mapHeight: 4 });
    handleMovement(player, { speed: 0.4, dt, collisionOpts: { map, solidTiles: [2] } });
  },
  render: () => renderWorld({
    map, tileSize: 16,
    renderTile: (ctx, x, y, id) => {
      ctx.fillStyle = { 0: '#7cb342', 2: '#5d4037' }[id] || '#000';
      ctx.fillRect(x, y, 16, 16);
    },
    layers: [{ sortY: player.y, render: (ctx) => { /* draw player */ } }],
  }),
  fps: 30,
});

setGameStarted(true);
loop.start();

API.md documents every export, with parameters and return shapes.

Dialogue in a text file

parseDialogueFile reads a game's conversations from one plain text file that somebody who does not write code can edit: no quotes, no brackets to balance.

== granny
if granny-helping -> granny-thanks
Granny Granola: Mind the oats, dear.
Would you fetch the cans for me?
> Help her -> granny-thanks [set granny-helping]
> Not now

== granny-thanks
Granny Granola: Bless you, dear.
import { parseDialogueFile, startConversation, finishConversation } from '@magmacrunch/adenosine-rpg';

const file = parseDialogueFile(await (await fetch('dialogue.txt')).text());
const flags = new Set(); // or anything with has and add, kept in the save
const c = startConversation(file, 'granny', flags); // follows the if lines
// show c.speaker, c.lines and c.answers; then, with the answer picked (or -1):
const next = finishConversation(c, picked, flags);  // a name to start, or null

A mistake throws a DialogueFileError carrying the line number, so an editor can point at it.

The format is shared with tunacan, the C pixel engine, and tunacan's source/dialogue.h is the spec: the comment at its top is the full set of rules. This is a second reader held to that one. It refuses the same mistakes at the same lines, counts lengths in UTF-8 bytes as the C does, and enforces the C loader's fixed limits (DIALOGUE_LIMITS), so a file one accepts the other accepts. dialogue-file.test.ts mirrors tunacan's tests/test_dialogue.c case for case; a change to the format is a change to both, tests first.

Without a bundler

The engine also runs from a single script tag:

<script src="https://cdn.jsdelivr.net/npm/@magmacrunch/[email protected]/dist/index.global.js"></script>

It installs itself as window.AdRPG. Leave the @0.5 pin in place; an unpinned jsDelivr URL serves whatever latest is, breaking changes included. Under node_modules the file is dist/index.global.js.

Note

State lives in module-level singletons, so one page runs one RPG. That suits the game it was extracted from; a second concurrent instance would need the state module reworked.

Module format

There is no CommonJS entry point (exports has no require condition), so import the module or load the IIFE build.

License

PolyForm Noncommercial 1.0.0. Copyright 2026 magmacrunch media.

Any noncommercial purpose is permitted. For a commercial licence, ask.

Part of adenosine, a collection of lightweight web game engines by magmacrunch media. Keep the NOTICE file with any copy you distribute.