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

libbellum

v0.3.3

Published

Provides models and functions to interract with bellum.io

Readme

libbelum

JavaScript library for interfacing with the Bellum.io game. It contains models which represents a entire game (GameLog) and which represent the game at a specific point in time (Game).

Requirements

NodeJS and NPM

Install

Simply add libbellum as a dependency:

npm install --save libbellum
Example usage

See the bellum recorder for a good example on how it is used to record games.

Creating a game state using libbellum.Game and interacting with it:

const libbellum = require('libbellum');

// Initalize a game with server data. Normally you get this from the bellum.io 'serverData' socket.io event
let game = new libbellum.Game(["/#y_lctBx_FCFNFxwGACDk",   // id
                            13,                         // player count
                            7200,                       // match Time
                            "2017-07-01T11:26:32.917Z", // reset Time
                            100,                        // server map size
                            [15,100,500,3000,10000],    // troop cost
                            [1,5,40,100,400],           // click mp gain levels
                            2.5,                        // attack cooldown
                            100])                       // max players

// It is possible to call game event functions directly.
game.playerData([{"/#Z7Da4HN8wQaJXnuWAHDR":[64,13,"Darwin\'s_spider(TSW)",9715,"snow"],
                  "/#h35s75zEBvSCZi44AHET":[67,2,"Darn",6942,"default"],
                  "/#hjZ0GrQipOUdecYtAHEk":[56,10,"Marxism(OAT)",2513,"red"],
                  "/#H95sZEPL2_L7L6oUAHFO":["75","26","LifeDeathPanda",3079,"default"],
                  "/#eoAzP2FuDjDCdgK8AHGf":[1,34,"школиник(Guest)",0,"default"],
                  "/#1DpUU8V7vadGX7qBAHGl":[35,84,"viola(Oat)",2001,"terminalShield"],
                  "/#lhIM3LB8-algWnMNAHGn":[38,96,"oat(Oat)",1500,"default"],
                  "/#8PmSAwnSW0AcdakgAHG1":[2,67,"lol(Guest)",100,"default"],
                  "/#dcQ3y9gXhqVa_9BzAHG9":["90","33","NaziGermany(Guest)",700], // huh? A number?
                  }])

// See gameEventNames array in Game.js to see which events can be called and handeled.

// Alternatively you can let the game listen on some socket.io socket.
// This is untested.
game.listen(someSocket)

// At any point you can inspect the state of the game.
game.players; // Is a array of libbellum.Player objects.
game.tiles; // Is a fixed-2d-array object containing libbellum.Tile objects.
game.tiles.forEach(function(tile) {
    // Do something with each tile. See Tile.js for all properties.
    // Information about defenses, type, owner and x/y location is stored.
});

A game state can also be created from a GameLog like this:

const libbellum = require('libbellum');

let gamelog = new libbellum.GameLog();
fs.readFile('gamelog.json', (err, data) => {
    if(!err)
    {
        gamelog.importFromPlainObject(JSON.parse(data));
        
        let game = new libbellum.Game(gamelog.getServerData());
        gamelog.forEach(function(ms_since_start, i, eventName, eventData) {
            if(game[eventName])
            {
                game[eventName].apply(game, eventData);
            }
        });
    }
});

License

BSD 3