hizi engine Generator
hizi engine generator converts your game engine's simulation results into compact JSONL files consumed by the hizi engine runtime. Available as @hizi.io/engine-generator.
Three steps: simulate outcomes, record them with addResult(), and write output files with start() and end().
typescript
import { HiziEngineGenerator } from '@hizi.io/engine-generator';
const generator = new HiziEngineGenerator();
await generator.start('./output/');
for (const spin of simulate(1_000_000)) {
generator.addResult(spin.scenario, {
win: spin.win,
metaTags: spin.tags,
});
}
await generator.end();Key Features
- Entry merging - Identical outcomes are grouped automatically, keeping files small
- Scenario limiting - Up to 1,000 snapshots per entry (configurable), weight always tracked
- Streaming to disk - Scenarios stream directly to disk, no memory accumulation for large datasets
- Dual environment - Node.js and browser (OPFS) support