Vectrune documentationAlpha referenceLearning site ↗

Pixel and 3D configuration

Scene, map, asset, camera, model, and control configuration.

@Animation

@Animation/<name>

Declare a reusable multi-frame sprite or Pixel-3D model animation clip with optional playback modes, interpolation, and per-keyframe transforms.

Runtime: Pixel / Pixel 3D

Errors / edge cases

Rejects unknown @Model/@Sprite frame names, mixed model and sprite frames in one clip, fps outside (0, 60], unknown modes, invalid transform bounds, or animation names colliding with existing models/sprites.

Fields

FieldTypeDefaultMeaning
fpsnumber8Playback frame rate in (0, 60].
modestring"loop"Pixel-3D playback mode: loop, pingpong, or once.
interpolatebooleanfalseSmoothly tween keyframe transforms (x, y, z, angle, pitch, scale, dissolve) between adjacent frames.
frameslist | seriesrequired1-128 frame entries: @Model/@Sprite name strings or keyframe objects with model/sprite plus optional label, x, y, z, angle, pitch, scale, and dissolve.
Example
@Animation/knight/slash
fps = 10
mode = "once"
interpolate = true
frames:
    {"model":"knight_f1","label":"Windup","angle":-18}
    {"model":"knight_f2","label":"Strike","x":0.14,"angle":24,"scale":1.04}

Implementation: src/apps/pixel/mod.rs · src/apps/pixel3d/mod.rs · runtime/rune-web/src/pixel3d/animation.ts

@Camera

@Camera/<name>

Declare a timed cinematic camera track.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
durationnumberrequiredTrack duration in seconds.
loopbooltrueWhether to repeat the track.
pointsarrayrequired2–128 points, each with finite x, y, angle; optional height (default 0.5), pitch (default 0, range -85..85).

Implementation: src/apps/pixel3d/scenes.rs

@Controls

@Controls/<name>

Declare portable keyboard, pointer, touch, and gamepad controls.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
extendsstring—Parent profile name; inheritance is validated for cycles and depth.
keysmapping{}Keyboard code -> action input.
commandsmapping{}Keyboard code -> host command.
mousemapping{}Pointer button/axis -> action input.
gamepadmapping{}Button/axis -> input or host command; optional scale, invert, deadzone, mode.
touchobject—Joystick, look surface, and buttons. Touch objects may bind visibility to boolean state paths.
Example
@Controls/game
keys:
    Space -> fire
commands:
    KeyP -> host.pause

Implementation: src/apps/game_controls.rs · runtime/rune-web/src/input/browser.ts · runtime/rune-web/src/pixel3d/index.ts

@Map

@Map/<name>

Declare a grid environment and optional visual floor, ceiling, sky, and spawn.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
gridlist/seriesrequiredTile rows.
legendobjectrequiredCharacter-to-tile definitions.
floorcolor/texturecompiler defaultOpaque #RRGGBB or compiled texture name.
ceilingcolor/texturecompiler defaultOpaque #RRGGBB or texture; mutually exclusive with sky.
ceiling_heightnumber1Greater than 0.5 and no more than 16; visual elevation.
skyobject—Seeded sky panorama; optional cloud_wave and cloud_glow range from 0 to 1.
spawnobject—Numeric x/y and optional angle (default 0).

Implementation: src/apps/pixel3d/mod.rs

@Model

@Model/<name>

Declare a palette-colored model using boxes, spheres, cylinders and ramps. Models are visual geometry; games author collision separately.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
palettestringrequiredNamed @Palette.
unitnumber0.125Model coordinate unit scale.
emissivestring—Opaque palette symbols whose model surfaces contribute to bloom in Enhanced lighting.
glass[number, number]—Full pane dimensions on local X and Y at Z=0, in model units. Enhanced lighting draws a transparent tint and a rim on the plane.
contact_shadownumber—Contact shadow radius in world tiles, up to four. Enhanced lighting projects it onto supporting voxel terrain or glass.
blocksseriesoptional when shapes are presentPalette-colored box records (from[3], size[3], color, optional integer order in [-1000, 1000] for coplanar layering; defaults to load order); 1-256 total blocks and shapes per model.
shapesseriesoptional when blocks are presentSphere: type, center[3], radius, color. Cylinder: type, center[3], radius, height, color; axis is Z. Ramp: type, from[3], size[3], color; top rises along local +X. All shapes accept optional integer order in [-1000, 1000] for coplanar layering (defaults to load order). Dimensions use unit; centers and radii may be fractional. Rotate an instance with angle to turn a ramp.

Implementation: src/apps/pixel3d/mod.rs

@Music

@Music/<name>

Define a chiptune or synth song.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
typestringparser defaultMusic chip/style.
temponumberparser defaultBeats per minute.
time_signaturestring—For example 4/4.
barsnumber—Number of measures.
loopboolparser defaultLoop the track.
volumenumberparser defaultMaster gain.
lead / bass / drumsnote strings—Built-in tracks; custom named tracks are also supported.
sectionsobject—Reusable named sections: each has integer bars (1-64) and channel-to-note-string fields. Missing/short channels are padded with rests; overlong phrases are rejected. Use with arrangement instead of top-level tracks/bars.
arrangementarray—Ordered section names or {section, repeat} cues; repeat accepts integers 1-16. Up to 32 sections, 128 cues and 512 expanded bars in 4/4 or 3/4. loop repeats the full arrangement.
instrumentsobjectchannel defaultsChannel-to-synth-voice map. Supports square, sine, triangle, bass, sawtooth, synth, pluck, drums, brass, strings and bell. Works with legacy tracks and arranged sections in browser/native hosts.
effectsobject—Chip engine effects chain: reverb (decay, wet, pre_delay, reverse, filter), delay (time, feedback, wet, damping), filter (type, cutoff, q), crush/drive (bits, drive, wet), and chorus (rate, depth, delay, wet). Top-level shorthand keys (reverb, delay, etc.) are also supported.
track_effectsobject—Per-channel effect send levels (e.g. {lead: {reverb: 0.4, delay: 0.3}, bass: {reverb: 0, delay: 0}}). By default melodic tracks send 100% and bass/drums avoid muddy echoes.

Implementation: src/apps/rune_web/ast.rs

@Palette

@Palette/<name>

Map single ASCII symbols to colors for pixel assets.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
colorsobjectrequired1–256 entries mapping single ASCII characters to #RRGGBB or transparent.
Example
@Palette/base
colors = { "#": "#223344", ".": "transparent" }

Implementation: src/apps/pixel/mod.rs

@Perspective

@Perspective/<name>

Declare a camera field of view.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
fovnumberrequiredFinite field of view between 20 and 120 degrees.

Implementation: src/apps/pixel3d/scenes.rs

@Scene

@Scene/<name>

Bind game logic, maps, assets, cameras, input, and HUD presentation.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
logicstringrequiredNamed @Logic; Pixel 3D requires start and tick actions.
mapstringrequiredInitial @Map name.
camerastringplayerCamera state field or a declared cinematic camera.
thingslist of strings[]State collection names rendered as scene objects. Browser canvases may use data-pixel-pick=<collection> and data-pixel-pick-action=<action> to select visible model pixels, receiving the zero-based collection index. Scene depth rejects occluded models; invisible models and sprites are not selected. HUD/sidebar hits take precedence.
tetherslist of strings[]State paths to depth-tested tethers or lists of tethers; each tether defines world points, radius, RGB color, and optional two-point slack.
weaponstringnullWeapon state binding.
hudobjectnullState-field bindings for legacy HUD values.
controlsstring—Named @Controls profile.
mouse_lookbooltrueEnable mouse-look input.
keysobjectWASD / arrows / Space / EKeyboard mapping when no custom mapping is supplied.
worldstring—Voxel world state field; must exist.
lightsstring—State field containing up to eight point-light records. Available in voxel gameplay scenes and separately on a cinematic title scene, through the shared JavaScript CPU renderer.
uistring—Structured HUD state field. Floating HUD theme colors are background, surface, selected, border, text, muted, accent, focus (RGB integers), plus radius 0-12. Sidebar grids require one column and at most ten items; width 120-640, rowHeight 18-64, padding 4-24, gap 0-24, textScale 1/2, subtitle, dismissAction, moveAction, closeOnActivate are optional. closeOnActivate=true requires dismissAction. Floating buttons (up to eight) use menu/feed/fish/sound/flower/critter icons, label, action, top-right/bottom-left anchor, offset 0-640 and size 24-64. callout contains title, lines (up to six), world-coordinate target, width 140-400, actions (up to three) and dismissAction; its upper-left connector tracks the target. keyboard contains title, value, maxLength 1-128, submitAction/cancelAction and optional changeAction, width 240-640, keyHeight 18-48, gap 1-12, textScale 1/2. It inherits the HUD theme, supports browser touch/click, physical-key highlights and standard controller navigation, and submits {name:text}. Input editing consumes game shortcuts. These widgets select shared JavaScript rendering; native pointer picking is not supplied. Floating HUD countdown accepts 0-3599 seconds; reticle true adds an aiming mark.
pause_uistring—Pause HUD state field; must exist.
restart_actionstring—Action invoked for restart; must exist.
click_to_startboolhost defaultWhether canvas clicks initiate play.
persistenceobject—key and state; key is 1–64 ASCII letters, digits, hyphens, or underscores. Source builds optionally accept interval_ticks (1–3600, default 1) and revision (explicit nonnegative-safe-integer state marker); see Batched game persistence.
presentationobject—title, subtitle, objective, victory, defeat, and up to five instruction strings.
perspectivestring66 degree default FOVNamed @Perspective.
title_scenestring—Optional cinematic title @Scene.
headingstringrequired for title sceneTitle scene headline.
subtitlestringemptyTitle scene subtitle.
promptstringPRESS ENTER TO BEGINTitle scene start prompt.
Example
@Scene/level
logic = game
map = dungeon
camera = player

Implementation: src/apps/pixel3d/mod.rs

@SideMap

@SideMap/<name>

Build side-view voxel terrain and scenery from a row-based map with side_level.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
legend.center_voxelintegeroptional1-based material ID for the two central Y tiles of an ordinary solid foreground entry. Requires a span of at least two tiles. A four-tile span retains its base material on each outside edge.
Example
legend = {"#": {"voxel": 1, "depth": [5, 4], "center_voxel": 2}}

Implementation: runtime/rune-web/src/pixel3d/sidemap.ts · examples/games/neon_circuit/levels/01_volt.rune

@Sound

@Sound/<name>

Define a synthesized sound effect.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
wavestringparser defaultsawtooth, square, triangle, sine, or noise.
freq_startnumber—Starting frequency in Hz.
freq_endnumber—Ending frequency in Hz.
durationnumberparser defaultSeconds.
attacknumber or duration0Time for a tone or noise sweep to rise from silence to full volume, expressed in seconds or with a unit such as 250ms.
volumenumberparser defaultGain from 0 to 1.
curvestringparser defaultlinear or exponential sweep.
filterobject—Filter type and start/end frequency.
notesarray[]Rotating pitch list.
sequencearray[]Frequency/duration note pairs.

Implementation: src/apps/rune_web/ast.rs

@Sprite

@Sprite/<name>

Compile an indexed pixel sprite or animation frame.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
palettestringrequiredNamed @Palette.
size[width,height]requiredPixel dimensions validated by the compiler.
pixelsseriesrequiredLiteral pixel rows matching the declared dimensions.
origin[x,y]asset dependentSprite origin, when supported by the asset compiler.

Implementation: src/apps/pixel3d/mod.rs

@Texture

@Texture/<name>

Compile an opaque indexed pixel texture.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
palettestringrequiredNamed @Palette.
size[width,height]requiredPixel dimensions validated by the compiler.
pixelsseriesrequiredLiteral rows; texture compilation also supports row/runs/pattern objects with repeat.
patternsobject{} for compact texturesReusable run patterns for compact texture rows.

Implementation: src/apps/pixel3d/mod.rs

@TV profile

@Scene tv = name; @TV/name

Declare Apple TV remote navigation, a HUD summary and up to two focus modes for a Pixel-3D scene.

Runtime: Experimental Apple TV native runtime; compiled and validated for every Pixel-3D scene

Returns / effects

A tv profile in the compiled scene configuration that drives focus rings, mode buttons and the summary strip.

Errors / edge cases

Unknown fields, unknown actions, unknown state paths, bad labels (1-24 ASCII characters), more than three summary items or two modes fail compilation.

Example
@Scene/aquarium
tv = aquarium

@TV/aquarium
initial_focus = toggle_menu
summary = [{"path":"progress.pearls","label":"PEARLS"}]
modes = [{"id":"friends","label":"FRIENDS","kind":"cycle","action":"inspect_resident","groups":["fish"],"targets":"residents"}]

Implementation: src/apps/pixel3d/tv.rs · runtime/rune-web/src/pixel3d/tv.ts · native/tvos/runtime/src/tv_input.js · tests/pixel3d_app.rs · examples/games/idle_aquarium/idle_aquarium.rune

ASCII canvas drawing objects

canvas = [{type: "text", x: 1, y: 1, text: "Hello", color: "cyan"}]

Draw text, lines, boxes, sprites, connected plots and optional Ascii3D viewports in terminal cells.

Runtime: ASCII Animator native CLI only

Returns / effects

Later objects overwrite earlier cells; sprites treat spaces as transparent. Off-canvas drawing is clipped.

Errors / edge cases

Unknown fields/types, control characters, non-ASCII text, invalid sizes and missing sprite names/frames fail. Maximum 1024 objects.

Example
canvas = [{"type": "plot", "x": 2, "y": 4, "width": 32, "height": 6, "values": [0, 25, 75, 50], "min": 0, "max": 100, "color": "green"}]

Implementation: src/apps/ascii_animator.rs · knowledge/runtime/ascii-animator.md

Batched game persistence

persistence = {"key":"my-game","state":"progress","interval_ticks":150,"revision":"save_revision"}

Opt-in tick-batched Pixel/Pixel-3D saves with an explicit dirty revision and immediate action/lifecycle flushes.

Runtime: Shared Pixel/Pixel-3D browser and native game hosts; source builds

Returns / effects

Version-1 save snapshots use the existing keys and browser/native storage; clean revisions can skip serialization entirely.

Errors / edge cases

Invalid interval_ticks, missing revision state and nonnegative-safe-integer violations fail explicitly.

Fields

FieldTypeDefaultMeaning
interval_ticksinteger 1-36001Running simulation ticks between scheduled flushes.
revisionstate field nameunsetExplicit dirty marker initialized to a nonnegative safe integer literal; unchanged revision/root skips serialization.
Example
@Scene/game
persistence = {"key":"my-game","state":"progress","interval_ticks":150,"revision":"save_revision"}
@Logic/game
state:
    progress = {"pearls":0}
    save_revision = 0
action reward(amount):
    progress.pearls += amount
    save_revision += 1

Implementation: src/apps/pixel/mod.rs · runtime/rune-web/src/pixel/persistence.ts · runtime/rune-web/src/pixel3d/engine.ts · knowledge/runtime/pixel3d.md · tests/game_save_schedule.rs · tests/browser/idle_aquarium_saving.py

Canvas drag action

canvas data-rune-pixel-3d=true data-pixel-drag-action=drag_orbit

Opt-in mouse and touch horizontal drag commands without replacing tap picking.

Runtime: Pixel-3D browser host

Returns / effects

Action receives signed degrees: 180 per canvas width dragged horizontally.

Errors / edge cases

Unknown drag action fails at mount time.

Example
canvas data-rune-pixel-3d=true data-pixel-drag-action=drag_orbit

Implementation: runtime/rune-web/src/pixel3d/index.ts · examples/games/idle_aquarium/logic.rune · tests/browser/idle_aquarium_rotation.py

Glowtide fish and feeding

Aquarium actions: buy_fish; feed

Eight fish species with persisted care and feeding priced per living resident.

Runtime: Glowtide Aquarium example, shared Pixel-3D logic

Returns / effects

Adoptions cycle through eight fish kinds. Feeding costs max(1, living fish + living critters) pearls and starts the existing snack shower.

Errors / edge cases

Insufficient pearls or an active cooldown shows a notice and does not charge or restart feeding.

Example
invoke feed

Implementation: examples/games/idle_aquarium/models.rune · examples/games/idle_aquarium/logic.rune · tests/browser/idle_aquarium_variety.py · knowledge/runtime/pixel3d.md

Glowtide purchasable upgrades and economy

Aquarium actions: open_fish_upgrades; buy_fish_upgrade kind; open_care_upgrades; buy_care_upgrade kind

Per-fish animated cosmetics, bounded tank care and half-rate income with a 100,000-pearl wallet cap.

Runtime: Glowtide Aquarium example, shared Pixel-3D logic

Returns / effects

Persists cosmetic ownership, selected pattern, food/longevity levels, base lifespans and fractional income.

Errors / edge cases

Unaffordable, invalid, already-owned or maximum-level purchases explain the failure and spend nothing. Dead fish cannot be upgraded.

Example
Tap fish -> UPGRADES -> Style Kit; menu -> Tank care upgrades

Implementation: examples/games/idle_aquarium/upgrades.rune · examples/games/idle_aquarium/logic.rune · examples/games/idle_aquarium/upgrades.logic.test.rune · tests/browser/idle_aquarium_upgrades.py · knowledge/runtime/pixel3d.md

host.advance

host.advance

Advance the current title/menu presentation.

Runtime: Pixel / Pixel 3D

Implementation: src/apps/game_controls.rs

host.fullscreen

host.fullscreen

Toggle fullscreen through the presentation host.

Runtime: Pixel / Pixel 3D

Implementation: src/apps/game_controls.rs

host.mute

host.mute

Toggle host audio mute.

Runtime: Pixel / Pixel 3D

Implementation: src/apps/game_controls.rs

host.pause

host.pause

Toggle the host pause state.

Runtime: Pixel / Pixel 3D

Implementation: src/apps/game_controls.rs

Logic AOT opt-out

aot = disabled

@Logic actions are compiled ahead of time to JavaScript by default; this setting keeps the interpreter.

Runtime: rune-web, pixel, pixel-3d and sprite2d hosts

Returns / effects

No value; ineligible actions always fall back to the interpreter.

Errors / edge cases

None.

Example
aot = disabled

Implementation: src/apps/rune_web/aot.rs · src/apps/rune_web/parser.rs · knowledge/runtime/sprite2d.md

model instance

model instance/<name>

Place a compiled model through a scene thing record.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
modelstring—Compiled model name.
x / y / znumbersinstance-dependentWorld position.
rotationnumber0Model rotation.
pitchnumber0Tilt around the model’s local Y axis in degrees, before horizontal angle. Supported by the shared JavaScript Pixel 3D renderer.
scalenumber1Model scale.
dissolvenumber0Deterministic fragment discard from 0 to 1; discarded pixels do not write depth.
animationstring—Compiled @Animation name to play on this thing (alternatively, model or sprite may directly name an @Animation).
anim_startnumber0Starting tick number for @Animation playback; set to the current tick when triggering a once clip.
anim_timenumber—Explicit non-negative playback time in seconds, overriding tick-based @Animation elapsed time.
anim_speednumber1Non-negative playback speed multiplier for tick-based @Animation playback.

Implementation: runtime/rune-web/src/pixel3d/model.ts

Optional GPU lighting

input type=checkbox data-pixel-gpu=true

Opt-in browser WebGL 2 lighting and bloom, with CPU geometry/picking and automatic CPU fallback.

Runtime: Pixel-3D browser hosts; source builds. Native desktop remains CPU.

Returns / effects

GPU-composited scene with crisp, unblurred pixel HUD and unchanged CPU picking/simulation.

Errors / edge cases

Unavailable accelerated WebGL, setup/frame failures, context loss or more than 32 eligible contact shadows disable the control with a CPU fallback explanation.

Example
label:
    input type=checkbox data-pixel-gpu=true
    span "GPU lighting"

Implementation: runtime/rune-web/src/pixel3d/gpu_lighting.ts · runtime/rune-web/src/pixel3d/index.ts · runtime/rune-web/src/pixel3d/raycaster.ts · knowledge/runtime/pixel3d.md · examples/games/idle_aquarium/shell.rune · tests/browser/pixel3d_gpu_lighting.py

Pixel-3D tick audio state

action tick(input, audio)

Read the current music track and playback state from the optional second tick argument.

Runtime: Pixel-3D browser, desktop and Apple TV

Returns / effects

audio.track is the active track name or null; audio.playing is true while the track is playing or paused.

Errors / edge cases

Browser autoplay does not start music before a user gesture.

Example
action tick(input, audio):
    if audio.playing:
        current_track = audio.track

Implementation: runtime/rune-web/src/pixel3d/engine.ts · runtime/rune-web/src/audio_sync.ts · examples/games/yule_log/logic.rune · tests/browser/yule_log.py

Sprite 2D app type

type = sprite2d

2D vector/PNG game engine with compact sprite syntax, @Atlas, @Animation and @Cutscene.

Runtime: Sprite-2D browser host

Returns / effects

A canvas game exported with vectrune <file> -o html.

Errors / edge cases

Invalid sprite, atlas or cutscene definitions fail vectrune check.

Example
type = sprite2d

Implementation: src/apps/sprite2d/mod.rs · runtime/rune-web/src/sprite2d/engine.ts · knowledge/runtime/sprite2d.md · examples/games/star_viper/star_viper.rune

voxel camera state

camera = <state path>

Animate voxel terrain and a side-on backdrop through a live camera record; finite render cameras may orbit outside the world.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
terrainPoseobjectoptionalRender this voxel world around an X-axis hinge. Set world, a local Y/Z pivot, a scene Y/Z position, and angle in degrees. Scene collision continues to use the scene world.
backdropobjectoptionalRender a background from a side-on camera looking toward negative Y. Set y, z, and things. The optional x pins the view horizontally. By default it follows the main camera’s X position.

Implementation: runtime/rune-web/src/pixel3d/voxel.ts · runtime/rune-web/src/pixel3d/raycaster.ts

voxel point light

lights = <state field>

Apply colored light to nearby visible scene and model surfaces.

Runtime: Pixel / Pixel 3D

Fields

FieldTypeDefaultMeaning
x / y / znumbersrequiredFinite world-space position.
colorstring or numberrequiredRGB color as #RRGGBB or an integer from 0 to 16777215.
radiusnumberrequiredReach in world units, greater than zero and at most 64.
intensitynumberrequiredLight strength from 0 to 1. Zero switches the light off.
Example
lights = [{"x": 4, "y": 9.5, "z": 3, "color": "#20e9ff", "radius": 5, "intensity": 0.8}]

Implementation: runtime/rune-web/src/pixel3d/lighting.ts · examples/games/neon_circuit/lighting.rune