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 🙏

© 2025 – Pkg Stats / Ryan Hefner

damdara

v0.8.4

Published

Dragon Quest Core Module, created in Rust.

Downloads

102

Readme

Damdara WASM

npm version License: MIT

Dragon Quest core module compiled to WebAssembly. Experience the classic "Fukkatsu no Jumon" (Revival Password) system and turn-based battle mechanics in your browser or Node.js application.

🌐 Try Live Demo

Features

  • 🔐 Password System - Generate and decode 20-character hiragana passwords
  • ⚔️ Battle System - Turn-based combat with monsters
  • 📊 Character Management - Player stats, equipment, and progression
  • 🎮 Master Data - Complete database of monsters, items, spells, and equipment
  • 🦀 Pure Rust - Compiled to WebAssembly for performance
  • 📦 Zero Dependencies - Standalone WASM module

Installation

npm install damdara

or

yarn add damdara

Usage

Basic Example

import init, { WasmGame } from 'damdara';

// Initialize the WASM module
await init();

// Create a new game instance
const game = new WasmGame();

// Create a player
const playerState = game.create_player("ゆうてい");
console.log(playerState);
// {
//   summary: { name: "ゆうてい", level: 1, hp: 15, mp: 0, ... },
//   strength_status: { strength: 4, agility: 4, ... },
//   items: []
// }

Password System

// Generate a password from current player state
const password = game.generate_password();
console.log(password); // "あいうえお..." (20 hiragana characters)

// Load player from password
const loadedState = game.load_from_password("あいうえおかきくけこ...");
console.log(loadedState);

Battle System

// Queue battle actions
game.queue_battle_action("attack");
game.queue_battle_action("attack");
game.queue_battle_action("spell");
game.queue_battle_input(1); // Spell selection

// Run battle against monster ID 0 (Slime)
const result = game.run_battle(0);
console.log(result);
// {
//   player_survived: true,
//   monster_defeated: true,
//   player_escaped: false,
//   monster_escaped: false,
//   messages: ["スライムがあらわれた!", ...],
//   final_player_state: { ... }
// }

Master Data Access

// Get all monsters
const monsters = game.get_monsters();
console.log(monsters);
// [
//   { id: 0, name: "スライム", hp: 3, attack: 5, defense: 3, ... },
//   { id: 1, name: "スライムベス", hp: 4, attack: 7, ... },
//   ...
// ]

// Get all weapons
const weapons = game.get_weapons();

// Get all spells
const spells = game.get_spells();

// Get status progression table
const statusTable = game.get_status_table();

API Reference

WasmGame

Main game interface.

Constructor

  • new WasmGame() - Create a new game instance

Player Management

  • create_player(name: string): PlayerState - Create a new player
  • get_player_state(): PlayerState - Get current player state
  • has_player(): boolean - Check if player exists
  • generate_password(): string - Generate 20-character password
  • load_from_password(password: string): PlayerState - Load from password

Battle System

  • queue_battle_action(action: string): void - Queue action ("attack", "spell", "item", "escape")
  • queue_battle_input(value: number): void - Queue numeric input (menu selection)
  • run_battle(monster_id: number): BattleResult - Execute battle
  • clear_battle_input(): void - Clear action queue

Master Data

  • get_monsters(): MonsterData[] - Get all monsters
  • get_weapons(): EquipmentData[] - Get all weapons
  • get_armors(): EquipmentData[] - Get all armor
  • get_shields(): EquipmentData[] - Get all shields
  • get_items(): EquipmentData[] - Get all items
  • get_spells(): SpellData[] - Get all spells
  • get_status_table(): StatusData[] - Get level progression data

Messages

  • get_messages(): string[] - Get accumulated messages
  • clear_messages(): void - Clear message buffer

TypeScript Support

This package includes TypeScript definitions out of the box:

import init, { WasmGame, PlayerState, BattleResult } from 'damdara';

await init();
const game: WasmGame = new WasmGame();
const state: PlayerState = game.create_player("ゆうてい");

Browser Compatibility

  • Chrome/Edge 90+
  • Firefox 89+
  • Safari 15+

Requires WebAssembly support.

Node.js Usage

import { readFile } from 'fs/promises';
import init, { WasmGame } from 'damdara';

// Load WASM file explicitly in Node.js
const wasmBuffer = await readFile('./node_modules/damdara/damdara_bg.wasm');
await init(wasmBuffer);

const game = new WasmGame();
// ... use normally

Examples

See the live demo for a complete web application example.

Source code: GitHub Repository

License

MIT © Daisuke Takayama

Links