Skip to content
Preponderous-SoftwarePublic

About

A first-person game about how compilers work: sort, build, cast and trim tape for the Engine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Tapeworks

A small first-person game about how compilers work, for players who have never studied them. You are on the night shift at the Tapeworks, where orders written for people are turned into punched tape for the Engine, a machine that only understands tiny steps like PUSH 3 and ADD. Tonight every room that makes the tape is broken. Each room is one stage of a compiler, and each is a puzzle you solve by doing that stage's job by hand.

The Engine Hall: the Order board above the Engine

Status: first build (local prototype). The Engine Hall and four rooms:

  • Room 1, the Sorting Floor (lexing). An order lies on the bench as one long piece of letters. Drop cutters between letters until every piece is a token: a name, a number or a sign. When two readings both work, the longest token wins (>= stays whole, so does area2).

    The Sorting Floor, solved: cutters between the tokens, the board listing them

  • Room 2, the Rigging Loft (parsing). The tokens hang along the bottom of a tall board. Hoist the signs in the order the maths really works, and each sign lifts the two things it combines. The wrong order builds a tree with the wrong value (2 + 3 * 4 comes out as 20, not 14).

    The Rigging Loft: a wrong tree, worth 20 instead of 14

  • Room 3, the Casting Bay (code generation). Punch a tape on the desk from a finished tree, then run it. The Engine's stack piles up as crates beside the desk; it must end with exactly one number on it, the tree's value.

    The Casting Bay: the tape runs and the stack holds 14

  • Room 4, the Trimming Shop (optimisation). A tape punched straight from a tree lies on the bench as cards. Fold fixed numbers together and remove steps that change nothing, down to a target length. A test bench runs the old and new tapes for several values of x to show nothing changed.

    The Trimming Shop: 5 lines down to 3, the test bench all ticks

  • The Engine runs. With all four rooms working, the Order board shows each stage's work on tonight's order, x * (2 + 3) + 0. Pull the lever beside the Engine and it runs the whole line.

Each room has a plaque that says what to do, and each solve ends with a card: what just happened, and why it matters. Phones work: there's a stick to walk, you drag to look, and a Use button.

Next rooms (not built): the Inspector (type checking: catching an order that adds a word to a number) and the Register Room (register allocation: four hands, too many crates).

A 2D concept of the same puzzles, used to test whether they teach, is in concept/index.html.

Play

python3 tools/serve.py . 8798      # then open http://127.0.0.1:8798/

On Windows, tools\play-tapeworks.bat copies the game out of WSL and opens it in its own window.

Controls: W A S D to walk, mouse to look, E or click to use. At the punch desk, 1–9 press its keys from left to right. On a phone: stick, drag, Use.

Code

Plain ES modules, no build step. The engine is Tangle's (engine/: Strata 0.7.0's web kit plus Tangle's host.cpp), used unchanged; walking, geometry and audio are Tangle's and Inkling's too.

  • src/lang.js: the little language and its compiler (lexer, parser, code generator, the Engine's stack machine, the optimiser), the orders each room uses, and each room's rules.
  • src/world.js: the hall and rooms, furniture, collision and lights.
  • src/text.js: plaques and boards drawn to canvas textures, including the trees.
  • src/game.js: the game: aiming, the rooms, the Order board, captions, cards, input.

npm test runs the compiler, puzzle and walking tests. node tools/shots.cjs [url] [outdir] [--phone] plays every room headless, saves screenshots, and fails on a page error or a room that doesn't solve (needs Playwright).

Code: MIT.

About

A first-person game about how compilers work: sort, build, cast and trim tape for the Engine

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages