Mooncraft: A Lunar Trucking Sim Built in Plain JavaScript
🎮 Play Mooncraft (browser, free) · GitHub · Ko-Fi
Mooncraft is a lunar trucking simulator that runs entirely in your browser. No frameworks, no dependencies, no build step. A handful of JavaScript files, a canvas element, and you are driving cargo between bases on the moon.
It is made by an indie developer going by engineersneedart and it is completely free. The GitHub repo has 168 stars and the README opens with something refreshingly honest: “I’m also learning Javascript.”
What You Do
You pilot a cargo truck across the lunar surface. Pick up payloads from one base and deliver them to another. Fuel is apportioned for each trip. Points accumulate. You start as an Apprentice (Level 0) hauling half-ton cargo between nearby bases. At Journeyman (Level 4) you can select larger loads. Master is the final rank, if you persist.
Long cargo runs — 2000+ distance — count for double cargo. Distances over 3000 earn triple. Crash and you are heavily penalized. Run out of fuel and you get rescued, but it costs you.
The Voxel Engine
The rendering is a classic ray-casting algorithm from the 1990s — what the developer calls “a poor man’s ray-tracer.” It works column by column across the screen, marching a ray through the terrain until it hits a voxel, then painting that pixel and moving up.
The moon data comes from NASA’s CGI Moon Kit at 64 pixels-per-degree. Each voxel works out to about half a kilometer. Those little bases you land on that look like a few pixels across? They are roughly two miles wide. The developer ran the elevation data through Blender to render shadows — a process that took 12 hours on his laptop.
He also exaggerated the vertical scale because he liked the dramatic craters better. A friend who is an amateur astronomer suggested dialing it back to be more realistic. He tried it, decided he preferred his version, and rolled it back up.
The Cockpit
The instrument panel is the best part. At the top, an inertial compass marked with N, S, E, W and intermediate bearings — and the game expects you to estimate unmarked headings like north-by-northwest. Lower left, a CRT map displays lunar features with base locations overlaid. Center, a downward-facing radar scope paired with a landing camera. Nixie tube displays on either side show vertical velocity, altitude, fuel, and forward speed. “Idiot lights” warn you when you are coming down too fast, running low on fuel, or about to hit something.
Lower right, an 8-bit monitor shows messages from bases. The whole thing looks like someone built a lunar module cockpit from scratch because they wanted to sit in it.
The Developer’s Honesty
The README is worth reading on its own. He documents performance as his “sorest regret” — the game runs worse on Chrome than Safari and he cannot figure out why. He tried Web Workers for parallel ray casting but could not share the tile cache across threads. He suspects WebAssembly would fix it but admits it is beyond his current abilities.
He has a whole section on what he would do next: 128ppd tile data (doubles resolution), a lunar economy sim inspired by Elite where bases near the poles mine water ice and equatorial bases harvest solar energy, dust particles that billow on touchdown, and multi-player over WebSockets. Then he ends with: “Good enough for 1.0.”
What Makes It Interesting
A lot of browser games are wrappers around engines. Mooncraft is the opposite. Someone sat down and wrote voxel rendering by hand, built a compass from scratch, wired up nixie tube numerals, and learned Blender to render lunar shadows because the NASA data did not include them. Then they put the whole thing online for free with a Ko-Fi link and no ads.
It is the kind of project that reminds you the web is still a creative medium.
I played through the first few Apprentice runs. The controls take a minute — lunar gravity is not forgiving and the truck drifts if you do not counter-thrust. But once you get the feel for it, there is a quiet satisfaction in navigating between bases by compass bearing, watching the radar close in on your destination. The craters look good, and the nixie tubes glow.
Crepi il lupo! 🐺