The workflow we give agents for writing NAL is simple: write the game, run nal-validate, fix whatever it reports, and repeat until it says ok. That only works if ok means something. On 25 October we found out how little it meant.
The Hollowlight test
We asked an agent to build a game from a prompt: Hollowlight, a 3D action game of about 1,000 lines. Then we planted seven of the mistakes people and agents make all the time, and ran the validator. It passed all seven.
| Planted bug | What happened at runtime |
|---|---|
| Spawning a template that doesn't exist | A script error at spawn time |
| Calling a function with the wrong number of arguments | A script error when the call runs |
Writing to a misspelled field, Health.curent = … | Nothing visible. It created a new field called curent. |
World.get_field(id, "Helth", "current") | Nothing visible. It returned 0.0. |
| A state machine transition to a state that doesn't exist | Nothing visible. The entity got stuck in a state with no body and never ran again. |
A system reading a component that isn't in its query: | Nothing visible. It worked whenever the entity happened to have that component. |
Input.action("dash") with no dash binding | Nothing visible. The action never fired. |
The first two at least failed loudly once the game ran. The other five did nothing you could see. For a person that means a long debugging session. For an agent it's worse: the validator says ok and there's no error message to work from. This is the same kind of bug as the ones in Bugs that return zero, and the same rule applies: if NAL accepts something, it has to work or be rejected.
Checking names across the whole project
The validator used to parse each file and run style and structure checks. It almost never looked a name up. Now there's a semantic pass that runs over the whole project after imports are resolved, with a new diagnostic for each case:
- V140: a
Component.fieldthe component doesn't have - V141: an unknown component, field or tag passed as a string to
World.get_field,set_field,find_nearest,in_radius,find_withorall - V142: a transition or default to a state that doesn't exist
- V143: spawning a template that doesn't exist
- V144: calling a function with the wrong number of arguments
- V145 (a warning, since raw key names are allowed): an input action that isn't in the
input_mapand isn't a key - V146: an unknown parent, or a cycle, in component inheritance
Here's a small file with six of the bugs planted in it:
component Health { current: float = 100.0; max: float = 100.0; }
component Enemy { speed: float = 2.0; }
// ...
system Combat {
query: [Health, Enemy];
priority: 0;
transform {
Health.curent -= damage(5.0, 1.0);
let hp = World.get_field(Entity.id(), "Helth", "current");
if (Input.action("dash")) { Entity.spawn_at("Ipm", 0.0, 0.0); }
}
}$ cargo run --bin nal-validate -- planted.nal
error[V142]: planted.nal:17:26: state_machine `Brain` state `Idle`: `-> Chasng` is not a state (states: Chasing, Idle)
error[V140]: planted.nal:24:5: component `Health` has no field `curent` (fields: current, max)
error[V144]: planted.nal:24:5: fn `damage` takes 1 argument(s), called with 2
error[V141]: planted.nal:24:5: World.get_field: unknown component "Helth"
warning[V145]: planted.nal:24:5: Input.action("dash"): not in config input_map and not a raw key name — it will never fire
error[V143]: planted.nal:24:5: Entity.spawn_at: unknown template "Ipm" (imported templates must be `pub`)
FAIL: planted.nal — 5 error(s), 1 warning(s)With those six names fixed, the same file validates cleanly.
One detail took some care. Checks like "this template exists" only make sense for a whole game. A library module validated on its own can spawn a template that's defined in the file that imports it. So the whole-program checks only run on complete scenes, meaning files with a config block. Every planted case is now a test fixture. When we ran the new checks over every .nal file in the repository, they found no new errors and one warning, and that warning was a real unbound action in a test file.
And at runtime
Validation can't catch everything, because some names are only known when the game runs. So we also tightened the runtime:
- Writing a field a component doesn't declare is now an
UnknownFielderror. Typos no longer create fields. - A transition to an unknown state is ignored and recorded as a script error, so the entity stays where it was instead of freezing.
- Component
extendshad been documented, but the runtime ignored it. Now the inherited fields and their defaults actually apply.
The query: question needed a decision rather than a fix. Our own agent guide said a system could only touch the components in its query, but the runtime never enforced that. We decided the query picks which entities a system runs on and doesn't limit what it can read, wrote that into the spec, and corrected the guide. A warning for reads outside the query is still on the list.
More of the same family
Hollowlight wasn't the only source. The same week we started prototyping Wyrmworks, a design for a bigger game after Ember Colony, and the VM parity work kept running. Between them they turned up more quiet failures:
- Enums didn't exist at runtime. Enum fields passed validation, but every variant read as the same default, so
Phase.A == Phase.Bwastrue. Field defaults that weren't plain literals, including the spec's ownvec2(0.0, 0.0)example, were silently dropped. - The wrong error message. A typo in a
.nalfile made the session fall back to the old JSON loader, so you got "JSON parse error: expected value at line 2 column 1". Now you get the NAL error. - Clicks on the wrong button. Widgets inside an
ifin auiblock could share an ID with a neighbour, so clicking one could run the other's action. - Keys that never matched. A key sent to a session as
KeyFsilently did nothing, and Shift bindings didn't match between the native player and theinput_map. There's now one key-name normalizer for every input path. - Events that changed between runs. The legacy single-value event data picked an arbitrary field from a hash map, so events with several fields gave different data from run to run. It now takes the first declared field.
All of those are fixed, with tests. Hollowlight also found things that are still open: launching the player with a bare relative path, Input.pressed reporting held state for scripted named actions, MCP playtest heuristics that assume a platformer, and the lack of 3D physics and point lights.
Planting bugs on purpose turned out to be a useful test. A game with known mistakes in it shows what the validator actually catches, which a clean game can't.