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

Configuration

Options of the EngineLgs constructor.


Create an LGS

Create an LGS by calling new EngineLgs() with an options object. storage is the only required option.

lgs.ts
import { EngineLgs, InMemoryStorage } from "@slot-engine/lgs"
import { game as MyGame } from "../../path-to/my-game"

const lgs = new EngineLgs({
  storage: new InMemoryStorage(),
  games: [MyGame],
  port: 7771,
  defaultCurrency: "EUR",
  balance: { starting: 500 },
  bets: {
    min: 0.2,
    max: 200,
    step: 0.2,
    default: 1,
    levels: [0.2, 1, 2, 5, 10, 50, 100, 200],
  },
})

lgs.start()

EngineLgs Options

Money in the options is in major units. 1 is one unit of the currency, 0.1 is ten cents. Over HTTP the LGS reports every amount as an integer with six decimals. See Money.

PropertyTypeDefaultDescriptionRequired
storageAbstractStorageWhere wallets, sessions and bets live. See Storage.yes
gamesSlotGame[][]Games to register. The panel registers its own games, so omit this when you pass the LGS to createPanel().
portnumber7771Port of the standalone server. Leave it unset when you pass the LGS to createPanel().
languagesLanguage[]all 17 languagesLanguages a session can be created with.
currenciesCurrency[]all 49 currenciesCurrencies a wallet can be created with.
defaultLanguageLanguage"en"Language of a session that is created without one. Must be in languages.
defaultCurrencyCurrency"USD"Currency of a wallet that is created without one. Must be in currencies.
balance{ starting?, options? }10000, [100, 1000, 10000, 100000]starting is the balance of a new wallet when the session sets none. options are suggested balances for a UI.
bets{ min?, max?, step?, default?, levels? }see BetsBet limits reported to the client and enforced on every play.
random() => numberMath.randomSource of randomness for the outcome draw. Pass a seeded function for repeatable play.
jurisdictionPartial<JurisdictionFlags>every flag falseFlags returned to the client on authenticate. See Jurisdiction.

Bets

PropertyDefaultDescription
bets.min0.1Smallest base bet.
bets.max1000Largest base bet. A mode with a cost multiplier above 1 gets a lower maximum, see Bet rules.
bets.step0.01Every bet must be a multiple of this.
bets.default1Bet level the client starts on.
bets.levels0.1, 0.2, 0.4, 0.6, 0.8, 1, 2, 4, 6, 8, 10, 20, 40, 60, 80, 100, 200, 400, 600, 800, 1000Bet levels offered to the client.

Validation

The constructor throws Invalid LGS options in these cases:

  • defaultLanguage is not in languages, or defaultCurrency is not in currencies.
  • bets.step is zero or negative.
  • bets.min is above bets.max.
  • bets.default or an entry of bets.levels is outside min and max, or not a multiple of step.
  • balance.starting or an entry of balance.options is negative.

Languages and currencies

The default languages are the 17 languages that Engine supports: ar, da, de, en, es, fi, fr, hi, id, ja, ko, pl, pt, ru, tr, vi, zh. The package exports them as LANGUAGES.

The default currencies are the 49 currencies that Engine supports. The package exports them as CURRENCY_CODES, and as CURRENCIES, a table with the symbol and the number of decimals of each currency.

import { CURRENCIES, CURRENCY_CODES, LANGUAGES } from "@slot-engine/lgs"

CURRENCIES.EUR // { symbol: "€", decimals: 2 }
CURRENCY_CODES // ["USD", "CAD", "JPY", "EUR", ...]
LANGUAGES // ["ar", "da", "de", ...]

Jurisdiction

EngineLgs returns these flags in the config.jurisdiction object of the authenticate response. Every flag defaults to false and minimumRoundDuration to 0.

FlagDescription
socialCasinoSocial casino mode. Also true when the session was created with social: true.
disabledFullscreenThe client hides the fullscreen button.
disabledTurboThe client hides turbo spins.
disabledSuperTurboThe client hides super turbo spins.
disabledAutoplayThe client hides autoplay.
disabledSlamstopThe client disables slam stop.
disabledSpacebarThe client ignores the spacebar.
disabledBuyFeatureThe client hides bonus buys.
displayNetPositionThe client shows the net position of the session.
displayRTPThe client shows the RTP.
displaySessionTimerThe client shows a session timer.
minimumRoundDurationMinimum duration of a round, as reported to the client. The LGS does not enforce it.

Money

Over HTTP every amount is an integer with six decimals, whatever the currency: 1000000 is 1.00. The options and the session body take major units instead, so you write balance: { starting: 500 } for 500.00.

The package exports the conversion:

import { MONEY_SCALE, toAmount, toMajor } from "@slot-engine/lgs"

MONEY_SCALE // 1000000
toAmount(2.5) // 2500000
toMajor(2500000) // 2.5

Standalone server

lgs.start() listens on port and resolves with the port and a close() function.

const server = await lgs.start()
server.port // 7771
await server.close()

On start the LGS logs its address and the number of registered games:

⚡️ Slot Engine LGS (Engine) is running on http://localhost:7771
:: 2 games loaded

To serve the LGS inside Slot Engine Panel, pass it to createPanel() instead of calling start(). See the panel configuration.

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

On this page