Slot Engine is in Beta - Stable, but may contain minor bugs
Slot EngineSlot Engine

Migration Guides

Learn how to upgrade your games to a newer version of Core.

Upgrade from 0.3.x to 0.4.x

Book IDs start at 0

Book IDs now start at 0 instead of 1. The first line of books_<mode>.jsonl.zst and the first row of lookUpTable_<mode>_0.csv belong to book 0. You will need to re-run simulations to regenerate your files.

The books themselves stay the same and are only renumbered. Book k was book k + 1 before. If your code maps a book ID to a lookup table row with id - 1, drop the offset.

Define scatter rules in your game

scatterToFreespins, ctx.config.anticipationTriggers, ctx.services.game.getFreeSpinsForScatters() and ctx.services.game.verifyScatterCount() were removed. Games are now responsible to handle scatter counts.

Example replacement:

import { SPIN_TYPE, SpinType } from "@slot-engine/core"

const FREESPINS_BY_SCATTERS: Record<SpinType, Record<number, number>> = {
  [SPIN_TYPE.BASE_GAME]: { 3: 10, 4: 12, 5: 15 },
  [SPIN_TYPE.FREE_SPINS]: { 3: 6, 4: 8, 5: 10 },
}

function freespinsForScatters(spinType: SpinType, scatters: number) {
  return FREESPINS_BY_SCATTERS[spinType][scatters] ?? 0
}

function anticipationTrigger(spinType: SpinType) {
  return Math.min(...Object.keys(FREESPINS_BY_SCATTERS[spinType]).map(Number)) - 1
}
ctx.config.anticipationTriggers[ctx.state.currentSpinType] 
anticipationTrigger(ctx.state.currentSpinType) 

ctx.services.game.getFreeSpinsForScatters(ctx.state.currentSpinType, scatters) 
freespinsForScatters(ctx.state.currentSpinType, scatters) 

Upgrade from 0.2.x to 0.3.x

Replace record API with tag API

For clarity, the old "force record" system was renamed to "tagging". You will need to replace method calls and re-run simulations, because output file names have changed. The functionality remains the same.

ctx.services.data.record({}) 
ctx.services.data.tag({}) 

ctx.services.data.recordSymbolOccurrence() 
ctx.services.data.tagSymbolOccurrence() 

game.runTasks({
  // ...
  analysisOpts: {
    recordStats: [], 
    tagStats: [], 
  },
})

Update optimization configuration

The old and slow Rust optimizer was replaced with a Typescript optimizer, resulting in noticably faster optimization. The API has also changed. Learn how to use the new optimizer

Upgrade from 0.1.x to 0.2.x

Adjust npm scripts or commands

Due to technical changes and Panel compatibility, tasks (simulation, optimization, analysis) are only run when explicitly passing a command line argument. The required argument is --slot-engine-run.

For example, when you're using tsx to run your games, this is how you must adjust your command:

  pnpm tsx ./index.ts

Note introduction of new generated files

The Core library now produces additional files which contain metadata or other information. When you're using the new Panel package these files are mandatory for flawless Panel functionality. Re-run simulations to generate those files.

  • books_chunks/* (new)
  • books_<name>.index.meta.json (new)
  • force_keys_<mode>.json (new)
  • lookUpTable_<mode>.index (new)
  • lookUpTableSegmented_<mode>.index (new)
  • simulation_summary.json (new)
  • stats_payouts.json (modified structure)

Note new book files generation

Uncompressed book files are no longer generated. This saves a lot of hard drive space. If you need to inspect your book files, you can use the new Panel package.

Recommendations

Replace your console.log() calls

Logging to the console from worker threads is not reliable. A more robust approach to logging during simulations was added. Access the log() method from the data service in your game implementation: ctx.services.data.log()

Prefix static reels files with reels_

If you want to use the reel set editor included in Panel, you must rename your reels CSV files to something like reels_your-reelset-name.csv. Panel scans your game directory for CSV files starting with reels_ - only those are editable in the reel set editor.

Use of AI on this page: Some texts were improved with or written by AI.

On this page