Recording terminal captures
To show a bug or a fix in a PR, record the curses build with asciinema. Then turn the recording
into a GIF with just term-capture.
PR #11041 has a before and an after
capture.
Requirements
- the curses build:
cmake --preset linux-cursesandcmake --build --preset linux-curses --target cataclysm-bn(see CMake) - asciinema to record
- agg to render the recording
- uv to run
just term-capture
Record
-
Make the terminal small, for example 120 columns and 40 rows. The file is smaller with a small terminal.
-
Make a directory outside the repository for the saves, the settings and the recordings:
mkdir -p ~/bn-capture -
From the repository root, start the game in asciinema:
asciinema rec -c "out/build/linux-curses/src/cataclysm-bn --userdir $HOME/bn-capture/ --configdir $HOME/bn-capture/config/" ~/bn-capture/before.castWith
--userdirand--configdir, the game uses new saves and settings and does not change your own. -
Use the debug menu to set up the scene, then do the steps that show the bug.
-
Quit the game from its menu.
-
Record
~/bn-capture/after.castthe same way with the fixed build.
Make the GIF
Run the just term-capture commands from the repository root.
just term-capture render ~/bn-capture/before.cast ~/bn-capture/before.gif
The GIF plays at 2x speed. Pauses longer than 1 s become 0.5 s.
Drag the GIF into the PR description or a comment. The GIF must be 10 MB or smaller.
Add captions
To cut the game start and show a caption for each step:
-
Save each frame of the GIF as a PNG file:
just term-capture frames ~/bn-capture/before.gif ~/bn-capture/before-frames/ -
Open the PNG files in an image viewer. Find the first frame of each step and the last frame to keep. The frame number is the PNG file name.
-
Write the steps to
~/bn-capture/scenes.json.coloris optional and can beredorgreen.[ { "start": 40, "caption": "enable UPS charging" }, { "start": 67, "caption": "next turn: invalid ammo error", "color": "red" } ] -
Make the captioned GIF. Give the number of the last frame to keep with
--last:just term-capture encode ~/bn-capture/before.gif ~/bn-capture/before-captioned.gif --scenes ~/bn-capture/scenes.json --last 80The GIF starts at the first step and ends at the
--lastframe. The last frame of each step stays on screen for 2 s, and the last frame of the GIF stays for 6 s.