Vectrune documentationAlpha referenceLearning site ↗

Terminal animation and first-person Ascii3D

Build terminal screensavers, graphs and games with ASCII Animator; add textured raycast worlds and depth-tested sprites with Ascii3D. Available in v0.3.12, native terminal only.

Generate your own art and animation

Generate a runnable starter Rune animation, convert an image to ASCII, or render a text banner. These commands need no checkout or example directory. Results go to stdout unless -o selects a new file; existing files are never overwritten. Linux source builds require ALSA development headers (libasound2-dev on Debian/Ubuntu).

generate accepts --text (default Hello, ASCII!), --width (3-240, default 60), and --height (3-80, default 12). Text must fit within width minus two. image accepts PNG, JPEG, GIF (first frame), WebP and BMP, --width (1-240, default 80), and --invert. Height preserves aspect with a 0.5 terminal-cell correction; transparent pixels composite onto black. Inputs are limited to 8192x8192 and 64 MiB decoded, outputs to 1000 rows. text renders 1-120 printable ASCII characters into an 8-row banner. image/text produce plain art, not Rune apps.

The nine example apps are ordinary downloadable Rune files, not embedded demos. Run them using ascii run <local-path>. Q, Esc and Ctrl-C exit playback and restore the terminal.

Command / usage
vectrune ascii generate --text "Hello!" -o animation.rune
vectrune ascii run animation.rune
vectrune ascii image photo.png --width 80 -o photo.txt
vectrune ascii text "VECTRUNE"
# With a checkout:
vectrune ascii run examples/ascii/sentinel.rune

Download Rune examples and GIF assets

Add an Ascii3D layer to the canvas

Keep @App type = ascii-animator. A named @Ascii3D section declares a rectangular grid and character textures; its camera and entity fields bind top-level @Logic state. An ascii3d canvas object renders the viewport, then ordinary 2D text/boxes draw the HUD. In map rows '.' is empty; other characters need wall materials referencing @AsciiSprite textures.

Maps are 3-128 columns/rows, solid on left/right and also top/bottom unless repeat_y is true. Wall frames must be rectangular and equal-sized. Camera angle 0 faces +X and 90 faces +Y. Optional eye height and pitch shift the projection. Entities scale with distance and are depth-tested against walls, floor, ceiling and other sprites.

Ascii3D, AsciiAnimator and AsciiSprite field reference

Endless Halls: a complete screensaver

This runnable file repeats corridor rows along Y, scrolls perspective floor tiles and animated textures, and wraps its camera and lamp positions explicitly. Up/Down changes speed; Space freezes drift.

Rune source
@App
type = ascii-animator
scene = halls

@AsciiAnimator/halls
size = [78, 23]
fps = 20
logic = halls

@Ascii3D/corridor
map = [
    "###.........###",
    "#.............#",
    "#.............#",
    "A.............A",
    "#....#...#....#",
    "#....#...#....#",
    "#.............#",
    "#.............#",
    "###.........###",
    "#.............#",
    "#.............#",
    "A.............A",
    "#....#...#....#",
    "#....#...#....#",
    "#.............#",
    "#.............#"
]
walls = {"#": {"texture": "stone", "color": "cyan"}, "A": {"texture": "arch", "color": "yellow"}}
repeat_y = true
camera = camera
entities = lamps
fov = 70
far = 48
floor = gray
ceiling = blue

@AsciiSprite/stone
frames = [["----+---", "    |   ", "+-------", "|       "]]

@AsciiSprite/arch
fps = 2
frames = [
    ["/######/","| [++] |","| .... |","/######/"],
    ["/######/","| [**] |","| .... |","/######/"]
]

@AsciiSprite/lamp
fps = 3
frames = [[" .-. ", "[ * ]", "  |  "], [" .-. ", "[ + ]", "  |  "]]

@Logic/halls
state:
    camera = {"x": 7.5, "y": 0.5, "angle": 90, "z": 0.5, "pitch": 0}
    lamps = []
    ticks = 0
    speed = 0.1
    paused = false
    canvas = []
keys:
    ArrowUp -> faster
    ArrowDown -> slower
    Space -> pause
action initialize:
    camera = {"x": 7.5, "y": 0.5, "angle": 90, "z": 0.5, "pitch": 0}
    lamps = [
        {"x": 5.5, "y": 2.5, "z": 0.35, "sprite": "lamp", "size": 0.3, "color": "yellow"},
        {"x": 9.5, "y": 10.5, "z": 0.35, "sprite": "lamp", "size": 0.3, "color": "magenta"}
    ]
    ticks = 0
    call paint
action faster:
    speed = min(0.3, speed + 0.025)
action slower:
    speed = max(0.025, speed - 0.025)
action pause:
    paused = not paused
action tick:
    if not paused:
        ticks += 1
        camera.y = (camera.y + speed) % 16
        camera.x = 7.5 + sin(ticks * 1.5) * 0.25
        camera.angle = 90 + sin(ticks * 0.7) * 5
        camera.z = 0.5 + sin(ticks * 8) * 0.012
        camera.pitch = sin(ticks * 1.1) * 1.5
        lamps[0].y = camera.y + (2.5 - camera.y + 16) % 16
        lamps[1].y = camera.y + (10.5 - camera.y + 16) % 16
    call paint
action paint:
    canvas = [
        {"type": "ascii3d", "scene": "corridor", "x": 0, "y": 1, "width": 78, "height": 21},
        {
            "type": "text",
            "x": 2,
            "y": 0,
            "text": "E N D L E S S   H A L L S   /   ASCII3D",
            "color": "cyan"
        },
        {
            "type": "text",
            "x": 2,
            "y": 22,
            "text": paused ? "Drift paused. Space resumes. Q: leave the halls.": "Up/Down: drift speed   Space: pause   Q: leave the halls.",
            "color": "yellow"
        }
    ]

First-person combat and downhill rails

Sentinel: Enter starts, W/S moves, Left/Right turns, A/D strafes, Space fires, P pauses and R restarts. Clear six drones. The optional AsciiAnimator spatial field binds its non-repeating grid to existing slide/sees collision and visibility helpers, so shots cannot pass through walls.

Descent: Enter starts, A/D or Left/Right steers, Space fires, P pauses and R restarts. The camera advances automatically and accelerates. Destroy aligned turrets before passing them; missed turrets cost 10 shield, direct collisions cost 30. Reach 1000 meters to win.

Ascii3D is a 2.5D raycaster with fixed-height walls and planar floor/ceiling, not a polygon renderer. Descent's downhill effect uses a pitched camera, scrolling floor, head bob and decreasing altitude; actual slopes and vertical physics are not modeled. Repeating maps cannot be the spatial-helper binding.

A complete original text adventure

The Kingdom of Borrowed Mornings follows Tamsin Thread, the royal sock-mender, through nine animated areas. A magpie notary has trapped dawn in a torn contract. Repair a windmill, share bread with a troll, remember a frog's lullaby and mend the law itself. A short synthesized melody accompanies the title and sunrise ending.

Type BEGIN, then HELP. LOOK, directions, TAKE, TALK TO, USE item ON object, GIVE item TO person, INVENTORY, JOURNAL, MAP and progressive HINT commands guide exploration. There are no deaths, timers or item loss from wrong actions; saves are not implemented. Keep borrowed_morning.rune beside its borrowed_morning directory. The terminal needs 78x30. Use --mute without an audio device.

AsciiAnimator command = command names a one-parameter Logic action. The native prompt submits lowercased text with whitespace collapsed, up to 120 printable ASCII characters. Enter submits, Backspace edits, Ctrl-U clears, Esc/Ctrl-C exits; Q is ordinary text. Animation continues while typing. Command-mode apps cannot also declare key bindings. Plain captures accept repeated --commands, one per tick, without --keys.

Command / usage
vectrune ascii run examples/ascii/borrowed_morning.rune
vectrune ascii run examples/ascii/borrowed_morning.rune --plain --frames 2 --commands "begin" --commands "talk to kettle"

Download examples, adventure scenes and GIF assets

GIF sprite platformer (unreleased prototype)

The Thirteenth Bell lives in examples/ascii/games/clockwork with ten original GIF assets and a reproducible art generator. Play Wick, the last lamplighter: climb rotating gear ledges, collect three clockseeds and wake the forest's heart. Checkpoints retain seeds; there are no timers, saves or permanent deaths. Arrows/A/D move, Space/W/Up jumps, Down/S brakes, P pauses gameplay/music, M toggles the haunted theme and effects, R restarts and Q quits. Requires a 160x48 terminal (160x47 canvas at 30 FPS) and the unreleased GIF sprite/music runtime; it does not run with v0.3.12.

Movement accelerates, retains momentum across jumps and supports air steering, four-frame jump buffering and coyote time. Standard terminals cannot reliably report key releases; ground movement expires after a short repeat grace then decelerates. Pressing Space no longer cancels forward travel. The larger view scales scene positions by 4/3 and enlarges decoded sprites while keeping physics and collision in the original world coordinates.

Declare @AsciiSprite/courier with source = assets/courier.gif and width = 11. GIFs decode once relative to the declaring file, including imports. source cannot combine with frames or fps; GIF delays loop on the host tick clock. Transparent alpha cells preserve previous layers; opaque black spaces cover them. Wick uses explicit distance-driven walk frames, a still idle pose and separate rising/falling sprites from courier_jump.gif. His pose freezes while paused; scenery GIF animation continues.

Command / usage
# Use the unreleased prototype binary:
vectrune ascii run examples/ascii/games/clockwork/forest.rune
# Device-free preview:
vectrune ascii run examples/ascii/games/clockwork/forest.rune --plain --frames 8 --keys Enter

AsciiMusic scores (unreleased prototype)

@AsciiMusic/name reuses Rune-Web's music parser, scheduler and synth instead of declaring each note as a tone. Use tempo (21-399, default 128), volume (0-0.5, default 0.2), loop (boolean, default true), time_signature (4/4 or 3/4), optional bars (1-64), lead/bass/drums note tracks, instruments and up to five custom channels. Notes include D4, F#4, Eb4, rests -/R/_, bar separators | and chords [D4,F4,A4]:4. Durations :1/:2/:4/:8/:16/:32 are shared with Rune-Web. Quote inline chords; multiline tracks need no quotes.

music "haunted" starts/restarts the named score; music.pause parks its beat, music.resume continues, music.stop clears it. Native PCM sample time owns scheduling independently of canvas FPS. Effects, arrangements and runtime composition are not supported. Invalid inputs fail even while muted. Limits: 32 scores, eight channels, 4096 note/rest events and 64 KiB per score. --mute and --plain never open a device.

Command / usage
@AsciiMusic/haunted
tempo = 100
volume = 0.07
instruments = {"lead":"triangle", "bass":"sine"}
lead:
    D4:4 F4:4 A4:4 D4:4
bass:
    D2:2 -:2

AsciiMusic field reference

Desktop GIF mode (unreleased)

Build with pixel-desktop and use ascii run <file> --desktop to render original GIF sprites in a resizable window, retaining Rune logic, layers and music. Clockwork uses a 960x564 logical framebuffer. GIF color is tinted by the canvas sprite color; white preserves it. Inline sprites, text, boxes, lines and graphs remain bitmap ASCII. Held direction keys refresh per tick; jumps dispatch on press. Focus loss clears held keys and freezes simulation, not music. Q/Esc/window close exits.

Terminal playback remains default. --desktop conflicts with --plain, supports --mute and --frames N, and rejects typed-command and Ascii3D apps. Direct <file> --desktop also works. Standard builds report an explicit feature-build instruction; v0.3.12 binaries do not include this addition.

Command / usage
cargo build --release --features pixel-desktop --bin vectrune
target/release/vectrune ascii run examples/ascii/games/clockwork/forest.rune --desktop

Simple native sound cues

Sentinel uses short synth cues for shots, hits, drone destruction, damage and win/loss. Declare @AsciiTone/name with frequency (20-8000 Hz), optional end_frequency, duration (0.01-1 seconds, default 0.1), volume (0-0.5, default 0.15), and wave (sine, square, triangle, sawtooth or noise; default sine). Play it with sound "name" inside a Logic action. No sound files or WebAudio setup are required.

Cues reuse the native game mixer and are consumed once per action. --mute skips the audio device, including direct file launches; --plain is always silent. Missing devices produce an explicit error with mute guidance. Static musl Linux builds cannot load external ALSA plugins; plugin-only configurations may need the GNU build.

Command / usage
vectrune ascii run examples/ascii/sentinel.rune --mute
vectrune examples/ascii/sentinel.rune --mute

Capture a frame or script keyboard input

Plain mode prints only the final rectangular frame, without ANSI sequences, sound, keyboard polling or delays. It defaults to one tick. Keys are supplied once per tick before simulation advances. Interactive terminals need at least canvas height plus one row.

Command / usage
vectrune ascii run examples/ascii/halls.rune --plain --frames 120
vectrune ascii run examples/ascii/sentinel.rune --plain --frames 20 --keys Enter,Space
vectrune ascii run examples/ascii/descent.rune --plain --frames 60 --keys Enter,Space