Infinite Maze
Posted on Sun 18 October 2026 in tech

Ever since I was little I have wanted to make a game with infinite playability. I call it Infinite Maze: a pixel-art platformer in which you climb, by torchlight, through an Egyptian tomb that goes on forever in every direction.
The world is static. The generator derives every room from a SHA3 hash of the seed and the room's position, so a seed always builds the same world, and every entry in the maze connects to every other entry with probability 1.
Climbing by torchlight
You play an explorer in a fedora who runs along corridors, climbs ladders, walks stone stairs and jumps. The torch lights only a circle around you, so most of the tomb sits in shadow until you reach it.
The torch is the clock. A full torch burns for 300 seconds, and its light shrinks as it burns, to a quarter of its reach in the last tenth. A turquoise brazier relights it to full, and an oil jar in a dead end adds 60 seconds. At zero the torch gutters to an ember for 10 seconds, and the run ends unless you reach a flame in that time.

The generator spaces braziers so that enough flame is available to solve each tomb, but success is not certain.
The generator also places hints for a lost explorer, and more of them appear as the torch burns down. At some junctions a carved arrow high in the room points along the way on, and now and then a skeleton slumped in a lower corner points the same way with its arm. When the torch falls below half, a second set of skeletons fades in, so the hints thicken when you can least afford a wrong turn.
The music takes you to a far-off tomb, where the air is dry and the risk is tangible. It sounds like an old adventure film, or the Egypt of an Agatha Christie mystery, a frame drum under a Middle Eastern scale. At first it gives you room. As the torch runs down it adds layers and quickens, driving you on before the flame fails. Survival is uncertain, and escape more so.
The score counts the tombs you leave through their exit doors. Every 100 tombs earn a rank, and what the ranks are is yours to find out over a lifetime of solving. Coins lie in dead ends and in rows of three along corridors, and they lure you into dead ends while the torch burns.
Save codes
A save is the seed code and one integer, such as K7Q2-M9XA:4813, which packs
the signed coordinates of a room into one number. Type the code on another
device and you resume in the same room, so a climb started on a laptop at lunch
carries on from the phone on the way home.

P pauses and shows the map of the passages you have walked, with the save code under it.
A code holds coordinates below 2²⁵ rooms in each direction. A room takes six seconds to run across, so walking that far sideways in a straight line would take about six years, and the maze winds.
Is the maze actually infinite?
An astute reader will object, as I did, that SHA3-256 has a finite output space, so a maze built from it cannot be truly infinite. The objection is sound. The world is infinite in extent and finite in variety. Every coordinate holds a room and no coordinate is an edge, but the rooms come from a finite stock, so they repeat, as the twins section below shows. The game holds no maze. It computes each room when you arrive.
The trick is SHA3-256, a hash that flips about half of its output bits when one input bit changes. Those bits are effectively random, and the whole world grows from them. Every wall, door and branch takes its marching orders from a hash, so SHA3 is the game's entropy engine:
WORLD = SHA3-256("infinite-maze/v1" ‖ code)
H(tag, x, y) = SHA3-256(WORLD ‖ tag ‖ x ‖ y)
Nothing is generated ahead of time, and no room needs its neighbours to exist before it can be rendered. Each room is discrete and deterministic, and the game builds it on the spot, in any order, a million tombs up included, with the same answer every time. That is why a save code is one integer.
Two rooms on a shared wall both ask for H("door", wall) and get the same answer, so the door lines up whichever room the generator builds first, even hours apart.
Each tomb has one exit door, up, left or right, so following exits from tomb to tomb only climbs or moves sideways.
One tree, pretty much for sure
Every corridor in Infinite Maze belongs to one tree, and that tree has no end. Only a finite piece of it can ever be checked, so the claim rests on construction, probability and tests in turn.
Certain, whatever the hash says
The maze is trees nested inside trees. The cells of a room form a tree, rooms join through single doors into a tree for each tomb, and tombs join through their exit doors. A tree has exactly one path between any two of its points, so wherever you stand there is exactly one way to anywhere else, and every dead end you walk into is a branch of that one way.
Suppose a loop of tombs existed. To close, it would have to come back down or circle within a row. Exits only climb or move sideways, so it can't come back down. Within a row the sideways exits are one-way steps along a line, and a line of one-way steps never returns to where it started. So the loop can't exist.
These rules hold for every value the hash can return, because the hash only chooses among moves the rules allow. A broken hash could make a dull maze, but it would still be a maze with no loops, doors that line up on both sides of every wall and one path between any two cells.
Almost sure, if the hash flips fair coins
The way up leans on the hash behaving like fair coin flips. A walk from tomb to tomb climbs whenever its tomb exits up, and otherwise steps sideways. A walk that runs 100 tombs sideways before it climbs has odds near one in 2100, and a walk that never climbs has probability 0.
The joins rest on the same model, since two tombs share a tree only when their walks upward merge. In each row each walk drifts left or right before it climbs, so the gap between two walks wanders like a drunkard on a line. George Pólya proved in 1921 that a random walk on a line or a plane returns to its start with probability 1, and that in three dimensions it may wander off for good. Shizuo Kakutani put it as "a drunk man will find his way home, but a drunk bird may get lost forever." The gap between two walks is a drunk man. It closes, the walks merge, and from there they climb together, so every tomb joins the one tree.
Pólya's theorem has a sting in it. The expected time to come home is infinite, so a meeting can come absurdly late. On seed 0000-0000 the walks from tombs (0, 0) and (10, −50) are 15 columns apart at row 0 and first meet at row 773,851. At a tomb a minute, climbing that far takes a year and a half without sleep, for two tombs that started a few screens apart.
For any one seed the hash has already fixed every wall, so two walks either meet or they don't. The probability lives in the fair-coin model, where walks that never meet have probability 0, the way an endless run of tails has probability 0 for a fair coin. Mathematicians call that almost surely.
How far SHA3 strays from a coin
SHA3-256 is a real function with 2256 outputs. Two given inputs collide with probability 2−256, and over a lifetime of play, a trillion hashes or so, the chance of even one collision is near 2−177. A collision would change nothing you could see, since the no-loop rules hold for every value the hash returns. Odds like 2−177 and 2−100 are past the point where probability means anything in practice: a billion tries a second since the Big Bang adds up to about 288.
Every room has a twin
A room is built from a finite number of choices, so the generator can build only finitely many rooms. The maze holds infinitely many, so by the pigeonhole principle some room has to repeat, whatever the hash. In the fair-coin model the claim gets stronger: rooms far apart read independent hashes, so every room the generator can build turns up again, almost surely, infinitely many times over. So does every tomb, and every neighbourhood of tombs around it.
The number of possible rooms is far beyond a lifetime of play, which at a room every six seconds for eight hours a day over fifty years reaches about 90 million. The twin of the room you stand in sits unreachably far away, opens onto different neighbours and changes nothing about the one tree. Find a room and its twin.
What the tests check
A harness runs the generator over 2,121 tombs, columns −10 to 10 by rows −50 to 50. It rebuilds every connection from the doors on both sides of each wall, follows every exit walk out of the window and climbs from the bottom row to the exit door at the top.
This is not a machine-checked proof. The joins rest on a model of the hash, and the tests cover a finite window of an infinite plane. That proof would make a good paper.
Pick a seed and start climbing at maze.2ad.com.