Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@netshards/ns-omi-core

Omi game test using redux managed state

netshards

readme

@netshards/ns-omi-core module

This module is a part of NetShards infrastructure

ns-omi-core is Omi game core powered by Redux (server side) It is a sample of game core pluggable into the NetShards infrastructure. It is providing management, persistence, hot-reloading and archivation of the game state.

Installation

The easiest way is to keep ns-omi-core as a Dependency in your package.json, by running

$ npm install --save @netshards/ns-omi-core

Usage

Server

The options attribute allows you to initialize properties on the ns-omi-core, so

import {createCore, storage} from 'ns-omi-core';

var options = {
    path: /home/yourname/archive/,
    room: 'room name or ID or UUID...' // My preference is node-uuid v4
};

// Returns promise
createCore(options).then((store)=> {

    // actions

}

Using Redux actions to roll the globe. Supported actions: [ADD_PLAYER,UPDATE_SCORE,ADD_ROUND,INIT_ROUND,SET_TRUMPH,DEAL,PREVALIDATE,PLAY_ANY,SHIFT_TURN,PLAY-SHIFT-PREVALIDATE] Example usage:


createCore(options).then((store)=> {

    //adding 4 players to the store
    for(var i=1;i<=4;++i) {
        store.dispatch({
            type: 'ADD_PLAYER',
            player: {id: i}
        });
    }

}

Tests

$ npm test

License

MIT License