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

wm-sim

v0.1.4

Published

War Metal Battle Simulator

Readme

War Metal Battle Simulator (wm-sim)

Tests

A Typescript library that simulates battles for the now-discontinued browser game War Metal.

  • demo Work in progress

Features

  • Faithful to original game - the demo contains defintions of all of the existing game units and all of them run as expected in this simulation
    • Full integration test suite - ensures the original game rules are all implemented; quirks and all
  • Extensible - this simulator is not limited to the original game units. You can easily define new units in the game data file
    • Custom skills - it's easy to implement new skills using your own code. An example of this can be seen in the tests file.
  • Parameterized output - separating the display layer from the simulation layer means you can portray the battle however you want such as a statistical dashboard, or even a graphical game interface. A basic text output utility is available which outputs the logs in the style of War Metal
  • Typescript - hard to complain about strong typing

Background

War Metal was a browser based game from ~2010. It had RPG elements but the core of the game was pitting your force against both player forces and NPC raid bosses. War Metal battles allowed for deep strategy with a rich array of ways that players can manipulate the battle or counter enemy forces. At some point, I decided to build a simulator for the game for 2 main reasons:

  • time-gated actions - like most games at the time (and even now), it time-gated the amount of actions you could take (unless you paid $)
  • high cost of failure - joining in a group raid boss unprepared could cause the raid to fail for all collaborating players

A simulator solves both of these problems allowing the user to test and tweak their forces as much as they needed.

The simulator, along with a suite of other tools and resources I developed for War Metal, ended up becoming quite popular with over 10,000 hits per day which was a lot for such a niche game. But, eventually, the game shutdown and, being server-based, was lost to time.

New version

I have been looking to hone my skills and learn some new technology and this library was a perfect candidate for such a project. It is a complete rewrite of the original simulator, rebuilt from the ground up with cleaner architecture, extensibility, and strong test coverage. Despite the old version utilising web workers for multi-threading, this new version runs around 100x faster due to smarter architectural decisions and performance-minded coding practices (unusual to consider in JavaScript but it makes a difference). I opted out of web workers due to their overhead being detrimental given the performance improvements.

Installation

npm install wm-sim

Sample Usage

import {BattleRunner, RenderSingleBattleResult} from 'wm-sim';

const config = {
  player1: {
    power: 1000000,
    force: {
      units: [101],
      reinforcements: [107,100]
    }
  },
  player2: {
    power: 500000,
    force: { units: [], reinforcements: [] },
  },
  epicMode: false,
  data: {
    units: {
      100: { name: "Test Unit", type: 2 },
      101: { name: "Test Unit 2", skills: [{skill_id: 200, chance: 1}]},
      107: { name: "Test Unit 3", skills: [{skill_id: 209, chance: 1}]}
    },
    skills: {
      200: {name: "Reinforce", reinforce: 1, unit_type: 1},
      209: {name: "Reinforce 2", reinforce: 1, unit_type: 2}
    },
    types: { 1: {name: "Basic Type"}, 2: {name: "Type 2"} },
    subtypes: { 1: {name: "Basic Subtype"} }
  }
};
const runner = new BattleRunner();
const result = runner.run(config);
const output = RenderSingleBattleResult(result, config.data);//or your own method

Roadmap

  • improve demo UI and add more interesting presets
  • demo for multi-battle statistical analysis
  • increased extensibility for battle state would be nice