Appearance
Step 4: Place bets and collect
Your session is up and the config is loaded. Now the round loop needs two more calls. placeBet starts or continues a round. collect banks winnings when the game offers that choice.
What to do
- Call
placeBet({ backendURL, token, stake, config })with a stake fromconfig.stakes. The result carriesscenario(your game-specific outcome data),totalWin, andengineData. - Render the round from
scenario. Its contents depend on your game type: a slot board, a plinko bucket, or a Hi/Lo card, for example. - Check
engineData.inProgress. If it is set, the round has more steps. CallplaceBetagain to continue it. Pass anyadditionalDataorplayerChoicethat step needs. - Check
engineData.canCollect. If it is set, the player can bank what they have won. Callcollect({ backendURL, token }). - Handle failures. Do not assume success. Some error codes are recoverable and you should retry them. Others end the round.
TIP
Do you want to test a specific outcome, such as a big win, a bonus trigger, or a bust, instead of waiting on real RNG (random number generation)? See Cheating.
Where to read more
- Getting Started with hizi engine SDK: steps 4 to 6 of the quick start cover
placeBet, multi-step rounds, andcollect. - Game Flow: one worked, class-based implementation of the whole round lifecycle. Use it as a model for your client.
- Response Handling: the
IGameResultshape, multi-step continuations, and progression counters. - Error Handling: the response union, recoverable error codes, and what to do with each.
- Game Guides: the
scenarioshape for each game type, and anyadditionalDatathat type's rounds need.