Skip to main content

Calculate Winnings

This node calculates the payout for a spin based on paylines and a paytable.

The Calculate Winnings node determines the total win amount for a slot game result.

The Calculate Winnings node is the financial engine of a slot game. It takes the winning lines identified by Check Wins and calculates the monetary payout based on the bet amount and the specific payout rules (paytable) for each symbol.

Inputs​

Data​

DataDescription
Winning LinesThe array of winning lines from the Check Wins node.
PaytableA JSON object defining payouts. Format: { "SymbolID": { "Count": Multiplier } }.
PaylinesThe array of payline definitions used.

Parameters​

DataDescription
Bet AmountThe total bet for the spin.
Wild SymbolThe ID of the wild symbol (substitutes for others).

Actions​

SignalDescription
DoTriggers the calculation.

Outputs​

Results​

DataDescription
Spin WinningsThe total monetary value won in this spin.
Winning Lines DetailsAn array of objects detailing each win: { line, symbols, positions, payout }.

Events​

SignalDescription
DoneTriggered when calculation is complete.

Usage​

Payout Calculation​

  1. After Check Wins, pass the Winning Lines output to this node.
  2. Pass the Paytable (usually from a Get Paytable node).
  3. Pass the Bet Amount.
  4. Trigger Do.
  5. Add Spin Winnings to the player's balance.

Detailed Behavior​

  • Bet Per Line: It calculates Bet Per Line = Bet Amount / Paylines Count.
  • Multiplier: It looks up the symbol and count in the paytable to get a multiplier.
  • Payout: Line Payout = Bet Per Line * Multiplier.
  • Total: Sums up payouts from all winning lines.

Troubleshooting​

  • Zero Winnings: Ensure your Paytable object uses string keys for Symbol IDs and Counts (e.g., "1": { "3": 5 }). Ensure Winning Lines is not empty.