Slot Engine is in Beta - Expect bugs!
Slot EngineSlot Engine

Game Service

Service providing common utility functions.


Methods

getReelsetById()

MethodType
ctx.services.game.getReelsetById()(gameMode, id) => Reels

Parameters

ParameterType
gameModestring
idstring

Retrieves a reel set by its ID within a specific game mode.

getFreeSpinsForScatters()

MethodType
ctx.services.game.getFreeSpinsForScatters()(spinType, scatterCount) => number

Parameters

ParameterType
spinTypeSpinType
scatterCountnumber

Retrieves the number of free spins awarded for a given spin type and scatter count based on the scatterToFreespins configuration.

getResultSetByCriteria()

MethodType
ctx.services.game.getResultSetByCriteria()(mode, criteria) => ResultSet

Parameters

ParameterType
modestring
criteriastring

Retrieves a result set by its criteria within a specific game mode.

getSymbolArray()

MethodType
ctx.services.game.getSymbolArray()() => GameSymbol[]

Returns all symbols as an array.

getCurrentGameMode()

MethodType
ctx.services.game.getCurrentGameMode()() => GameMode

Gets the configuration for the current game mode.

verifyScatterCount()

MethodType
ctx.services.game.verifyScatterCount()(numScatters) => number

Parameters

ParameterType
numScattersnumber

Ensures the requested number of scatters is valid based on the game configuration. Returns a valid number of scatters.

awardFreespins()

MethodType
ctx.services.game.awardFreespins()(amount) => void

Parameters

ParameterType
amountnumber

Adds the given number of free spins to the state.

dedupeWinSymbols()

MethodType
ctx.services.game.dedupeWinSymbols()(winCombinations) => { reelIdx, rowIdx }

Parameters

ParameterType
winCombinationsWinCombination[]

Return Object

ParameterType
reelIdxnumber
rowIdxnumber

When working with winCombinations returned from any win type, make sure you dedupe winning symbols. It may be possible for the same symbol (e.g. Wild) to be included in multiple win combinations. If you then wanted to tumble the board based on the winning symbols, that Wild symbol would be tumbled multiple times, which might lead to errors.

Another example is games like "Sugar Rush", where winning combinations increase a multiplier on the board. You wouldn't want the same symbol to trigger a multiplier increase multiple times.

Use of AI on this page: All texts were initially written by hand and many were later revised by AI for improved flow. All AI generated revisions were carefully reviewed and edited as needed.

On this page