Player Model
The PlayerModel class is the central state holder for a player session. The PlayerController owns an instance of the model and automatically drives it through the session states defined by SessionState.
Session State Transitions
The following diagram shows the possible transitions between session states:
LOADING- Loading resources and initializing player session.INACTIVE- Waiting for player interaction to start a new round.REQUESTING- Requesting a round to play or replay.PLAYING- Playing a new round or replaying a previous round.INTERRUPTING- Interrupting the current round.INTERRUPTED- A normal round was interrupted before completion.FINISHING- Player session is finishing, waiting for the last round to complete or interrupt.FINISHED- Player session is finished or expired.
Access to Player Model
The active model instance is exposed via System.model property. The PlayerModel provides properties for tracking player session state, balance, bets, and active round model. When uncertain if there is an active round or not, prefer using roundCurrentBet, roundCoinValue and similar properties. They return current values for the active round or player model values if no round is active.
Round State Properties
isRestoringRound- Returnstrueif currently restoring a previously interrupted round.isPlayingRound- Returnstrueif currently playing or replaying a round.isReplayingRound- Returnstrueif currently replaying a completed round.currentState- Current session state fromSessionStateenum.currentRound- Reference to the current round model.
Session Properties
sessionTotalBet- Total amount bet during the current session.sessionTotalWin- Total amount won during the current session.jurisdiction- Player's jurisdiction identifier.winCapProbability- Probability threshold for win cap enforcement.winCapValue- Maximum win amount before cap is applied.roundWinCap- Win cap value for the current round.
Bet and Currency Properties
currentBet- Player's current bet amount.roundCurrentBet- Current bet amount for active round, or player bet if no round.coinValue- Current coin value for currency conversion.roundCoinValue- Coin value for active round, or player coin value if no round.availableBets- Array of available bet amounts.currency- Player's currency code.maxBet- Maximum allowed bet amount.balance- Player's current balance.
Studio Template
Studio templates typically provide a CommonPlayerModel class that extends the base PlayerModel with additional properties and functionality specific to the studio's requirements:
- Backend integration when authorizing the player.
- Backend response parsing after each round to sync player model, balance, and other data.
- Custom game states and UI logic (ante spins, bonus buy features).
- Jurisdiction-specific logic overrides (quick spin settings, win cap enforcement).
- Custom bet configuration and validation.