The Glitchhouse / Glitch City / Walk
Walk Through Glitch City in Pokemon Red, Blue and Yellow
You can walk through 24 of the 63 Glitch Cities: 7 in Red, 7 in Blue and 10 in Yellow. The rest hold you on the tile you land on. In the ones you can walk, you move by the game's own rules, step by step and wall by wall, and in three of them a wild Pokemon can jump out: Tentacool in Route 20's, in Red and Blue, Psyduck and Golduck in Route 6's, in Yellow, and Nidoran, Mankey, Rattata and Spearow in Route 22's, in Yellow. Play every one of them below.
Loading...
Keys: arrows or WASD to walk, Enter for the Start menu (Fly and the other ways out), Z or J for A, X or K for B. On a phone, the pad and the buttons.
How walking works in a Glitch City
Glitch City is a normal map with the wrong screen. When the Safari Game's steps run out outside the Safari Zone, the gate sends you back to the last outdoor map you were on, and on a map with 4 or fewer doors the game reads your position and the screen pointer from four bytes past the end of its door list (the Glitch City page has the whole chain). Everything else is the map's own, and the walking code is the same code you walk with everywhere. Here is what that code does, routine by routine, in pret's disassembly of the games:
- A step is 16 frames. OverworldLoop runs once every 2 frames. A step sets wWalkCounter to 8, and AdvancePlayerSprite scrolls the screen 2 pixels on each pass, 16 pixels in all. The screen pointer moves on the first pass and your coordinates (wXCoord, wYCoord) on the last.
- Turning costs one pass. Press a new direction after standing still and the first pass only turns you (wCheckFor180DegreeTurn and wPlayerLastStopDirection). Let go that fast and you turn on the spot; hold it and you walk.
- Walls are the tiles under the screen pointer. CollisionCheckOnLand looks at the tile in front of you, and CheckTilePassable compares it with the map's list of tiles you may stand on. In Glitch City those tiles come from whatever bytes the pointer reads, mostly the cartridge's own code and data, drawn with the map's real tileset, so a wall is wherever a non-passable tile happens to fall.
- Ledges work. HandleLedges checks your facing, the tile you stand on and the tile in front against the LedgeTiles table. On a match you hop two coordinates with two simulated presses and no collision check on the way, exactly as on a real route. 15 of the 24 cities have ledges.
- Some tiles hide you. UpdatePlayerSprite turns your sprite off when the tile under you is $60 or higher, which is a text box or font tile, not a map tile, and it stops updating your facing there. The collision check still uses the old facing while the step goes the way you press. In Route 1's Glitch City in Red and Blue a ledge drops you onto two such spots facing a wall, and from then on every press checks that wall: you are stuck until you fly out.
- Cycling Road pushes you down. On Route 17, JoypadOverworld (ForceBikeDown in Yellow) holds Down for you whenever you hold no direction, A or B, even in its Glitch City. You slide until a wall stops you. Hold B to stand still.
- Doors do nothing. CheckWarpsNoCollision compares your coordinates with the map's real doors. In all 24 cities no door sits on a spot you can reach, so no door ever takes you anywhere.
- Water stops you. You walk here, so a water tile is just a wall. Surfing is left out of the walker.
Wild Pokemon in Glitch City
The wild data is the real map's, loaded by LoadWildData as usual. After each step, and after each turn on the spot, NewBattle asks TryDoWildEncounter for a battle. It reads one tile under you: in Red and Blue the lower right one, at screen tile (9, 9), in Yellow the lower left one, at (8, 9). If that tile is the tileset's grass tile the map's grass rate applies, if it is water ($14) the water rate, and anything else means no battle on an outdoor map. A battle starts when the random byte hRandomAdd is below the rate, and hRandomSub picks one of the 10 slots. Never on a door tile, and not for 2 steps after a battle.
Glitch tiles rarely land on grass or water, so only three cities can start a battle:
| Glitch City | Spots | Rate | What you meet |
|---|---|---|---|
| Route 20, Red and Blue | 1, a dead end you hop into | water, 5 in 256 (2.0%) | Tentacool, level 5 to 40 |
| Route 6, Yellow | 2, both dead ends you hop into | water, 3 in 256 (1.2%) | Psyduck level 15, Golduck level 15 or 20 |
| Route 22, Yellow | 4, in grass you walk through | grass, 25 in 256 (9.8%) | Nidoran (female and male), Mankey, Rattata, Spearow, level 2 to 6 |
On the dead ends you cannot step at all, but every turn rolls again. When a battle starts here, the walker hands it to the Battler, which plays it by the game's battle rules, or you can run and keep walking.
The ways out
Open the Start menu (Enter, or the START button) to try them:
- Fly works. The Fly code checks for the Thunder Badge and then calls CheckIfInOutsideMap, which looks only at the tileset, and every Glitch City has an outdoor tileset. The town map then lists the towns you have visited.
- Teleport works for the same reason and takes you back to the last Pokemon Center you used.
- Dig and Escape Rope fail. Dig uses the Escape Rope's code, and ItemUseEscapeRope works only in the cave, forest and building tilesets.
- Walking off an edge works in two places. In Route 20's Glitch City, walking west makes your X 100, twice Route 20's width, so CheckMapConnections fires the east edge check and loads Route 19 with you at x 0 and y 36 more than before, far below its real rows. In Route 6's, walking west makes X 255, and Route 6 has no west connection, so the game loads map 255, which does not exist, and crashes.
- Losing a battle sends you to the last Pokemon Center too (HandleBlackOut), in the three cities with wild Pokemon.
Saving does not help: a game saved in Glitch City loads straight back into it.
Tested against the real game
The walker is a copy of those routines, so I checked it the hard way. For 9 cities, 5 in Red, 1 in Blue and 3 in Yellow, a save that loads straight into the Glitch City booted in the PyBoy emulator, and the same presses went into the game and into the walker: hold a direction until the step starts, let go, wait until you stand still. 450 presses in all, 40 to 60 per city, with walls, ledges, the hidden spots of Route 1 and Cycling Road's slide. After every press the game and the walker agreed on your x and y, on whether you moved and on which way you face: 450 out of 450. The emulator ran with no hooks in the cartridge, because these cities draw their maps from the game's own code, and a hook changes the code it sits on.
The wild battles were checked the same way. Turning on the spot started a battle with no step taken in all three cities: Tentacool level 10 in Red after 13 turns, Psyduck level 15 in Yellow's Route 6 after 5, Nidoran (female) level 4 in Yellow's Route 22 after 13, each one from the map's own list. Stepping onto Route 22's grass met a Nidoran (male) level 4. And the edges: one step west off Route 20's area in Red put the game in Route 19 at x 0, y 144, where the walker says, and one step west off Route 6's loaded map 255. Everything was tested in the game's own code in an emulator, not on a real Game Boy.
Every Glitch City you can walk
Each link opens the walker on that city. The map gallery has all 63, the ones you cannot walk too.
Pokemon Red
Pokemon Blue
Questions
Can you walk around in Glitch City?
In 24 of the 63, yes: Routes 1, 6, 12, 14, 15, 17 and 20 in Red and Blue, and Routes 4, 6, 9, 12, 14, 15, 17, 20, 22 and 25 in Yellow. Cycling Road's has the most room, 146 spots. In the other 39 you cannot take a single step.
Are there wild Pokemon in Glitch City?
Only in three: Tentacool in Route 20's in Red and Blue, Psyduck and Golduck in Route 6's in Yellow, and Nidoran, Mankey, Rattata and Spearow in Route 22's in Yellow. Each comes from the real map's wild list, on the few glitch tiles that happen to be grass or water.
How do you get out of Glitch City?
Fly or Teleport. Dig and Escape Rope fail outdoors. On foot you can leave only Route 20's, into a broken Route 19, and Route 6's, which crashes the game.
Why can I not move in some spots?
Either a wall is in front of you, or you stand on a tile that hides your sprite and freezes your facing, and the tile your old facing points at is a wall. Both are the game's own collision rules working on scrambled tiles.
Read next
- Glitch City: how to get in, step by step, and why the gate reads the wrong bytes.
- Glitch City maps: all 63, whole, with downloads.
- The Battler: the Gen 1 battle engine, where the walker's wild battles are played.