Skip to content

hizi engine SDK

The hizi engine SDK (@hizi.io/engine-sdk) provides type-safe helper functions. Your game frontend uses these functions to communicate with a running hizi engine.

How It Works

hizi already runs the hizi engine. hizi also manages the hizi engine for you. Your frontend communicates with the hizi engine through the hizi RGS platform:

plaintext
Your Game Frontend  ↔  HTTP/WebSocket  ↔  hizi RGS  ↔  hizi engine  ↔  output files

The backend handles outcome selection, balance management, authentication, and game state. You make the API calls. You render the results.

Exports

typescript
import {
  // Core game functions
  login,
  loadConfig,
  placeBet,
  collect,
  pfVerify,

  // Session management
  refresh,
  reportAnimationEnd,
  updateBalance,
  enableWebSockets,

  // Free play helpers
  getFreePlaysRemaining,
  getFreePlayStake,

  // Game-specific request helpers
  rouletteAdditionalData,
  blackjackInitialData,
  blackjackActionData,
  CRASH_EVENTS,
  crashPlaceBetData,
  crashCollectData,
  minesPickData,
  kenoPickData,

  // Type guards
  isCashChoice,
  isFeatureChoice,

  // Scenario compression codec
  decodeScenario,
  compressScenario,
  expandScenario,
  compressStep,
  expandStep,
  hasScheme,
  buildSymbolToInt,
  SCHEME_VERSION,

  // Response types
  TNetworkResponse,
  TNetworkSuccess,
  TNetworkError,
  IErrorResponse,

  // Constants
  API_RETURNCODES,
  recoverableErrorCodes,
  defaultNetworkTimeout,

  // Reply types
  IConnectReply,
  ILoadConfigReply,
  IPlaceBetReply,
  ICollectReply,
  IPfVerifyReply,

  // Request option types
  ISessionOptions,
  ILoginOptions,
  IPlaceBetOptions,
  ICollectOptions,
  IPfVerifyOptions,

  // Supporting types
  IBalanceEntry,
  IBalanceReply,
  IGameSettings,
  ITokenData,
  IGameState,
  IGameRoundInfo,
  IFreePlayInfo,
  WebSocketHandler,
} from '@hizi.io/engine-sdk';

Engine Types

Game result types are also available from the SDK:

typescript
import type { IGameResult, IScenarioInfo, ISpinInfo, ILoadConfigConfig, IBuyFeatureOption, IProgressionCounterConfig, IProgressionEvent, TPlayerChoiceAward, TPlayerChoiceFeatureAward, TPlayerChoiceCashAward } from '@hizi.io/engine-sdk';

Each rules-based game also exports its own scenario, payload, and event types (for example, IRouletteScenario, IBlackjackScenario, ICrashScenario / TCrashEvent, IMinesScenario, IKenoScenario). The per-game guides document these shapes.

Endpoints

EndpointDescription
/loginExchange the launch token for a session. Read gameSettings
/loadConfigGet the game configuration (stakes, RTP, buy-features)
/placeBetPlace a bet, or continue a multi-step round
/collectCollect the winnings after a round completes
/pfVerifyReplay a past round from its revealed PF seeds
/refreshRefresh the session token
/reportAnimationEndNotify the backend when the animation finishes
/updateBalanceRequest an updated balance

Game Guides

The endpoints above are the same for every game. Only the scenario value that placeBet returns changes per game type. These guides are part of the SDK docs. For each game type, a guide explains the scenario data structure, any additionalData the round needs, and how to integrate the round into your frontend.

GuideWhat it covers
Slot GamesBoards, wins, cascades, hold & win, sticky symbols, multiplier collection, wheel features
PlinkoBucket indexes, row/risk selection via buy features, multiplier lookup, animation of a ball drop
FroggerFlow of the wager stake across multiple steps, risk selection, ladder of cashout multipliers, collect-or-continue loop
MinesPick positions via additionalData, tile states of the board, selection of mine count, cashout progression
Hi/LoplayerChoice-driven higher/lower/skip flow, dynamic card odds, skip re-dealing, multiplier rounding
KenoPlayer numbers via additionalData (or auto-pick), playerNumbers/drawnNumbers, rendering of the pay table
BingoTicket count via additionalData, board shape from rows/cols/freeCellCount, per-pattern prize table
Over/UnderSingle-roll instant resolution, threshold/direction selection, multiplier lookup, win calculation
RouletteMulti-bet rounds via additionalData, the polymorphic selection shape, per-bet settlement[]
BlackjackInitial deal with side bets, hit/stand/double/split/insurance flow, the final IBlackjackScenario
CrashOpening a round via crashPlaceBetData, the curve events over the websocket, manual cashouts via collect

See the Game Guides overview for the longer summaries.

Next Steps

  • Getting Started - Install the SDK. Make your first API calls.
  • Game Flow - Full implementation with a class-based example.
  • Response Handling - Understand IGameResult and multi-step scenarios.
  • Error Handling - Handle network and game errors gracefully.
  • Buy Features - Buy-features that the engine prices, wager features for gamble and cashout ladders, and free plays that the operator grants.
  • Types - The reply, request-option, and engine result types that the package ships.