
Lately I’ve seen people using coding models to recreate games, including a Call of Duty–style shooter and a multiplayer version of Minecraft embedded in an X post. Those projects inspired me to revisit Chip’s Challenge, a Windows game I played when I was a child.
The player guides Chip through a maze one square at a time. In a typical level, an empty chip socket blocks the way to the exit. Chip can open it only after collecting enough microchips.
I wanted to play all 149 puzzles in a browser, with arrow keys on a computer or touch controls on a phone. I called the port Patch Bay (a patch bay is a panel for routing signals, and over half the puzzles have water in them).
Keeping Tile World’s Windows engine
The Windows game stores the starting layout of each puzzle in CHIPS.DAT. My first plan was to write a TypeScript engine that would read that file, then advance the board in steps called ticks. The timing matters even while Chip stands still. Without any input, a ball can roll onto a switch and open a wall across the room. Moving the ball one tick late could leave the wall closed when Chip reaches it.
I found an open-source recreation of Chip’s Challenge called Tile World 2. Its Windows engine already handled that timing in C, down to whether a switch takes effect before Chip moves. I decided to drop the TypeScript rewrite. I could compile the C code to WebAssembly, a binary format the browser can run alongside JavaScript. That left me free to work on the controls, sound, and artwork.
Explore the individual Windows rules
Calling the C engine from TypeScript
I wrote a small C adapter so the browser could start a level, advance the simulation one tick, and inspect a square on the board. My build script uses Clang to compile that adapter along with Tile World’s rules, level decoder, and random number generator. The resulting module, ms-engine.wasm, is under 38 KB.

In the browser, Patch Bay downloads the module and instantiates it.
const { instance } = await WebAssembly.instantiate(
await response.arrayBuffer()
);
Patch Bay uses instance.exports as its engine object. That gives JavaScript the adapter’s functions and access to the module’s memory.
The original puzzles arrive separately. On a first visit, Patch Bay fetches CHIPS.DAT from GitHub, checks its hash, and saves a copy in local storage when available. On return visits it checks the saved copy’s hash again before using it. To start a level, JavaScript copies that level’s record into the module’s memory and calls start.
The arrow keys and the phone’s D-pad feed the same TypeScript game loop. A tap on the D-pad requests one step, and holding an arrow repeats it. Each tick, the loop passes a direction to request a move or zero for no input.
const outcome = this.engine.step(command);
The C adapter advances Tile World’s simulation either way. The return value is zero while play continues, positive for a win, and negative for a loss. The board stays in the module’s memory. To draw a square, the browser reads its upper and lower tile IDs from the adapter. A ball can occupy the upper layer while a switch sits underneath.
I used recorded solutions from other players to check that the new controls delivered moves on time. I replayed each solution twice with its original random seed and starting phase for creature movement, once through the keyboard controls and once through an emulated touch D-pad. All 149 levels cleared on the same tick as their recordings with both controls.
Playing Tile World’s sound cues in the browser
Tile World already signaled events such as collecting a microchip or opening a door. Each event set a bit in a sound-effects field. After a tick, Patch Bay reads those bits and synthesizes the corresponding sounds with Web Audio.
A green switch could open a wall without setting a sound flag. I wanted to hear the click even when a creature pressed it, so I added a cue inside Tile World’s togglewalls(), where the walls change on the board.
addsoundeffect(SND_WALL_TOGGLE);
The same call covers Chip, a block, or a creature pressing the switch. The patch also adds a cue for stepping onto a hint tile and sets existing flags for actions such as pushing a block. When a block lands on a green switch, both the shove and the click can sound on the same tick.
Drawing Patch Bay as an electronics workbench
The original game had already turned computer hardware into puzzle pieces. I asked Codex for mockups of a few visual themes and picked the electronics workbench to keep that character. Patch Bay has an ivory case around a dark green display, like a piece of bench equipment.
Each tile ID from the engine maps to a drawing on one custom sprite sheet. The renderer makes and caches alternate poses from those drawings. To depress a switch, it lowers the cap and leaves the base in place. It draws that pose for as long as a piece covers the switch.
In the clip from Chiller, level 110, Chip stays on his starting square. Two rows below him, a pink ball rolls onto the green switch. With the sound on, the click marks the instant the wall at the lower left opens.
Get new posts by email
Follow.it sends the emails and includes an unsubscribe link.
