For the past few weeks I've been teaching computers to speedrun Sonic the Hedgehog on the Sega Game Gear, live on stream, with no human hands on the controller. On Friday a single PC finished the game for the first time. Since then the team has grown to seven computers plus a handful of web browsers. All 18 acts have been rebuilt for speed, and the best complete run, checked from power-on, has dropped from 27:25 to 19:12.48. This post shows what that looks like, and explains the techniques and tools behind it, including the mistakes.

| Where it stands (29 November 2026) | Time |
|---|---|
| First complete run (27 November), speedrun.com timing | 27:25.17 |
| Best complete run, verified from power-on (Record 05) | 19:12.48 |
| The team's best time for every act, added up | 17:42.33 |
| Human world record (kirbymastah) | 16:51 |
The gap between the last two rows is the most interesting part of this post. The team has already found every act at a speed that adds up to 17:42, but it can't simply glue those acts together. More on why below.
A quick recap: search, not a neural network
The project started with reinforcement learning: a neural network rewarded for moving right. After 5.5 million training steps it had got worse and had settled on holding left. What turned it round was noticing that the emulator is completely deterministic. Press the same buttons on the same frames and you get the same result, every time, on every computer. So nothing needs to be learnt as a reflex. You can search for the best fixed list of button presses.
The search is based on Go-Explore, a method published in Nature in 2021. It keeps an archive of every place in the level Sonic has reached (on a grid of a couple of dozen pixels), along with the fastest button sequence that got there. Then it repeats one loop: pick a promising place, jump straight back to it with a saved game state, try a few seconds of button presses, and record any new places reached, or old ones reached sooner. Once a burst reaches the end of the act, fine-tuning takes over and trims frames off the route. Nothing counts until the route has been replayed and checked.
The program knows nothing about Sonic. It doesn't know what a spring, a wall or a glitch is. All it sees are a few numbers read from the game's memory: Sonic's position, speed, rings, lives, the act and the clock.
What you see on the stream
The solver runs live on YouTube, in a window called Sonic Solver. Its Live tab shows the act being worked on, every computer in the team, and the latest news from the team.

- The act strip shows each act's best time, how much it has saved, and the game's own clock for that route, which is how the human per-level records are timed.
- The coloured dots on the map are every place the search has reached: blue early, yellow recent.
- The white line is the fastest route. It's my favourite part of the whole display.
- Red crosses mark where Sonic keeps dying. Purple rings mark "impossible moves" and gold diamonds mark breakthroughs (both explained below).

Getting the clock right
To compare with human runners, you have to time the run the way they do. speedrun.com's full-game category is real time minus time bonuses. The clock starts when you press Start on the title screen and stops at the final teleporter. The bit taken out is the end-of-act bonus counting down, at 100 points a frame. The game's own code confirms it: the bonus is chosen from the clock at the signpost and counts down at exactly that rate. So working out the time to remove is just the points divided by 6,000.
My first attempt got this wrong. It counted every frame in which the bonus value in memory went down. But outside the score screen that memory is scratch space the game uses for other things, so I was removing 65.7 seconds instead of 22.8. Re-timed properly, the first complete run is 27:25.17, not the 26:42 I first quoted. Records now carry a live splits table that is filled in from the game's memory as the run replays, act by act.
Things the search discovered by itself
Three things on stream looked too good to be true, so I checked each one in the game's memory, frame by frame:
- Braking at the signpost (Green Hill 2). The act ends with Sonic rolling downhill into the sign at 8 pixels a frame. That fast, he runs straight past the trigger and the act never ends. The route brakes, slides past, and walks back in. Nobody told the search this: attempts that arrived at full speed simply never finished, so only the ones that slowed down survived.
- Hopping out of the Green Hill 2 water. Instead of standing against the step at the end of the pool for over a second, the route hops it at exactly the right moment: 150 frames instead of 238.
- The Labyrinth 1 wall zip. Sonic gets pressed into a wall, carried up about a pixel a frame, then a single jump fires him up through the level, far further than any normal jump can. He isn't killed. The program only presses buttons and never edits the game's memory.

The program doesn't remember the zip as an idea. It can't think "try squashing into another wall". It only knows that these exact presses, from this exact starting point, get there fastest. That turned out to matter a great deal later.
From one PC to a team of seven

The team now looks like this:
- My main PC, which also runs the stream.
- A PC in the attic.
- A MacBook Air. It's resting at the moment: it has no fan and was getting very hot. Fanless laptops now use only half their cores.
- The web server that hosts this blog.
- A free Oracle Cloud server.
- A Google Cloud server on a free trial.
- Any web browser I point at a helper page.
None of them share a drive. Each plays its own exact copy of the game, and only button lists and results travel over the internet.
- The web server donates its spare time and nothing more. It hosts about 17 websites, so the solver runs at the lowest priority the kernel has: it only gets processor time nobody else wants. It also has hard caps on cores and memory, and a guard that pauses it whenever the websites get busy.
- Oracle Cloud, free for good. Four Arm cores on the Always Free tier, set up so it can never charge me. It deliberately keeps its own run instead of following the others, as a second opinion.
- Google Cloud, the biggest worker. It's a reclaimable "Spot" server with 10 Arm cores on Google's free trial credit. Google can switch it off at any moment, so a scheduler restarts it every time. For its first twelve hours that restart quietly failed for want of one permission. It's fixed now, and a tracker on the web server raises an alert within five minutes if any computer goes quiet. Oracle watches the web server in turn.
- Browser helpers. I compiled the exact same emulator to WebAssembly (91 KB), so a web page can lend its processor without installing anything, from a work laptop or even an iPhone. Before trusting it, I replayed the same work in the browser and on the desktop: identical results on six very different acts.
At its peak the team ran 98 Game Gears at once, 38 of them inside web pages, and at its fastest reached 341,694 game frames a second, about 5,700 times real time. Since early this morning it has played about 12 billion frames, which is roughly six years of non-stop Game Gear. Over its lifetime the search has made 21.5 million attempts and reached 379,480 distinct places. Sonic has died 9.2 million times.
More computers weren't the bottleneck. Bookkeeping was.
This was the biggest lesson of the week. An act's route only works from the exact spot where the previous act ended: same position, same frame and same random number state. Make Green Hill 1 a quarter of a second faster and Green Hill 2 starts from a slightly different moment. The button presses may no longer line up, and a precisely timed zip simply stops working. So the team doesn't really have 18 separate routes. It has chains of them.
- Work thrown away. At first each computer built its own chain, and the best acts were spread across chains that couldn't be combined. One evening I added up the best time ever found for each act: 18:16. The best chain the team was actually running projected 19:45. Almost 90 seconds had been found and then lost in archives nobody read. The worst case was a 63.4-second Jungle 2 route sitting on my main PC's disk, from exactly the same starting point, while the team ran 113.3 seconds there.
- Follow the leader. Now every chain publishes a projected whole-game time, and computers switch to the leader's chain when it's clearly ahead. Every archived route is offered back to the team. A new faster act is only kept if the whole game ends up faster once all the later acts have been rebuilt on top of it.
- Lag frames. When the Game Gear is too busy it skips a frame of logic, and the random numbers move on regardless. Routes are now re-timed by the game's own logic-frame counter, which brought a lost Labyrinth 1 trick back (95 s down to 55 s).
That's why 17:42 (the best acts added up) and 19:12 (a real, verified run) are both true at once. Closing that gap is mostly rebuilding work, and the team does it every day.

Hunting breakthroughs
Measuring learning curves showed two very different kinds of progress:
- Steady polishing saves about half a second a minute at first, halving roughly every 6½ minutes. It's essentially over after 25 minutes.
- Breakthroughs are rare and arrive whenever they like. Green Hill 2 went 80 minutes and 61,500 attempts without progress. Then a single burst found a new route and cut it from 90 seconds to 50.
So two computers now work as breakthrough hunters. They have no time limit, explore places that are rarely tried, and ignore the "reached early" rule, which throws away routes that start slow but finish fast. They also use an impossible-move detector: if Sonic travels further in eight frames than his own speed can explain, something strange happened. Normal play never goes above 84 pixels on this measure, while the Labyrinth 1 zip scores 168 to 253. Anything over 150 is flagged, and the hunters explore six times harder around it. So far the team has logged 763 of them at 292 spots in 10 acts. "Chase strange movement" is the closest the search gets to learning a technique.
The biggest single gain came from one line of reasoning, though, not from more computing power. The search judged "further on" by how far right Sonic was. Jungle 2 is a vertical climb up a waterfall, so every ledge high up looked "behind" some spot further right at the bottom, and the climb was hardly explored. Measuring progress along the start-to-sign direction took Jungle 2 from 113.3 seconds to 63.3 seconds within 34 minutes. It's 54.09 seconds today.

A controller and a control room
Every three minutes a small planner on the web server reads every chain, every stored route and every computer. It decides what's worth doing next and hands out jobs. The Sonic Solver window, and the phone helper page, now have a Control room tab. It shows what the controller is asking each computer to do, who is doing it, and what came back. There's a master override that sends the whole team to one act, and a "methodical" mode that walks the team through all 18 acts in turn.
Measuring the controller's own jobs was humbling. "Section" jobs re-timed the button presses around one slow spot of an existing route. They looked busy: 257 jobs and about 980 minutes of computer time, for 0.5 seconds saved in total. Small edits to a route can't find a different route. They're switched off now.
The replacement is the revisit: a fresh, open-ended, 30-minute search of a whole act the team had moved past. Green Hill 1 hadn't been searched properly since Saturday evening. Within an hour, both hunters independently found the same new route, 0.57 seconds faster. One real search of a forgotten act beat a thousand minutes of tweaking.
Keeping it honest
- Every record is replayed from power-on using button presses only: no save states, no memory edits and no patched cartridge. The Records tab has a Watch Replay button that does exactly this, live, and fills in the speedrun.com splits table from the game's own memory as each act finishes. Record 05 replays to 69,060 frames, 19:12.48, exactly its own figure.
- A second, independent emulator build has to agree. Record 05 was replayed on both the desktop build and the browser's WebAssembly build, which uses a different compiler and a different machine model. Both changed act on exactly the same frames, from Green Hill 1 to the ending.
- Mistakes are written down.
These are the main mistakes so far:
- The bonus timing. Covered above: it removed 65.7 seconds instead of 22.8.
- Jumping over the Green Hill 1 sign. My attempt to speed up the ending set the wrong target, and Sonic jumped clean over the sign.
- A game over that looked like a finish. An old test route seemed 56 seconds faster. Replaying it showed Sonic losing all his lives: the act counter had changed because the game reset, not because the act was finished. The strict check that every record must pass rejected it.
- The browser helper's early failures. In the first live test, 24% of its tasks failed. It looked like the browser emulator was wrong. The cheapest possible check, replaying the same routes in both and comparing, found 0 differences in 200. The bug was in my own bookkeeping.
One open question: the clock currently stops 28 frames before the ending begins, during Robotnik's teleporter fade. speedrun.com stops it "when you enter the final teleporter", which would make our times about two seconds lower. I'd rather under-claim until that's settled.
Where the computer time actually goes
Profiling showed that the Python search code is not the bottleneck: nearly all the time is spent in the emulator itself.
- A lean build of the emulator. I built six variants and played the whole verified game on each, checking the game's memory every 50 frames. Skipping the picture and sound, which never feed back into the game logic, made it 54% faster with identical memory for the entire game.
- A graphics-card version. I also ported the emulator to the graphics card, exact to the frame. On my GTX 1650 Super, which is also busy encoding the stream, it didn't beat the processor.
Raw speed helps, but the big wins have all come from looking in the right places.
Every act, and how far from the humans
The team's best time for each act, against the first complete run. The "clock" columns are the game's own timer, which is how the human per-level records are timed. Bold marks the acts where our route's clock matches or beats the human per-level time. These aren't records: human leaderboards don't allow tools, and this is all tools.
| Act | Best (RTA-TB) | vs first run | Clock: ours | Clock: human |
|---|---|---|---|---|
| Green Hill 1 | 34.16 s | −16.7 s | 24 s | 18 s |
| Green Hill 2 | 40.54 s | −36.4 s | 25 s | 21 s |
| Green Hill 3 (boss) | 79.94 s | −7.3 s | ||
| Bridge 1 | 48.71 s | −35.4 s | 30 s | 23 s |
| Bridge 2 (auto-scroll) | 136.73 s | −4.6 s | ||
| Bridge 3 (boss) | 44.87 s | −25.3 s | ||
| Jungle 1 | 46.81 s | −45.8 s | 30 s | 28 s |
| Jungle 2 | 54.09 s | −70.1 s | 34 s | 30 s |
| Jungle 3 (boss) | 41.32 s | −32.3 s | ||
| Labyrinth 1 | 49.80 s | −25.0 s | 33 s | 34 s |
| Labyrinth 2 | 57.07 s | −34.2 s | 39 s | 57 s |
| Labyrinth 3 (boss) | 43.04 s | −42.1 s | ||
| Scrap Brain 1 | 44.26 s | −45.6 s | 28 s | 27 s |
| Scrap Brain 2 | 194.23 s | −7.1 s | 2:33 | 1:19 |
| Scrap Brain 3 | 81.99 s | −24.8 s | ||
| Sky Base 1 | 38.12 s | −36.1 s | 20 s | 23 s |
| Sky Base 2 | 57.99 s | +1.9 s | 30 s | 8 s |
| Sky Base 3 (final boss) | 22.55 s | −35.0 s | ||
| All 18 acts | 17:42.33 | −9:43 |
Most of the remaining gap to the human record sits in two places. The first is Scrap Brain 2, where our route runs out to the far right of the level and back to an exit near the start: 2:33 on the clock against a human 1:19. The human route must take a different path. The second is Sky Base 2, 30 seconds against 8.
The record run, act by act
Each picture below is a moment from one act of Record 05, the best complete run so far, replayed from power-on. On the right is the act's map: the white line is the whole route the search found, the green ring is the start, and the red dot is where Sonic is at that moment. The times in the captions are Record 05's own; some acts are already faster on other chains, as in the table above. Click any picture for the full size. Videos of every act will follow once the times have come down further.
What's next
- A path map of every level. Started today. It's built from the game's own level data (blocks, solidity, slopes, springs) and gives the search the true distance to the finish from any spot, instead of "how far right". It also gives a theoretical fastest time for each act, which shows where the big gaps really are.
- Turning 17:42 into a verified run. Rebuilding the later acts on top of each new early act until the chain catches up with the best acts.
- Scrap Brain 2 and Sky Base 2. The two acts where a different route, not polish, is needed.
The stream keeps running, so come and watch it chip away at the last 51 seconds.
All images in this post © Peter J Mayhew. Related on this blog: Sega Game Gear Sonic the Hedgehog level select. Sonic Solver was built with the help of Claude Code. It plays a legally owned cartridge image that is never shared. Sonic the Hedgehog is a trademark of SEGA; this is a fan project and isn't affiliated with or endorsed by SEGA.


















