screeps-viz
TypeScript icon, indicating that this package has built-in type declarations

2.1.3 • Public • Published

screeps-viz

sample dashboard

A visualization library for Screeps

Installation

Install via npm:

npm install screeps-viz

Usage

This library is designed around functional programming principles. Until we have better documentation, please consult the source and tests for each widget for its expected parameters, and see src/demo.ts for examples.

Widgets

Most of the widgets will use a pattern like this, passing in a function that will be invoked each tick to get the current data & configuration.

const barWidget = Bar(() => ({
    data: {
        value: Game.time % 20,
        maxValue: 20
    },
    config: {
        label: 'Bar 1',
        style: {
            stroke: 'red',
            fill: 'red',
            lineStyle: 'dashed'
        }
    }
})

Dashboard

The Dashboard itself takes a list of Widgets with position & size information and renders each.

export function loop() {
    Dashboard({ 
        widgets: [{
            x: 1,
            y: 1,
            width: 5,
            height: 10,
            widget: barWidget
        }]
    })
}

Dependencies (0)

    Dev Dependencies (9)

    Package Sidebar

    Install

    npm i screeps-viz

    Weekly Downloads

    4

    Version

    2.1.3

    License

    MIT

    Unpacked Size

    170 kB

    Total Files

    32

    Last publish

    Collaborators

    • glitchassassin