flame_cli 0.1.0
flame_cli: ^0.1.0 copied to clipboard
A command line tool for creating Flame games, and for inspecting, controlling and playing running ones, for example to take snapshots of them.
A command line tool for inspecting and controlling running Flame games.
flame_cli #
The flame command inspects and controls a Flame game that is running in debug mode, without
having to open the DevTools. This makes it possible for scripts and AI coding agents to, for
example, see what the game currently looks like.
Installation #
dart pub global activate flame_cli
Usage #
Create a new game, like flutter create but from a Flame template and with the Flame packages
set up:
flame create my_game
cd my_game
Start your game with flame run from your project directory. It takes the same arguments as
flutter run, and lets the other commands find the game:
flame run -d macos
Then render the whole game to a PNG image:
flame snapshot --output snapshot.png
List the components together with their ids and attributes, and render a single component:
flame tree
flame snapshot --component 220731871
Hot reload or restart the game after changing the code, and read its output:
flame reload
flame logs
Pause the game, step it forward a number of frames, inspect and change components, turn on the debug rendering and show or hide overlays:
flame pause
flame step --frames 60
flame inspect 220731871
flame set 220731871 --position 100,200
flame debug on
flame overlay show PauseMenu
A running game is tied to its project, so games from different projects never interfere. Several
instances of one project can run at once, for example on two devices: the commands go to the one
started last, and any other one can be addressed with the URI and the port that flame run prints,
through --uri and, for reload and restart, --port. The same --uri option reaches a game
that was started in another way, with the Dart VM Service URI that flutter run prints.
Play the game by sending taps, drags and key presses, and compare two snapshots:
flame input tap 400,300
flame input key space
flame diff before.png after.png --output diff.png
Run flame --help for all the commands and options, and see the
documentation for more information.