Skip to content

Getting Started

hizi engine has two main workflows. Your role decides which workflow you need. You may need one or both.

Generating Output Files

If you build a game engine that produces simulation results, use hizi engine generator to convert the results into JSONL output files.

typescript
import { HiziEngineGenerator } from '@hizi.io/engine-generator';

const generator = new HiziEngineGenerator();
await generator.start('./output/');

// Record each simulation outcome
await generator.addResult({ grid: visibleSymbols }, { win, metaTags: ['big-win'] });

// Finalize the output files
await generator.end();

Start here:

Frontend Integration

If you build a game frontend that plays against a running hizi engine, use the hizi engine SDK.

typescript
import { login, loadConfig, placeBet, collect } from '@hizi.io/engine-sdk';

const { token, backendURL } = (await login({ loginURL, launchToken })).result;
const config = (await loadConfig({ backendURL, token })).result.config;
const result = (await placeBet({ backendURL, token, stake: config.stakes[0] })).result.result;

WARNING

This example omits error handling to stay short. Every SDK call returns a TNetworkResponse. Always check response.success before you access result. See Error Handling.

Start here: