Motherload came out in 2004 and I still think about it. You pilot a little drill rig into the earth, fill your cargo hold with ore, fly back to the surface, sell it, buy better equipment, and go deeper. That is the whole game. It is perfect.
This is my version, running right here. Same loop, my own world, no install.
The layers
The world is 40 tiles wide and 200 tiles deep, divided into eight depth bands. Each layer has its own palette, its own ore distribution, and a couple have nasty surprises waiting for you.
| Layer | Depth | Notes |
|---|---|---|
| Topsoil | 0–15m | Loose dirt and roots. Coal and copper. |
| Bedrock | 15–35m | Bauxite, iron, the first silver. |
| Permafrost | 35–55m | Frozen solid. Requires the Heated Drill upgrade or you cannot break a single tile. Methane ice deposits hide here. |
| Fossil layer | 55–80m | Ancient sediment. Amber with insects, trilobite fossils. |
| Deep crust | 80–110m | Cinnabar, gold, and the first uranium veins. |
| Magma veins | 110–145m | Glowing red rock. Without a Heat Shield, your hull drains continuously while you are inside. |
| Crystal caves | 145–180m | Tanzanite, more diamonds. The walls glitter. |
| Mantle edge | 180–200m | Painite and unobtanium. Even worse heat than the magma layer. Endgame only. |
What is down there
Eighteen things to mine, give or take. Some are real, some are deliberately not. Where the real ones are concerned I played a little fast and loose with relative values, but the general ordering (copper before silver before gold before tanzanite before painite) is roughly how the world works.
| Ore | Value | Found in | Notes |
|---|---|---|---|
| Coal | $5 | Topsoil → bedrock | Cheap and common. |
| Copper | $12 | Topsoil → bedrock | Starter cash. |
| Bauxite | $25 | Bedrock | Aluminum ore. |
| Iron | $35 | Bedrock → deep crust | Ubiquitous. |
| Pyrite | $60 | Bedrock | Fool's gold. Looks valuable, isn't. |
| Silver | $90 | Bedrock → deep crust | |
| Methane ice | $180 | Permafrost | Heated drill required. |
| Cinnabar | $140 | Deep crust | Mercury ore. Crystal clusters. |
| Gold | $200 | Deep crust | The real thing. |
| Amber | $350 | Fossil layer | Insect trapped inside. |
| Trilobite | $600 | Fossil layer | Half-billion-year-old arthropod. |
| Uranium | $800 | Deep crust | Glows. Requires drill Lv 3. |
| Obsidian | $280 | Magma veins | Volcanic glass. |
| Emerald | $900 | Fossil → crystal | |
| Ruby | $1,400 | Deep crust → crystal | |
| Tanzanite | $2,000 | Crystal caves | Real, found only in Tanzania. |
| Diamond | $3,000 | Crystal caves | Requires drill Lv 4. |
| Painite | $6,000 | Mantle edge | Real, briefly the world's rarest gem. |
| Unobtanium | $12,000 | Mantle edge | Not real. Sue me. |
Dirt and stone are not in this table because you do not collect them. You drill them, they disappear, you move on. The shop has six upgrades: drill, fuel, hull, cargo, plus a one-time Heated Drill purchase (gates the permafrost) and a two-tier Heat Shield (lets you survive the magma and mantle layers).
One piece of code I like
The world generates once at startup. Every tile rolls against a list of candidate ores filtered by depth, with rarer ores getting a slowly-increasing edge the deeper you go. The trick is walking the candidate list from rarest to most common, so diamond gets first dibs on the random number and common dirt only gets picked when nothing rarer has claimed the roll.
function pickOre(depth) {
var candidates = [];
for (var i = 0; i < ORE_KEYS.length; i++) {
var o = ORES[ORE_KEYS[i]];
if (depth >= o.minDepth) candidates.push(ORE_KEYS[i]);
}
var r = Math.random();
// Deeper = rarer ores more likely. Walk from rarest to common.
var cumul = 0;
for (var j = candidates.length - 1; j >= 0; j--) {
var ore = ORES[candidates[j]];
var adjustedChance = ore.chance * (1 + depth * 0.003);
cumul += adjustedChance;
if (r < cumul / (cumul + 1)) {
return { type: candidates[j], hp: ore.hp };
}
}
if (Math.random() < 0.12) return null; // air pocket
return { type: 'dirt', hp: ORES.dirt.hp };
}
Two things going on here. The
cumul / (cumul + 1) bit is a soft normalization:
it keeps the running probability bounded between 0 and 1
without needing to know the total ahead of time, which is
handy because the candidate list changes with depth. And
the depth multiplier (1 + depth * 0.003) is
small but compounds. By 150 metres down, rare ores are
getting a 45% bonus on every tile roll, which is why the
crystal caves feel like a payday after the long climb to
get there.