Cave Story from scratch
The 49:57 run was built on top of human runs: about two-thirds of its inputs came from a 2011 TAS. This is the next step. A machine played Cave Story from a new game all the way to the Best Ending, with no human inputs, no human route and no recorded runs to follow. It worked out what to do from the game itself.
Verified on the original game. The run's button presses were played into the original
Doukutsu.exe (Japanese freeware 1.0.0.6) and compared with our copy of the game on every frame: all
517,360 frames match, the credits start at frame 506,072, and the game ends on the Best Ending with both of its
flags set. It's a plain clear, not a speedrun: the run wanders and backtracks (the search behind it died countless times),
and it takes almost three times as long as the human-assisted record. Making it fast is the next step.
The rules
One rule: no human input files or routes go in. No movies, no walkthroughs, no list of where to go. The machine gets the game and has to find its own way. The AI that built the tools has read about Cave Story like anyone else, so the claim isn't "nobody knew anything". It's that the run itself was found by search, with the goals read out of the game's own data.
How it plays
Three parts work together:
- Reading the game. A program decoded all of Cave Story's scripts and maps into a map of rooms, doors and story events. From the ending scripts it worked out what the Best Ending needs: about 50 story facts, like holding the Booster v2.0 and finishing a side task in the Plantation before the Undead Core fight. Nobody typed those in; they came from the scripts.
- An explorer. 28 copies of the game run at once, about 1.5–2 million frames a second. The explorer keeps a big archive of every kind of moment it has reached, with the fastest known way there. Over and over, it goes back to a promising moment and tries something new from it. A planner built on the script map tells it which story step comes next.
- A GPU helper. When the explorer can't reach a target (a door, an item, a boss kill), it hands the problem to a GPU search that runs tens of thousands of copies of one room at once and sends back a way through. This ran mostly on an Intel Arc Pro B70.
The walls, and what got past them
Most of the work was the explorer getting stuck, and an AI agent figuring out why by reading the game's scripts, then teaching the search something general rather than a hint for that one spot.
- Igor. His fight starts with a cutscene that clears a flag, so the fight looked like going backwards. Fix: progress along a path never drops.
- Grasstown. The way east is through Chaco's fireplace, which needs Jellyfish Juice from a chest guarded by a big jellyfish with no health bar. Fix: big enemies count as part of the situation.
- Malco's bomb uses up three items, which looked like a loss. Fix: items count as "ever held".
- Jenka's puppies held it up for about a day. Reading the scripts showed why: the door the plan pointed at is sealed inside a wall; the real door opens only once four puppies are handed in and the fifth is carried to a spot nearby; the fifth puppy is far to the east; and a shaft on the way is blocked by giant Sunstones until a cutscene moves them. Fixes: drop targets sealed in walls, start each search from a state where that step is really next, and reward story events that move solid objects.
- Monster X. Its health bar doesn't drop until all four eyes are dead, so the GPU search saw no progress. Fix: count the health of a boss's parts. It then won the fight at full health.
- Ammo drops. Every pile of missiles enemies left behind looked like a new situation, and the archive grew to 1.2 million mostly-duplicate entries. Fix: ignore ammo drops. It went from the Labyrinth to the Core in 12 minutes.
- The Dragon Zombies. Every attempt arrived with weak weapons and low health. Fix: weapon levels count, and help is requested from healthy states.
- The Outer Wall. The Booster v2.0 does nothing until you equip it from the menu, and random button presses never do that. Fix: an "open the menu and equip or use an item" action. A later gate needed an item to be used from the menu, and the same action handled it.
- The Best Ending condition. The scripts say the Undead Core fight only unlocks the true ending if you hold the Booster v2.0 and have already done a side task. The planner treats a kill without them as a dead end, so the explorer went back for the missing piece first.
- Ballos. The final boss guards himself with orbs he spawns. Counting the orbs as part of the boss, and a bigger GPU build for the busiest rooms, got the kill. The credits rolled right after.
Odd things it does
A search that has never seen anyone play doesn't play like a person. Some of what it did:
- Two Curlys. During the Core fight, Curly rides on Quote's back while her fighting self is still battling below (picture below). The Core has an invisible spot meant for the scene after the fight, where you rope the unconscious Curly onto your back. Its script only checks that you have the Tow Rope, not whether the fight is over. The run had picked up the rope a moment earlier, and at 1 HP, mid-fight, it pressed Down on that spot and answered Yes. The original game draws exactly the same thing.
- About 6,400 weapon switches. Nothing told it switching weapons costs anything, so it switches constantly.
- It never dies, but it lives on the edge. The final run never loses all its health; it spends long stretches, including Ballos's first form, at 1 HP. The search itself died countless times. Only the paths that survived were kept.
- It equips the Booster v2.0 twice. Momorin borrows it for her rocket, so after getting it back the run has to find the menu trick again.
- It wanders. Right after getting the Polar Star it walks back to the start room. Nothing rewards a short route, so it takes long ones.
- A lucky miss. By the game's scripts, taking Professor Booster's v0.8 earlier would have meant no Booster v2.0, which the Best Ending needs. This run happened not to take it; later versions of the search treat it as a dead end.
Doukutsu.exe (left) and in our copy of the game (right),
identical pixel for pixel: one Curly on Quote's back (top middle) and one fighting below.What's next
- Fast. A second stage takes the explorer's wandering run and searches each stretch for a much shorter way through, keeping the same story state. So far it cuts about 47% everywhere it has finished; the stretch from power-on into the Sand Zone, already shortened, also plays identically on the original game. The human-assisted record is 49:57, so there's a long way to go.
- Reliable. The explorer is being rerun from a new game with the final code. Each rerun has found another place where the first run got lucky, and turned it into a rule.
- From the screen. A separate neural network learns to play from the pixels alone: no game memory, just the last four frames. From power-on it now reaches Mimiga Village in 8 of 10 games and beats Balrog in 6 of 10. It learns from the machine-made runs above, never from human play.
Credits
- zoan: the idea, the direction, the hardware.
- Claude (Claude Opus 5.5 in Claude Code): a main session and a handful of agents that built the tools, ran the searches, diagnosed every wall and wrote this page.
- The CSE2 decompilation project, which made a bit-exact, searchable copy of the game possible.
Cave Story is by Daisuke "Pixel" Amaya / Studio Pixel. Its graphics and music are his.