Skip to main content
Every game in the Stake Engine Math SDK starts with a GameConfig class that inherits from Config. This is where you declare everything the engine needs to run simulations: board dimensions, symbol payouts, reelstrip files, special symbol behaviour, and bet mode definitions.

The GameConfig class

GameConfig must implement __init__ and explicitly set all required fields. The engine will raise a RuntimeError at startup if any required field is missing or if an invalid symbol is detected on a reelstrip.
game_config.py

Required fields

string
required
Unique identifier string for this game, used by the RGS and frontend.
number
required
Numeric identifier assigned by the provider registry.
string
required
Human-readable internal name used during development.
number
required
Maximum win multiplier allowed in a single round. The engine caps all wins at this value.
string
default:"lines"
required
Win evaluation method. Must be one of "lines", "ways", "cluster", or "scatter". See Win Types for details on each method.
number
required
Target return-to-player percentage (e.g. 0.97 for 97%). Used by the optimization algorithm.
number
required
Number of reels on the board.
number[]
required
Array of row counts per reel. Length must equal num_reels.
object
required
Dictionary mapping (kind, symbol) tuples to payout multipliers. See Paytable format below.
object
required
Dictionary mapping attribute names to lists of symbol names. See Special symbols below.
object
required
Scatter-count-to-free-spin-count mapping per game type. See Scatter triggers.
object
required
Loaded reelstrip data, keyed by reel identifier. See Reels below.
object[]
required
List of BetMode instances defining cost, RTP, and distribution criteria. See Bet Modes.

Paytable format

The paytable maps (kind, symbol) tuples to float payout multipliers, where kind is the number of matching symbols that trigger the win.
game_config.py
For games where a range of matching counts share a payout (common in cluster and scatter pays), use pay_group together with convert_range_table():
game_config.py

Reels

Reelstrips are stored as CSV files and loaded into self.reels as a dictionary keyed by a short identifier string. Use read_reels_csv() to load each file:
game_config.py
The keys you use here (BR0, FR0, etc.) must match the keys referenced in each BetMode’s reel_weights distribution condition. See Bet Modes for how reel weights are assigned per simulation.
It is common to have multiple reelstrips per game type (e.g. BR0, BR1) with different RTP profiles. The optimization algorithm selects weights between them to hit your target RTP.

Special symbols

Special symbols are defined as a dictionary from attribute name to a list of symbol names:
game_config.py
Once a symbol is initialized, its attribute is accessible on the symbol object:
gamestate.py
By default, an attribute is set to True. To attach a meaningful value (such as a multiplier amount), override this in gamestate.special_symbol_functions.
A symbol is valid only if its name appears in either self.paytable or self.special_symbols. If a reelstrip contains an unrecognised symbol name, a RuntimeError is raised when the configuration is loaded.

Symbol validation

The engine checks all symbols in loaded reelstrips against both paytable and special_symbols at startup. Any symbol name that does not appear in either structure is rejected:

Scatter triggers and anticipation

Free spin entry from the base game and retriggers in the free game are configured per game type. The format is {num_scatters: num_free_spins}:
game_config.py
The check_fs_condition() method reads this configuration to determine whether free spins should be triggered or retriggered after each spin.

Game type constants

The basegame_type and freegame_type constants default to "basegame" and "freegame" respectively. They are used throughout configuration and game state to index game-type-specific values:
game_config.py
gamestate.py
All simulations start in basegame_type. The engine transitions to freegame_type automatically when reset_fs_spin() is called at the start of run_freespin().

Bet Modes & Distributions

Configure cost, RTP targets, and per-simulation win criteria.

Implementing GameState

Use your config in the run_spin() simulation loop.

Win Types

Choose between lines, ways, cluster, and scatter evaluation.

Config API reference

Full field listing for the base Config class.