Out of bounds
Out of bounds refers to going beyond the normal boundaries of an area on the overworld map.
In Generation I
In Generation I, the player's coordinate on the map is represented by two bytes, the X coordinate (horizontal position; east is larger; $D362 in R/B, or $D361 in Yellow) and the Y coordinate (vertical position; south is larger; $D361 in R/B, or $D360 in Yellow). Therefore, the entire "map space" available to the player in theory is a 256*256 square.
Since byte operations overflow and underflow normally, the left side and right side are "connected together", and so are the top side and the bottom side, although the player cannot directly step through the boundary without triggering a (possibly invalid) map connection.
Accessing out of bound areas
If the player tries to directly step out of bounds by walking through walls, the game will try to load the connecting map when the player goes onto a tile with:
- X = -1 (0xFF);
- X = map width;
- Y = -1 (0xFF);
- Y = map height.
This happens even if there isn't a connecting map in the corresponding direction. In this case the game will try to load map 255 (0xFF), which usually causes a freeze. Therefore, the tiles on those four boundaries are known as "freeze tiles". Since all the conditions are equality checks, the freeze tiles only form a one-tile thick barrier, but it still stops the player from directly stepping out of bounds.
However, it is possible to indirectly use a walk through walls glitch or cheat to go out of bounds, by using valid map connections. Since connecting maps may have different sizes, and may align at different coordinates, what is in bound (but not supposed to be accessible) for one map may become out of bound for the connecting map after making the necessary coordinate adjustments.
Another way to go out of bounds is to directly change the player's coordinate, for example with an expanded items pack, by taking a wrong warp (e.g. through the Safari Zone exit glitch), or using arbitrary code execution.
The map connection tiles or "freeze tiles" divide the entire map space into four quadrants (those names are coined by TheZZAZZGlitch):
- Mainland quadrant (in bound);
- Phantom quadrant (X coordinate out of bound);
- Glitch city quadrant (Y coordinate out of bound);
- Phantom glitch city quadrant (both X and Y out of bound).
Note that stepping from the "wrong" side onto a map connection tile still triggers the map connection or freeze. Below, we will use the word "go" liberally even though stepping over the boundary doesn't work.
Going east into the phantom quadrant, the map seems to "loop" horizontally, with each copy of the map shifted upwards by two tiles until (for small enough maps) it completely disappears. Those copies are called Phantom Cities, as warps and signs do not work there, and people cannot be found there. The player can step over the boundary between the Phantom Cities without problem, because the actual X coordinates of those boundaries are different from the real boundaries. (Since the map space itself also "loops", the out of bound area "west of" the mainland is just the eastmost part of this quadrant.)
Going south into the glitch city quadrant, at first there will be nothing but the "background tile" for the current map. Then the player will encounter an out of bounds Glitch City for a very high (very southerly) y position. (Going to the area "north of" the mainland directly puts the player into the out of bounds Glitch City.)
The phantom glitch city quadrant works similarly to the phantom quadrant: It contains copies of the "main" out of bounds Glitch City, shifted upwards by two tiles each time.
The properties of the base map in out of bound areas is related to the "tile block map". To save on space, the map data in the ROM is actually not stored as tiles, but as "tile blocks", which are 2*2 blocks of tiles. Each tile block is represented by a single byte, and they are translated into tiles only when they are displayed on screen. The translation rules depend on the current tileset.
The tile block map must be loaded into the RAM, because it may be changed by the player cutting down trees. Furthermore, there is a 3 block "padding" in each direction, so that the player doesn't see invalid data when they stand near the boundary of the in bound area. If there are any map connections, the "preview" of connecting maps are also loaded into the tile block map. Therefore, each row in the tile block map consists of (w/2 + 6) bytes, where w is the width of the map in tiles.
Since the rows are stored consecutively in the tile block buffer, this means going east (w/2 + 6) blocks is equivalent to going south one block, as far as the tile block map is concerned. Therefore going east that far gives the player a Phantom City, shifted by two tiles. The Phantom City has no warps, signs, or NPCs, because their positions are recorded as coordinates, and have nothing to do with the tile block map.
When the player goes beyond the south boundary of the mainland or a Phantom City, they will first go into the unused part of the 1300-byte tile block map, which is filled by the "background tile". After a while (the exact distance depends on the width of the map), the player goes beyond the tile map buffer and into other areas of the RAM, which undergo the block to tile translation, and display as a Glitch City.
Out of bounds Glitch Hell
Out of bounds Glitch Hell is a term for the effects of stepping out of bounds in Japanese Pokémon Red, Green and Yellow (v1.0 for Yellow) on emulators, where the screen doesn't turn white and map corruption occurs, including corruption of the player's sprite in Red/Green. Glitchy sounds may play there.
Out of bounds Glitch Hell has not been observed on a real Game Boy running later revisions of Red, Green and Yellow, so it is probably an emulation error. ('real' behavior on the initial revisions is unconfirmed)
However, it has been observed on a GBA SP running a French version of Pokémon Red.
Stepping out of bounds can easily be achieved by the tile corruption effect caused by the dokokashira door glitch if in Pallet Town the player steps near the 6th/7th posts from the bottom right and walks around until they can step through them.
In Japanese Yellow, select glitches do not work, so another walk through walls glitch such as the traditional Safari Zone walk through walls glitch must be used.
Going out of bounds may cause a number of effects that is influenced by the spot and location that the player went out of bounds from, including:
- A Glitch Dimension.
- A freeze.
- Actually taking the player to a new location without a freeze.
- A different effect, including a message box popping up.
In Pokémon Gold and Silver, if the player is taken to a new location their name may be corrupted. The Route 27 tune commonly plays in these glitch locations.
In Pokémon Crystal, instead of the player's name being corrupted, data for their party Pokémon like their names and OT, the player's number of badges, their money and items from all pockets as well as PC items may be changed. This includes the number of items in the pocket/storage system values.
The 'This Game Pak is designed only for use on the Game Boy Color.' message will appear in Pokémon Crystal if stepping out of bounds caused a Glitch Dimension, due to the register 'a' no longer being hex:11 (more information is available on the Glitch Dimension article).
Generation III's collision detection prevents the player to travel through map boundaries even with a walk through walls cheat code enabled.
It is possible to go out of bounds using cheats in Generation III for a few steps, with no noticeable effects :
- With a walk through walls cheat code enabled, go inside of the Contest Building in Lilycove City.
- Talk to the leftmost attendant either directly facing her, from the left, or from behind and enter a contest.
- The player will then walk into the black void behind the door, but unlike both previous generations, nothing will happen.
- After the player passes through the dialog, they will enter the contest normally.
- Main article: Void
In Generation IV, the player can step out of bounds using the Tweaking or Elite Four door glitch (the Elite Four door glitch only works in Japanese Diamond/Pearl). Going out of bounds is also known as entering the void.
Unlike Generation I to III, coordinates in Generation IV are global instead of map specific, so it is possible to get to many maps even including outdoor maps from indoors. There are invalid maps surrounding the space between existing maps known as Mystery Zones (Japanese HeartGold/SoulSilver: "----").
In Generation V
In Pokémon Sun and Moon, it is possible to go out of bounds in a Pokémon Center with the delivery man out of bounds glitch, but it is not possible to enter other maps. It is also possible to clip through some NPCs in several areas of the game and go out of bounds, however you cannot save your game once in this position.
Walk through walls GameShark codes
These are GameShark codes that allow the player to walk out of bounds. All of them are for English versions, but the Generation I walk through walls code works for the Japanese versions too.
Generation I core series:
Pokémon Gold and Silver:
Pokémon Crystal (thanks Xwingcmdr):