Skip to content

Getting Started with hizi engine generator

Installation

The generator is published to the public npm registry — install it like any other npm package:

bash
npm install @hizi.io/engine-generator

Quick Start

1. Import the Generator

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

2. Create an Instance

typescript
const generator = new HiziEngineGenerator();

3. Start Output

Before recording results, open an output directory to stream to:

typescript
await generator.start('./output/');
// Will create ./output/entries.jsonl and ./output/scenarios.jsonl

4. Run Your Simulation and Record Results

For each outcome your game engine produces, call addResult():

typescript
// Your game engine produces an outcome
const win = 50;
const scenario = {
  result: {
    reelIndexes: [12, 45, 78],
    visibleSymbols: [
      [2, 3, 1],
      [2, 2, 2],
      [4, 0, 5],
    ],
  },
};

generator.addResult(scenario, {
  win,
  metaTags: ['medium-win'],
});

Repeat this for every spin in your simulation - typically hundreds of thousands or millions of spins.

5. Finalize Output

typescript
await generator.end();

That's it. The output files are ready to be loaded by the hizi engine.