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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pokie

v1.1.3

Published

A server-side video slot game logic framework for JavaScript and TypeScript.

Downloads

85

Readme

POKIE

npm version

In Australia, they call slot machines "pokies".

Introducing POKIE, a server-side video slot game logic framework for JavaScript and TypeScript.

npm install pokie

Use cases

Back-End

Utilize POKIE to implement the video slot game mechanics on the Back-End. Create and manage game sessions, serialize them, and transfer the payload to the game client through your API.

Front-End

When playing for fun, you can implement the standalone game logic on the client-side, relieving the servers from unnecessary load. Utilize simulations to showcase specific game features for demonstration purposes.

Math

POKIE also serves as an essential tool for balancing the parameters of the slot game's math model, ensuring an immersive gaming experience. Configure the game session and run Monte Carlo simulations to guarantee that the model meets all necessary requirements.

Examples

See the examples of various video slot game mechanics implemented with POKIE.

Simple video slot game [Demo] [Code]

An example of a simple 5x4 video slot game with 8 winning lines.

Features:

  • Winning lines are counted from right to left. A line of minimum 3 winning symbols pays out.
  • "Wild" is a wild symbol that substitutes any other symbol on a winning line.
  • "Scatter1" is a scatter symbol that pays out 10x, 20x, or 30x the bet if 3 or more symbols appear on any positions. Only one "Scatter1" can appear on any reel.
  • "Scatter2" is a stacked scatter symbol that can appear on the 3 middle reels. If all 3 middle reels are covered with "Scatter2" symbols, the game pays 100x the bet.

Video slot with free spins [Demo] [Code]

An example of a 5x3 video slot game with free spins.

Features:

  • A minimum of 2 winning symbols on a winning line or scattered across all reels pays out.
  • During free spins, symbols on a winning line are counted not only from left to right but can also be scattered across the winning line definition.
  • During free spins, symbol sequences are different from the base game's ones. Sequences during free spins do not contain scatter symbols, so free spins cannot be re-triggered.
  • During free spins, all wins are multiplied by x2.
  • This example also demonstrates the usage of Simulation to obtain the desired game outcomes.

Video slot with sticky re-spin [Demo] [Code]

An example of a 5x3 video slot game with sticky re-spin feature. Every winning combination triggers the re-spin during which all the winning symbols are held on their places. The re-spins continue as long as there are new wins.

Exploring Video Slot Math with POKIE

A Medium article about how POKIE can be utilized for slot game math modelling.

Usage

Session

Video slot game logic.

import {VideoSlotSession} from "pokie";

const session = new VideoSlotSession();

session.play();

session.getSymbolsCombination(); // symbols combination
session.getWinAmount(); // total round win amount
session.getWinningLines(); // winning lines data
session.getWinningScatters(); // winning scatters data

Simulation

Running a certain number of game rounds and calculating RTP.

import {SimulationConfig, Simulation} from "pokie";

const simulationConfig = new SimulationConfig();
simulationConfig.setNumberOfRounds(10000);
const simulation = new Simulation(session, simulationConfig);

// set the callbacks if you want to control the session manually
simulation.beforePlayCallback = () => {
    console.log("Before play");
};
simulation.afterPlayCallback = () => {
    console.log("After play");
};
simulation.onFinishedCallback = () => {
    console.log("Simulation finished");
};

simulation.run(); // 10000 rounds will be played

simulation.getRtp(); // RTP of the current session

Capturing specific game features.

const simulationConfig = new SimulationConfig();
simulationConfig.setNumberOfRounds(Infinity);
simulationConfig.setPlayStrategy(new PlayUntilSymbolWinStrategy("A"));

const simulation = new Simulation(session, simulationConfig);
simulation.run(); // the simulation will be stopped on any winning combination with symbol "A"