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
| Field | Type | Default | Meaning |
|---|---|---|---|
fps | number | 8 | Playback frame rate in (0, 60]. |
mode | string | "loop" | Pixel-3D playback mode: loop, pingpong, or once. |
interpolate | boolean | false | Smoothly tween keyframe transforms (x, y, z, angle, pitch, scale, dissolve) between adjacent frames. |
frames | list | series | required | 1-128 frame entries: @Model/@Sprite name strings or keyframe objects with model/sprite plus optional label, x, y, z, angle, pitch, scale, and dissolve. |
@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
| Field | Type | Default | Meaning |
|---|---|---|---|
duration | number | required | Track duration in seconds. |
loop | bool | true | Whether to repeat the track. |
points | array | required | 2–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
| Field | Type | Default | Meaning |
|---|---|---|---|
extends | string | — | Parent profile name; inheritance is validated for cycles and depth. |
keys | mapping | {} | Keyboard code -> action input. |
commands | mapping | {} | Keyboard code -> host command. |
mouse | mapping | {} | Pointer button/axis -> action input. |
gamepad | mapping | {} | Button/axis -> input or host command; optional scale, invert, deadzone, mode. |
touch | object | — | Joystick, look surface, and buttons. Touch objects may bind visibility to boolean state paths. |
@Controls/game
keys:
Space -> fire
commands:
KeyP -> host.pauseImplementation: 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
| Field | Type | Default | Meaning |
|---|---|---|---|
grid | list/series | required | Tile rows. |
legend | object | required | Character-to-tile definitions. |
floor | color/texture | compiler default | Opaque #RRGGBB or compiled texture name. |
ceiling | color/texture | compiler default | Opaque #RRGGBB or texture; mutually exclusive with sky. |
ceiling_height | number | 1 | Greater than 0.5 and no more than 16; visual elevation. |
sky | object | — | Seeded sky panorama; optional cloud_wave and cloud_glow range from 0 to 1. |
spawn | object | — | 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
| Field | Type | Default | Meaning |
|---|---|---|---|
palette | string | required | Named @Palette. |
unit | number | 0.125 | Model coordinate unit scale. |
emissive | string | — | 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_shadow | number | — | Contact shadow radius in world tiles, up to four. Enhanced lighting projects it onto supporting voxel terrain or glass. |
blocks | series | optional when shapes are present | Palette-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. |
shapes | series | optional when blocks are present | Sphere: 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
| Field | Type | Default | Meaning |
|---|---|---|---|
type | string | parser default | Music chip/style. |
tempo | number | parser default | Beats per minute. |
time_signature | string | — | For example 4/4. |
bars | number | — | Number of measures. |
loop | bool | parser default | Loop the track. |
volume | number | parser default | Master gain. |
lead / bass / drums | note strings | — | Built-in tracks; custom named tracks are also supported. |
sections | object | — | 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. |
arrangement | array | — | 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. |
instruments | object | channel defaults | Channel-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. |
effects | object | — | 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_effects | object | — | 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
| Field | Type | Default | Meaning |
|---|---|---|---|
colors | object | required | 1–256 entries mapping single ASCII characters to #RRGGBB or transparent. |
@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
| Field | Type | Default | Meaning |
|---|---|---|---|
fov | number | required | Finite 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
| Field | Type | Default | Meaning |
|---|---|---|---|
logic | string | required | Named @Logic; Pixel 3D requires start and tick actions. |
map | string | required | Initial @Map name. |
camera | string | player | Camera state field or a declared cinematic camera. |
things | list 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. |
tethers | list 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. |
weapon | string | null | Weapon state binding. |
hud | object | null | State-field bindings for legacy HUD values. |
controls | string | — | Named @Controls profile. |
mouse_look | bool | true | Enable mouse-look input. |
keys | object | WASD / arrows / Space / E | Keyboard mapping when no custom mapping is supplied. |
world | string | — | Voxel world state field; must exist. |
lights | string | — | 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. |
ui | string | — | 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_ui | string | — | Pause HUD state field; must exist. |
restart_action | string | — | Action invoked for restart; must exist. |
click_to_start | bool | host default | Whether canvas clicks initiate play. |
persistence | object | — | 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. |
presentation | object | — | title, subtitle, objective, victory, defeat, and up to five instruction strings. |
perspective | string | 66 degree default FOV | Named @Perspective. |
title_scene | string | — | Optional cinematic title @Scene. |
heading | string | required for title scene | Title scene headline. |
subtitle | string | empty | Title scene subtitle. |
prompt | string | PRESS ENTER TO BEGIN | Title scene start prompt. |
@Scene/level
logic = game
map = dungeon
camera = playerImplementation: 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
| Field | Type | Default | Meaning |
|---|---|---|---|
legend.center_voxel | integer | optional | 1-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. |
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
| Field | Type | Default | Meaning |
|---|---|---|---|
wave | string | parser default | sawtooth, square, triangle, sine, or noise. |
freq_start | number | — | Starting frequency in Hz. |
freq_end | number | — | Ending frequency in Hz. |
duration | number | parser default | Seconds. |
attack | number or duration | 0 | Time for a tone or noise sweep to rise from silence to full volume, expressed in seconds or with a unit such as 250ms. |
volume | number | parser default | Gain from 0 to 1. |
curve | string | parser default | linear or exponential sweep. |
filter | object | — | Filter type and start/end frequency. |
notes | array | [] | Rotating pitch list. |
sequence | array | [] | 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
| Field | Type | Default | Meaning |
|---|---|---|---|
palette | string | required | Named @Palette. |
size | [width,height] | required | Pixel dimensions validated by the compiler. |
pixels | series | required | Literal pixel rows matching the declared dimensions. |
origin | [x,y] | asset dependent | Sprite 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
| Field | Type | Default | Meaning |
|---|---|---|---|
palette | string | required | Named @Palette. |
size | [width,height] | required | Pixel dimensions validated by the compiler. |
pixels | series | required | Literal rows; texture compilation also supports row/runs/pattern objects with repeat. |
patterns | object | {} for compact textures | Reusable run patterns for compact texture rows. |
Implementation: src/apps/pixel3d/mod.rs
@TV profile¶
@Scene tv = name; @TV/nameDeclare 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.
@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.
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
| Field | Type | Default | Meaning |
|---|---|---|---|
interval_ticks | integer 1-3600 | 1 | Running simulation ticks between scheduled flushes. |
revision | state field name | unset | Explicit dirty marker initialized to a nonnegative safe integer literal; unchanged revision/root skips serialization. |
@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 += 1Implementation: 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_orbitOpt-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.
canvas data-rune-pixel-3d=true data-pixel-drag-action=drag_orbitImplementation: 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; feedEight 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.
invoke feedImplementation: 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 kindPer-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.
Tap fish -> UPGRADES -> Style Kit; menu -> Tank care upgradesImplementation: 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.advanceAdvance the current title/menu presentation.
Runtime: Pixel / Pixel 3D
Implementation: src/apps/game_controls.rs
host.fullscreen¶
host.fullscreenToggle fullscreen through the presentation host.
Runtime: Pixel / Pixel 3D
Implementation: src/apps/game_controls.rs
host.mute¶
host.muteToggle host audio mute.
Runtime: Pixel / Pixel 3D
Implementation: src/apps/game_controls.rs
host.pause¶
host.pauseToggle 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.
aot = disabledImplementation: 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
| Field | Type | Default | Meaning |
|---|---|---|---|
model | string | — | Compiled model name. |
x / y / z | numbers | instance-dependent | World position. |
rotation | number | 0 | Model rotation. |
pitch | number | 0 | Tilt around the model’s local Y axis in degrees, before horizontal angle. Supported by the shared JavaScript Pixel 3D renderer. |
scale | number | 1 | Model scale. |
dissolve | number | 0 | Deterministic fragment discard from 0 to 1; discarded pixels do not write depth. |
animation | string | — | Compiled @Animation name to play on this thing (alternatively, model or sprite may directly name an @Animation). |
anim_start | number | 0 | Starting tick number for @Animation playback; set to the current tick when triggering a once clip. |
anim_time | number | — | Explicit non-negative playback time in seconds, overriding tick-based @Animation elapsed time. |
anim_speed | number | 1 | Non-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=trueOpt-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.
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.
action tick(input, audio):
if audio.playing:
current_track = audio.trackImplementation: 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 = sprite2d2D 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.
type = sprite2dImplementation: 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
| Field | Type | Default | Meaning |
|---|---|---|---|
terrainPose | object | optional | Render 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. |
backdrop | object | optional | Render 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
| Field | Type | Default | Meaning |
|---|---|---|---|
x / y / z | numbers | required | Finite world-space position. |
color | string or number | required | RGB color as #RRGGBB or an integer from 0 to 16777215. |
radius | number | required | Reach in world units, greater than zero and at most 64. |
intensity | number | required | Light strength from 0 to 1. Zero switches the light off. |
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