Resonance Engine

The engine

The Resonance Engine runs games written in NAL. It's written in Rust and aimed at desktop first. The simulation also compiles to WebAssembly, which is how the editor shows a live preview, and an MCP server sits in front of it so an AI agent can drive a game the same way a player would.

How a game runs

A game is a folder of .nal files plus a small manifest. Whatever loads it (the player, the editor, the MCP server, the tests) resolves it the same way and runs it through the same GameSession. We learned to insist on that after a stretch early on when the editor and the native player each had their own copy of the game rules, and the two kept drifting apart. (That story is in the devlog.)

Status · October 2026

What works and what doesn't

We use three labels. Working means it runs in the native player today and has tests behind it. Experimental means it runs, but with known gaps, or it isn't what games use by default. Not yet means we want it but haven't built it.

WorkingExperimentalNot yet
AreaStatusDetails
NAL interpreterWorkingSystems and transforms, on_start, pause_exempt, functions (arity is checked, recursion stops at 64 frames), local variables, state machines with enter/exit/transition blocks, events (handled on the following frame), timers, scenes, for and while loops with break/continue, match, and World.all. Systems can run on an interval: instead of every frame. Code can read and write another entity's fields directly (target.Health.hp -= 30.0), and a typo in a component or field name is an error instead of quietly creating a new field. Entities can be put to sleep (Dormant) so distant parts of a big world cost nothing, and each entity can run at its own TimeScale. State machines can have rules that apply from any state, && and || short-circuit, Entity.has asks whether an entity has a component, and Entity.add/remove change which components it has at runtime.
Values & typesWorkingint, float, bool, string, entity_ref, vec2/vec3, enums, array[T] and map[string, T] (up to 256 items, copied when assigned), and record types, which can nest inside arrays and maps. Constants can be loaded from JSON data files with data("file.json"). Integer overflow is an error, and / always gives a float. World.get_field returns the field's real type.
Declarative UIWorkingNAL ui blocks for windows, rows, aligned grids, labels, buttons, sliders, images, line plots, progress bars, collapsible sections, modals, tooltips and hotkeys, with match allowed inside. They're re-evaluated every tick and drawn with egui. A marker widget pins labels and progress bars to an entity or point in the 3D world, and hides them when it's behind the camera or too far away. Disabled widgets ignore clicks. There are also UI.notify toasts, HiDPI support, layers and anchors, and Screen.width/Screen.height so games don't hardcode a resolution. ui blocks are re-evaluated up to 15 times a second by default (ui_rate) and straight away after any input, and toasts queue instead of being dropped.
3D renderingWorkingPrimitive shapes and glTF/GLB models (instanced, with embedded or external textures), directional shadows, simple sky lighting and fog, highlight and tint, emissive materials that glow, and translucent objects drawn in the right order. ItemStream draws items moving along a belt or cable without an entity per item. Entities outside the camera and shadow frustums are culled before drawing. If a model is missing you get a magenta cube and an error naming the file. Sun, sky, ambient light and fog are set from NAL through an Environment component.
AnimationWorkingglTF skeletal and node animation in the native player. NAL picks a clip, speed, looping and a crossfade on MeshRenderer, and Anim.* reads a clip's time and length, checks when it has finished or passed a moment, and restarts or seeks it. Playback is kept by the world, so it saves and loads and shows up in headless screenshots, and seeded runs stay the same. A stress scene with 60 animated characters and about 500 models dropped from 35.8 to 8.2 ms per frame after we stopped re-uploading geometry for every draw.
Camera & pickingWorkingCamera.screen_to_ground, Camera.world_to_screen, and World.pick for clicking on Pickable entities. Ember Colony's RTS camera and building placement use all three.
2D renderingWorkingSprites with layers and alpha, and UI panels and bars, in the native player.
Navigation & crowdsWorkingNav.* gives an occupancy grid with A* paths, and flow fields for many units heading to one target. A Body component pushes overlapping units apart and keeps them out of blocked cells. World.in_radius lists nearby entities, nearest first, and Nav.nearest_open finds the closest reachable point to a blocked goal.
Terrain & ground fieldsWorkingA heightmap ground: Terrain.height and slope, clicking on the terrain, Grounded to keep entities on it, and Nav.block_steep to keep units off cliffs. Field.* gives named grids over the ground that spread and decay, for things like noise or territory. The terrain is drawn as a lit, shadowed mesh, and Overlay.show drapes a field over it as a heat map, in both the player and headless screenshots. Segment stretches a box or an item stream between two ground points, and both systems save.
Item buffers & flowWorkingBuffer.* gives an entity typed slots and stores for items, and the Flow component moves items along belts in the engine instead of in NAL. Wyrmworks' stockpile, machine inputs and belts all run on it, with the same results as the NAL version they replaced.
PhysicsWorkingRapier2D runs inside NativeWorld::tick(), keeping rigid bodies and components in sync, and NAL can query collisions.
AudioWorkingSound effects and music, built-in synth sounds or .ogg/.wav/.mp3 files from the project. Music loops and crossfades, and effects take volume, pitch and pan. Master, music and effects volume are player settings. The native player plays them with rodio, the browser preview with WebAudio. Audio.play_sound_at plays a sound at a point in the world, with volume and pan worked out from the listener or camera.
Saves & settingsWorkingGame.save/Game.load write a full snapshot of the world at the end of a tick (timers, random state, pending spawns and events, UI state), so a loaded game carries on exactly as it would have. Session variables survive scene changes and go into saves. Player preferences live in a per-game settings.json, and Game.quit() exits cleanly.
Determinism & testingWorkingA seeded random number generator (set before on_start runs), a fixed entity order, scripted input and PNG frame capture in the player, and headless tests that play whole games. --record makes a repeatable gameplay video with sound, one fixed tick per frame. An opt-in profiler times every system, state machine and ui block. Recordings can start from a save and hide the UI.
PackagingWorkingresonance-package builds a macOS .app (with Developer ID signing and notarization), a Windows folder with a signed .exe, and a Linux folder. The macOS build is a proper app bundle with its own icon. Assets go in as a folder or a single compressed bundle, and projects can share asset packs ("@pack/path").
ToolingWorkingnal-validate reports parse and lint errors with line and column. It also checks names across the whole project: unknown components, fields, states and templates, functions called with the wrong number of arguments, names that don't resolve to anything in scope, and two files defining the same function. nal-lsp gives your editor diagnostics, hover, completion and go-to-definition.
MCP serverWorkingTools to validate, launch, step, read state and schema, playtest, search and apply patterns, add systems, change components and rebalance values. A few are still pretty basic (see below).
Bytecode VMExperimentalFrozen as a test backend. It runs the same games with identical state every frame, but on Wyrmworks it was slower than the interpreter (307 vs 231 µs a frame for the systems it could run), so we stopped extending it. The parity tests still run, and speed work now goes into the interpreter and engine builtins. Why we froze it.
Hot reloadExperimentalWatches .nal files and reloads the running game when they change. Keeping game state across a reload doesn't always work yet.
Harmonic IDE previewExperimentalRuns the real GameSession in the browser through WebAssembly, drawing 2D with Canvas2D and 3D shapes with Three.js. It can't show glTF models or ui blocks yet.
Headless MCP rendererExperimentalScreenshots 2D and 3D scenes from multi-file projects without a window or GPU, using a CPU renderer that follows the native player's lighting. Animated models are drawn in their current pose. It can't draw ui blocks yet.
Rezzy playtestsExperimentalSee Rezzy below.
Language extrasNot yetString interpolation and vec4/quat. World.line_of_sight is currently rejected with an error, because the old version always returned false.
3D physics & local lightsNot yetRapier physics is 2D only. 3D games can keep units apart with Body, but there are no 3D collisions yet. The 3D renderer has a sun and ambient light but no point or spot lights.
More platformsNot yetiOS and Android, web releases, Steam.
Working with agents

How an agent uses it

An agent working on a Resonance game goes through a loop over MCP. It writes some NAL and validates it, then starts the game and steps it forward with whatever inputs it wants. After that it can read back every entity and component and decide what to change next.

The MCP server runs the same GameSession as the native player, and runs are seeded, so whatever the agent saw, you can reproduce. That matters most when it reports a bug.

Two caveats for now: game_create_from_template fills in a template rather than designing anything new, and headless screenshots don't show ui blocks yet.

an agent's validate → run loop (MCP)JSON
// 1. Check the source before running anything
{ "name": "game_validate",
  "arguments": { "source": "<NAL>", "format": "nal_v2" } }

// 2. Start a session from a file (returns a session_id)
{ "name": "game_launch",
  "arguments": { "anl_path": "docs/language/examples/twin_stick_shooter.nal" } }

// 3. Advance 300 frames, holding "right" from frame 0
{ "name": "game_step",
  "arguments": { "session_id": "s1", "frames": 300,
    "inputs": [{ "frame": 0, "key": "right", "action": "press" }] } }

// 4. Read back every entity and component
{ "name": "game_state", "arguments": { "session_id": "s1" } }

// 5. Tune a default and try again
{ "name": "game_rebalance_values",
  "arguments": { "source": "<NAL>",
    "changes": [{ "component": "Player", "field": "speed", "value": 280.0 }] } }
Rezzy

Rezzy, the playtester

rezzy playtest plays a NAL game through GameSession at 60 Hz and records what happened. If you want, it then hands the run to a local LLM (Gemma through ollama by default, so it works offline) for a structured review. Add --suggest and it proposes actual NAL changes.

All of that works end to end. The part still missing is a good player. Right now Rezzy presses random inputs. Our NEAT and PPO code in resonance-agent has learned purpose-built platformer levels through curriculum training, but it can't yet pick up an arbitrary NAL game and play it. That's the next big piece of work for Rezzy.

terminalshell
# ML-only run: play for 60 seconds and report metrics
rezzy playtest path/to/game.nal --duration 60 --ml-only

# Add a local-LLM critique and suggested NAL changes
rezzy playtest path/to/game.nal --duration 60 --suggest

# Design analysis only, no gameplay
rezzy analyze path/to/game.nal --provider ollama --model gemma4
Under the hood

What it's built on

Rust

About 137k lines in 20-odd workspace crates covering the core, ECS, NAL, native runtime, physics, VM, MCP, LSP, packaging and more.

miniquad + egui

miniquad handles graphics in the native player (OpenGL or Metal). egui draws all the on-screen UI and text.

Rapier · gltf · rodio

Physics, model loading and sound, each wired into the simulation through the same typed interface NAL uses.

wasm-bindgen + Three.js

These put the simulation in the browser for the Harmonic IDE preview, which is a React and Tauri app.

There's also an older wgpu renderer and player in the workspace. Shipped games use the miniquad player.