Game AI experimentation framework for imitation learning, computer vision, and automated dataset collection
TypeScript
0
9 commits
updated Oct 7, 2026
Teach an agent to play a game by playing it yourself.
FireFly is a Windows desktop tool that turns a game window into structured observations, records them alongside the buttons you press, and trains small neural networks based on behavior cloning that can learn how to play the game like you. It works with any game: everything game-specific lives in your own data (model outputs, regions, Lua scripts and graphs), not in FireFly's code.
Status: under active development. Windows only. Expect rough edges.
Running two models at once from the Trained Models tab: a YOLO detector boxing the monsters, and a segmentation model whose outputs trace the platforms (green) and ladders (yellow). The States on the right update live.
A policy trained in the Policy Graph playing the game by itself. The banner shows what it's pressing and how fresh the frames it acts on are, and it stops the moment you press a key or click in the game, allows you to correct the action, and resumes playing.
See the game
Record and learn
React UI (src/) ──► Electron main (electron/) ──► native runtime (native/, C++)
└─► Python workers (worker/)
py -3.12.Get the Windows installer, FireFly-Setup-<version>.exe, from the latest release, and run it. It includes everything FireFly needs: the native runtime, ONNX Runtime with DirectML, and a bundled Python with PyTorch for training.
Install the JavaScript dependencies, then set up and build the native runtime:
npm install
npm run native:setup # pins vcpkg and its packages into .tools/
npm run native:onnxruntime # ONNX Runtime (CPU); or native:onnxruntime:gpu for DirectML
npm run native:configure # the TEMP folder's path must not contain spaces
npm run native:build
Set up Python (a .venv with PyTorch, ONNX and Ultralytics):
npm run python:setup
Run the app:
npm run build
npm start
To develop with hot reload instead, start Vite in one terminal and Electron in another:
npm run dev
$env:NODE_ENV='development'; npx electron .
| Path | What's there |
|---|---|
src/ | The React UI: Window View, Inspector, Policy Graph, panels |
electron/ | The main process: windows, the model library, training, play loop |
native/ | The C++ runtime: capture, observation graph, models, template matching, recording, input guard |
worker/ | Python: datasets, formulas, policy training and prediction, UNet and YOLO training |
scripts/ | Setup scripts, and example Lua scripts |
tests/ | UI, runtime and unit tests |
docs/ | Guides: live inference, data collection, Lua regions |
npm run build # strict TypeScript check and production build
npm run native:test # native graph, template, recording and worker tests
npm run test:python # Python workers
npm run test:play # the play loop, with stand-ins
The UI tests run the real app in an isolated profile, for example npm run test:keyboard-ui. See package.json for the full list. A few of them (test:detector-ui, test:multi-model-ui, test:runtime-preview) need trained models in runs/ or a dataset in dataset/, which are kept out of the repository.
docs/live-inference.md: inference devices, the runtime's workers, and GPU support.docs/data-collection.md: the graph directory and collection graphs.docs/lua-regions.md: Lua regions, their coordinates and editing.CLAUDE.md: detailed architecture and design notes.FireFly is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3 or (at your option) any later version. See LICENSE.
Copyright (C) 2026 the FireFly contributors.
Third-party components keep their own licenses. Among them, Ultralytics, which trains the YOLO detectors, is also AGPL-3.0, and the models it exports say so in their metadata.
Game AI experimentation framework for imitation learning, computer vision, and automated dataset collection
TypeScript
0
9 commits
updated Oct 7, 2026
Teach an agent to play a game by playing it yourself.
FireFly is a Windows desktop tool that turns a game window into structured observations, records them alongside the buttons you press, and trains small neural networks based on behavior cloning that can learn how to play the game like you. It works with any game: everything game-specific lives in your own data (model outputs, regions, Lua scripts and graphs), not in FireFly's code.
Status: under active development. Windows only. Expect rough edges.
Running two models at once from the Trained Models tab: a YOLO detector boxing the monsters, and a segmentation model whose outputs trace the platforms (green) and ladders (yellow). The States on the right update live.
A policy trained in the Policy Graph playing the game by itself. The banner shows what it's pressing and how fresh the frames it acts on are, and it stops the moment you press a key or click in the game, allows you to correct the action, and resumes playing.
See the game
Record and learn
React UI (src/) ──► Electron main (electron/) ──► native runtime (native/, C++)
└─► Python workers (worker/)
py -3.12.Get the Windows installer, FireFly-Setup-<version>.exe, from the latest release, and run it. It includes everything FireFly needs: the native runtime, ONNX Runtime with DirectML, and a bundled Python with PyTorch for training.
Install the JavaScript dependencies, then set up and build the native runtime:
npm install
npm run native:setup # pins vcpkg and its packages into .tools/
npm run native:onnxruntime # ONNX Runtime (CPU); or native:onnxruntime:gpu for DirectML
npm run native:configure # the TEMP folder's path must not contain spaces
npm run native:build
Set up Python (a .venv with PyTorch, ONNX and Ultralytics):
npm run python:setup
Run the app:
npm run build
npm start
To develop with hot reload instead, start Vite in one terminal and Electron in another:
npm run dev
$env:NODE_ENV='development'; npx electron .
| Path | What's there |
|---|---|
src/ | The React UI: Window View, Inspector, Policy Graph, panels |
electron/ | The main process: windows, the model library, training, play loop |
native/ | The C++ runtime: capture, observation graph, models, template matching, recording, input guard |
worker/ | Python: datasets, formulas, policy training and prediction, UNet and YOLO training |
scripts/ | Setup scripts, and example Lua scripts |
tests/ | UI, runtime and unit tests |
docs/ | Guides: live inference, data collection, Lua regions |
npm run build # strict TypeScript check and production build
npm run native:test # native graph, template, recording and worker tests
npm run test:python # Python workers
npm run test:play # the play loop, with stand-ins
The UI tests run the real app in an isolated profile, for example npm run test:keyboard-ui. See package.json for the full list. A few of them (test:detector-ui, test:multi-model-ui, test:runtime-preview) need trained models in runs/ or a dataset in dataset/, which are kept out of the repository.
docs/live-inference.md: inference devices, the runtime's workers, and GPU support.docs/data-collection.md: the graph directory and collection graphs.docs/lua-regions.md: Lua regions, their coordinates and editing.CLAUDE.md: detailed architecture and design notes.FireFly is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3 or (at your option) any later version. See LICENSE.
Copyright (C) 2026 the FireFly contributors.
Third-party components keep their own licenses. Among them, Ultralytics, which trains the YOLO detectors, is also AGPL-3.0, and the models it exports say so in their metadata.