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.
Data
| Data | Description |
|---|
| Winning Lines | The array of winning lines from the Check Wins node. |
| Paytable | A JSON object defining payouts. Format: { "SymbolID": { "Count": Multiplier } }. |
| Paylines | The array of payline definitions used. |
Parameters
| Data | Description |
|---|
| Bet Amount | The total bet for the spin. |
| Wild Symbol | The ID of the wild symbol (substitutes for others). |
Actions
| Signal | Description |
|---|
| Do | Triggers the calculation. |
Outputs
Results
| Data | Description |
|---|
| Spin Winnings | The total monetary value won in this spin. |
| Winning Lines Details | An array of objects detailing each win: { line, symbols, positions, payout }. |
Events
| Signal | Description |
|---|
| Done | Triggered when calculation is complete. |
Usage
Payout Calculation
- After Check Wins, pass the
Winning Lines output to this node.
- Pass the
Paytable (usually from a Get Paytable node).
- Pass the
Bet Amount.
- Trigger Do.
- 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.