· via Hacker News – Front Page (native)
Cbirds: a dependency-free C99 boids flock that flies in any terminal
Cbirds is a single C99 program with no dependencies that animates Craig Reynolds' boids using braille characters in any terminal and sprites in Kitty and Ghostty, and it can turn piped command output into a flying flock.
A terminal flock simulator named cbirds reached the Hacker News front page on 12 October, pointing readers to the clainstone/cbirds repository on GitHub. The program implements Craig Reynolds' boids — the classic model in which lifelike flocking emerges from a few simple local rules — and, according to the project's README, it is a single C99 program with no dependencies, running on Linux and macOS.
Two renderers in one binary
By default cbirds draws its birds in braille characters, a mode any terminal can display, with a sextant mode also available. Passing --render kitty switches to sprite graphics sent over the Kitty graphics protocol, which works in the Kitty and Ghostty terminals. The README notes that every demo clip on the project page was recorded by the program itself. Normal runs are capped at 60 frames per second; --unlock-fps removes the frame delay for profiling, and because the simulation advances in real time, unlocking the frame rate does not make the birds fly faster.
A flock you can poke
The simulation reacts to its viewer. Moving the pointer into the flock scatters it, and pressing q makes the whole flock exit through the top of the window before the program quits. Pressing h opens a slider panel covering boundary, separation, alignment, turning, perception and speed — with the speed control ranging, per the README, from a fifth of the flock's normal pace to about 2.6 times it. Lowercase keys lower a value by one notch and uppercase keys raise it. Left alone for a minute, the program begins adjusting its own sliders until any key is pressed.
The option set includes a murmuration preset that mimics starlings, hawks that hunt the flock, multiple flocks whose willingness to mix can be tuned, colour schemes such as ice, ember and prism, depth and trail effects, and a --matrix mode in which the birds fall like rain. The flock can also write and hold a message with --say, tell the time with --clock, draw a PNG image with --picture, or act as a screensaver.
Piped text becomes the flock
Anything piped into cbirds — fastfetch output, figlet banners, directory listings, git logs — first appears exactly as the source command printed it, because cbirds reads the escape sequences and reproduces the colours and layout. A few seconds later one letter departs and its neighbours follow, and the text flies as a flock. After roughly twenty seconds the letters are called home, each landing back on its own cell so the screen again shows exactly what the command printed.
Letters keep their own colours, bold and underline while in flight; wide characters occupy two cells; hawks appear as arrows over text. A pipe is read to its end, or until it has been quiet for a second and a half, run for eight seconds, or delivered a megabyte — whichever comes first — and only the last screenful is kept, so tailing a log shows what the log contained when it went quiet. When input is a pipe, keys are read from /dev/tty, and with no terminal at all the program reports that it requires one and exits. Recordings of text runs cover a full 34-second cycle by default, timed so that a GIF loops seamlessly.
Installation
There are three install routes. A Homebrew tap ships completions for bash, zsh and fish; an apt repository covers Debian 12, Ubuntu 22.04 and later derivatives on amd64 or arm64; and building from source needs only a C compiler and make, installing a single file at /usr/local/bin/cbirds. The build honours CC, CFLAGS, LDFLAGS, PREFIX and DESTDIR, make test runs the test suite, and the README documents uninstall steps for every method.
Why it matters
Cbirds is a compact showcase for how much terminal rendering has grown. Braille cells give even the plainest terminal a coarse pixel grid, while the Kitty graphics protocol — now supported beyond its namesake by Ghostty — lets a text-based program place real sprites. It is also a tidy example of distribution discipline: one dependency-free C99 binary with its own packaging, shell completions, tests and built-in recorder, no runtime stack required. Most of all, it is a playable explanation of an emergent-behaviour classic, with every rule of the model exposed on sliders the reader can push.
- #terminal
- #boids
- #simulation
- #c99
- #open-source