MIMEcroft.sh

a first-person 3D maze treasure hunt rendered over WebGL — written entirely in bash

▶ Play MIMEcroft.sh in the browser shell

opens the shell at www/index.html and auto-starts the game via the allow-listed ?demo=MIMEcroft.sh parameter (see SECURITY.md) — the game boots as the MIMEcroft command (the script is bin/MIMEcroft.sh). You can also just open the shell and type MIMEcroft.sh (or mimecroft.sh).

What it is

You are the shell command Mime Croft on the hunt for hidden treasures inside an ancient yet sacred filesystem on Phobos. The maze around you is made of data blocks — coloured chunks of file content. Somewhere in the depths lie hidden treasures: the Great Operating Systems (GNU Hurd, Linux, FreeBSD, NetBSD, OpenBSD, Plan 9, Minix, Solaris, macOS Darwin, Unix) preserved as artifacts. But the filesystem is infested with evil MIMEs — misbehaving content types (image/jpeg, image/png, application/octet-stream, text/plain) that hunt you through the corridors.

Your gun fires a single ray of pure type-checking. Shooting a block mines through the data; shooting a MIME sanitises it. Walk into a hidden treasure to recover it — shooting one shatters the artifact and costs you an archaeology-licence strike (three strikes and the Board revokes it).

WASD move  ·  ←/→ turn  ·  SPACE shoot  ·  Q quit  ·  ESC settings

The settings menu tweaks the camera shift, texture size/seed, CRT & corruption effects, the minimap, mime speed and the sound mode (notes oscillators or bash — sample-accurate generators).

Why it's interesting

The implementation — the .sh files

bin/MIMEcroft.sh ~3,900 lines
The game itself — the MIMEcroft command (the lowercase bin/mimecroft.sh alias still works). One script does everything:
The vertex shader authored in bash. Object→world transform, the camera-relative delta, the yaw rotation (cos/sin via bc), and the fake perspective (gl_Position = (rel×0.45, w²/64, w)). Compiled at startup by sh2glsl --vertex into GLSL ES 1.00; the compiled reference is examples/mimecroft-vertex.glsl.
The fragment shader authored in bash: per-pixel block-texture tint, the crack-overlay blend on damaged blocks, and the optional CRT scanlines / corruption streaks / vignette. Every intermediate is bounded to fit precision mediump int. Compiled by sh2glsl; the compiled reference is examples/mimecroft-frag.glsl.
examples/textures/ 17 generators
Pseudorandom, seamlessly tileable block textures, generated by bash (seeded LCG + value noise, no floats, no $RANDOM), deterministic per seed. README. The core texture-lib.sh is inlined into each generator so they run identically under host bash, the real-bash wasm, and the transpiled shell:
examples/sounds/ 12 synthesizers
Every game sound as a list of signed 16-bit PCM samples at 22050 Hz, synthesised in bash (sine-table waveforms, envelopes, seeded noise) and played through /dev/audio/samples in the game's bash sound mode. README:

How it runs

The page's bash→JS transpiler turns MIMEcroft.sh into JavaScript against the sh2 runtime; the /dev/webgl device (src/fs/webgldev.js) provides the WebGL context as files (shader/, buffer/, uniform/, call, blocks), and /dev/audio plays the notes or sample lists. The same script runs headless in the Node CLI (a null WebGL device), which is how the game is regression-tested.

MIMEcroft lives in the j.cmd repo — the game, its shaders, textures and sounds, all written in bash.