Random encounter
A battle that a random roll starts as the player moves, rather than a visible enemy.
On this page
A random encounter is a battle that a random roll starts while the player moves through the world. The Gameplay Design Patterns wiki describes random encounters as “created randomly usually from a predefined set of characteristics”, archetypically a fight with wandering monsters1. The five games in the table roll once per step to decide whether a fight starts2,3,4,5,6. Final Fantasy and the Pokémon games then roll again to pick the opponents7,8,9,10.
- ⟨pokemon-platinum has no uses entry for this page⟩
- By terrainDragon Warrior (1986). Fights come most often on sand and hills and least on open ground.2,11,12,13Dragon Warrior II (1987). Fights come most often in the mountains and least at sea.14
- By areaFinal Fantasy (1987). Fights come at random as the party walks, rarely at sea, at a rate each dungeon sets.3,7EarthBound Beginnings (1989). 32 to 5 in 256 per step by area, falling for a while after each fight.15Final Fantasy III (1990). How often battles come depends on the world the party is in and how it travels.16Final Fantasy IV (1991). How often battles come depends on the region of the world map.17Pokémon Red and Blue (1996). Each step in grass or water rolls against the map's rate in 256, then picks one of 10 slots.4,8,18Pokémon Yellow (1998). Red and Blue's per-step roll, now reading a different tile so Cinnabar's coast gives no grass encounters.19Pokémon Ruby and Sapphire (2002). 16 times the area's rate out of 2,880 per step, with bike, flute, Cleanse Tag, Stench, and Illuminate modifiers.20Pokémon Emerald (2004). 16 times the area's rate out of 2,880 per step, with bike, flute, item, and ability modifiers.6,21,10,22Pokémon FireRed and LeafGreen (2004). A step cooldown, then a roll out of 1,600 on its own generator that grows easier with each failed check.23,24Pokémon HeartGold and SoulSilver (2009). A gate set by movement, very tall grass, the radio, and turning in place, then the map's one rate; 12 slots whose species change with the time of day.25,26,27,28
- By area and timePokémon Gold and Silver (1999). The map's rate and its grass slots for morning, day, or night, then one of 7 slots.29,30Pokémon Crystal (2000). The map's rate for morning, day, or night, then one of 7 grass slots.5,9
- Area times terrainDragon Warrior III (1988). Fights come more often in harsher places, and on the world map more often at night.31,32
- Danger counterFinal Fantasy V (1992). Every step makes a battle likelier until one comes.33Final Fantasy VI (1994). Final Fantasy V's counter at half the normal rate, $70 per step.34,35,36
#How it works
on each step onto a tile that allows fights:
if a cooldown is running: count it down; no fight # the Pokémon games
if roll() < rate(map, terrain, modifiers):
opponents = weighted_pick(area_table) # slots or formations
start the battle
With a chance per step and no cooldown, the wait for the next fight is geometric and averages steps.
| Chance per step | Changed by | Opponents | Grace after a fight | |
|---|---|---|---|---|
| Dragon Warrior | 1/8 · 1/16 · 1/32 or 1/162,2 | terrain and position; halved or quartered near Tantegel11 | — | — |
| Final Fantasy | 10 in 256 per step (3 at sea)3 on the overworld; a per-map rate elsewhere3 | the ship3 | 8 formations, 12 · 12 · 12 · 12 · 6 · 6 · 3 · 1 (of 64)7,7 | — |
| Red and Blue | the map’s rate in 256, 25 on Route 14 | grass or water4 | 10 slots, 51 · 51 · 39 · 25 · 25 · 25 · 13 · 13 · 11 · 3 (of 256)8,8 | a counter of 3 steps18 |
| Crystal | the map’s rate for the time of day, 25 in 256 on Route 295 | radio music, Cleanse Tag5 | 7 slots, 30 · 30 · 20 · 10 · 5 · 4 · 1 %9,9 | — |
| Emerald | 16 × rate in 2,880 per step6,6 | bikes, flutes, Cleanse Tag, lead ability; a change of tile type6,21 | 12 slots, 20 · 20 · 10 · 10 · 10 · 10 · 5 · 5 · 4 · 4 · 1 · 1 %10,10 | 4 checks22 |
#Implementations
#Dragon Warrior
Each step on the map draws a byte and starts a fight when the bits the terrain selects are all 02. Hills and sand use 3 bits, 1 in 8; swamp, forest, brick, and barrier squares use 4, 1 in 162. Other ground uses 5 bits where the X and Y coordinates are both even or both odd, and 4 elsewhere, so open plains alternate between 1 in 32 and 1 in 162. Around Tantegel Castle a second byte lets only half of those fights through, and a quarter on hills11.
The NES manual tells a different story. It says monsters come out to attack and that “If you happen to bump into one of them, the game will automatically enter the fight mode”12. The map holds no monsters to bump into; the per-step roll starts every fight2. The manual’s terrain guide does match the code’s order: fewer monsters on plains, more in forests, and “many enemies” in the hills it calls mountains13,2.
#Dragon Warrior II and III
The North American Dragon Warrior II gives each terrain one rate, 4/255 (sea) to 25/255 (mountains) per step14, against a random byte from 1 to 255, where Dragon Warrior tests the bits the terrain selects14,2. Below map $2B, only the world map and Moonbrooke have encounters14. The North American Dragon Warrior III multiplies the terrain’s odds by a factor from the area’s encounter class, for up to 100/256 per step; higher at night31,31. Carrying the Golden Claw sets the odds to 10031.
#Final Fantasy
On the overworld, a step onto a tile marked for fights starts a battle when the battle-step generator returns less than 10, or less than 3 aboard the ship3. In dungeons and towns the threshold comes from a table with one rate per map3. A second counter then indexes the same 256-byte table to pick one of the area’s 8 formations, weighted 12 · 12 · 12 · 12 · 6 · 6 · 3 · 1 (of 64)7,7.
That table holds every byte once, and the step generator walks it one entry per call37,38. The overworld rate therefore holds exactly over each pass of 256 draws, as well as on average. The formation weights are exact in the same way over 256 battles7.
#Final Fantasy III to VI
Final Fantasy III loads a world-map rate for each world and vehicle, 5 in 256 per step (7 underwater)16,16. Those rates come from the listing’s comments, because the data bytes aren’t in the listing and no Japanese ROM is on hand to read them16. Final Fantasy IV reads its overworld rate, 7–10 in 256 per step17, from an 8 × 8 grid of map regions, against a byte from a fixed random table plus an offset that grows each time the step counter wraps17.
Final Fantasy V adds the map’s rate to a counter on each step, $E0 at the normal rate, and starts a battle when a random byte is under the counter’s high byte33. Final Fantasy VI keeps that counter and halves the normal rate to $70 per step35,33. A battle clears the counter, so each step without one makes the next likelier34. On Final Fantasy VI’s world map, a bug the disassembly marks keeps the battle rate and group of an old position until a battle, an event, an entrance, or the world map’s start updates them36.
#Pokémon Red and Blue
On each step in grass or water, TryDoWildEncounter starts a battle when the byte hRandomAdd is below the map’s rate4. Route 1’s grass rate is 25, so a step in its grass starts a battle 25 times in 2564. The byte hRandomSub, from the same generator step, then picks one of the map’s 10 slots with chances 51 · 51 · 39 · 25 · 25 · 25 · 13 · 13 · 11 · 3 (of 256)8,8. After a battle, a counter of 3 steps holds off the next wild battle18.
Pokémon Yellow’s TryDoWildEncounter tests the bottom-left tile of the player’s half-block where Red and Blue test the bottom-right, so “left shore” half-blocks such as Cinnabar Island’s east coast no longer load grass encounters19.
#Pokémon Crystal
Crystal gives each grass area three rates, for morning, day, and night, and uses a separate water rate5. The Pokémon March and the Ruins of Alph radio double the rate; the Pokémon Lullaby and a Cleanse Tag in the party halve it5. A second roll from 1 to 100 picks one of 7 grass slots9.
Pokémon Gold and Silver already have these rates, modifiers, and slots, which Crystal keeps unchanged29,30.
#Pokémon Emerald
Emerald multiplies each area’s rate by 16 and compares it with Random() % 2880, after modifiers for the Mach and Acro Bikes, flutes, a Cleanse Tag, and the lead Pokémon’s ability6. Route 101’s rate of 20 gives 320 in 2,880, 1 in 96. A step onto a tile whose behavior differs from the last one skips the check 40% of the time21. After a battle starts, and whenever a map loads, the next 4 checks are skipped22.
Pokémon Ruby and Sapphire use the same roll out of 2,880, with bike, flute, Cleanse Tag, Stench, and Illuminate modifiers; Emerald adds more ability modifiers20,6. Pokémon FireRed and LeafGreen roll on a generator of their own, and a check passes when its value mod 1,600 is below 16 times the area’s rate plus part of a buff that every failed check raises23. Before that roll, they require a minimum number of steps since the last battle, letting a check through earlier only on a 5-in-100 roll24.
#EarthBound Beginnings
In the English build of EarthBound Beginnings, each step in an area with encounters starts a fight at 32/256 to 5/256 per step15, set by the area’s frequency class plus a counter15. Each encounter raises the counter, so the rate drops after fights until the player enters an area without encounters or passes a fade-out15. Red and Blue instead hold off the next battle with a counter of 3 steps18.
#Variants and combinations
- Fleeing is the usual exit from a fight the player didn’t choose. Dragon Warrior tests it with Agility, and the Pokémon games with Speed39,40.
- Random number generators decide how a rate plays out. Red and Blue read the generator’s two bytes, Final Fantasy walks a permuted table, and Emerald calls an LCG4,38,41.
#History
The games read here run from Dragon Quest (Famicom, 1986) to Emerald (2004)42,43. The Gameplay Design Patterns wiki names early editions of Dungeons & Dragons among the games with random encounters1.
Games
| Game | Year | How | Note |
|---|---|---|---|
| Dragon Warrior | 1986 | By terrain | fights come most often on sand and hills and least on open ground |
| Dragon Warrior II | 1987 | By terrain | fights come most often in the mountains and least at sea |
| Final Fantasy | 1987 | By area | fights come at random as the party walks, rarely at sea, at a rate each dungeon sets |
| EarthBound Beginnings | 1989 | By area | 32 to 5 in 256 per step by area, falling for a while after each fight |
| Final Fantasy III | 1990 | By area | how often battles come depends on the world the party is in and how it travels |
| Final Fantasy IV | 1991 | By area | how often battles come depends on the region of the world map |
| Pokémon Red and Blue | 1996 | By area | each step in grass or water rolls against the map's rate in 256, then picks one of 10 slots |
| Pokémon Yellow | 1998 | By area | Red and Blue's per-step roll, now reading a different tile so Cinnabar's coast gives no grass encounters |
| Pokémon Ruby and Sapphire | 2002 | By area | 16 times the area's rate out of 2,880 per step, with bike, flute, Cleanse Tag, Stench, and Illuminate modifiers |
| Pokémon Emerald | 2004 | By area | 16 times the area's rate out of 2,880 per step, with bike, flute, item, and ability modifiers |
| Pokémon FireRed and LeafGreen | 2004 | By area | a step cooldown, then a roll out of 1,600 on its own generator that grows easier with each failed check |
| Pokémon HeartGold and SoulSilver | 2009 | By area | a gate set by movement, very tall grass, the radio, and turning in place, then the map's one rate; 12 slots whose species change with the time of day |
| Pokémon Gold and Silver | 1999 | By area and time | the map's rate and its grass slots for morning, day, or night, then one of 7 slots |
| Pokémon Crystal | 2000 | By area and time | the map's rate for morning, day, or night, then one of 7 grass slots |
| Dragon Warrior III | 1988 | Area times terrain | fights come more often in harsher places, and on the world map more often at night |
| Final Fantasy V | 1992 | Danger counter | every step makes a battle likelier until one comes |
| Final Fantasy VI | 1994 | Danger counter | Final Fantasy V's counter at half the normal rate, $70 per step |
Every claim about this mechanic, by game (43)
References
- ^ abThe Gameplay Design Patterns wiki describes random encounters as encounters "created randomly usually from a predefined set of characteristics", archetypically a fight with wandering monsters, and names early editions of Dungeons & Dragons as an example.WikiGameplay Design Patterns wiki, “Ephemeral Goals”
How we know
These encounters are, as the name suggests, created randomly usually from a predefined set of characteristics. The archetypical random encounter is to defeat a group of wandering monsters or enemies. … Many Tabletop and Computer-based Roleplaying Games use random encounters during the gameplay, e.g. early editions of Dungeons & Dragons and the Elder Scrolls series.
Examples · archived copy ↗ The quote matches our archived copy.
- ^ abcdefghijEach step on the map draws a byte and starts a fight when its masked bits are all 0: 1 in 8 on sand and hills, 1 in 16 in swamp, forest, brick, and barrier squares, and on other terrain 1 in 32 where the X and Y coordinates are both even or both odd, 1 in 16 elsewhere.Codenmikstas/dragon-warrior-disassembly
How we know
1888LCDA2: JSR UpdateRandNum ;($C55B)Get random number.source_files/Bank03.asm lines 1887–1888 at ebe6a13 · upstream ↗ 1949LCDFB: LDA #$0F ;Get random number. ⋮ 1952LCDFD: AND RandNumUB ;Is lower nibble 0? 1953LCDFF: BEQ DoRandomFight ;If so, branch to start a random fight. ⋮ 1957LCE02: CMP #BLK_SAND ;Is the player on a sand block? ⋮ 1960LCE06: CMP #BLK_HILL ;Is the player on a hill block? ⋮ 1968LCE13: LDA #$07 ;Twice as likely to get into a fight in the sandy areas! ⋮ 1972LCE17: CMP #BLK_TREES ;Is player on a tree block? ⋮ 1975LCE1B: CMP #BLK_BRICK ;Is player on a brick block? ⋮ 1978LCE1F: CMP #BLK_FFIELD ;Is player on a force field block?
source_files/Bank03.asm lines 1948–1981 at ebe6a13 · upstream ↗ 2025LCE63: LDA CharXPos ;Is character on an odd X map position? ⋮ 2040LCE74: LDA #$1F ;Higher chance for fight. Check 5 bits instead of 4.
source_files/Bank03.asm lines 2020–2045 at ebe6a13 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefgOn the overworld, a step onto a tile marked for fights starts a battle when the battle-step generator returns less than 10, or less than 3 aboard the ship; in dungeons and towns the threshold is a per-map rate.CodeDisch, FF1 disassembly
How we know
1187 @Fighting: 1188 LDA #10 ; 10 / 256 chance of getting in a random encounter normally ⋮ 1192 LDA #3 ; ... 3 / 256 chance instead (more infrequent battles at sea) ⋮ 1195 JSR BattleStepRNG ; get a random number for battle steps 1196 CMP tmp ; compare it to our chance 1197 BCC @DoEncounter ; if the random number < our odds -- do a random encounter
Final Fantasy Disassembly/bank_0F.asm lines 1187–1197 at cbb87d3 · upstream ↗ 3298SMMove_Battle: ⋮ 3302 JSR BattleStepRNG ; get a pseudo-random number from the battle step RNG 3303 CMP battlerate ; if that number is >= the battle rate for this map...
Final Fantasy Disassembly/bank_0F.asm lines 3298–3304 at cbb87d3 · upstream ↗ 3756 LDA lut_BattleRates+1, X ; get this map's rate (+1 because first entry is for overworld [unused]) 3757 STA battlerate ; and record it
Final Fantasy Disassembly/bank_0F.asm lines 3756–3757 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefgOn each step in grass or water,
TryDoWildEncounterstarts a wild battle when the bytehRandomAddis below the map's encounter rate, out of 256; Route 1's grass rate is 25.Codepret/pokeredHow we know
26; determine if wild pokemon can appear in the half-block we're standing in ⋮ 32 ld a, [wGrassRate] 33 jr z, .CanEncounter ⋮ 37 jr z, .CanEncounter ⋮ 47 ld a, [wGrassRate] 48.CanEncounter 49; compare encounter chance with a random number to determine if there will be an encounter 50 ld b, a 51 ldh a, [hRandomAdd] 52 cp b 53 jr nc, .CantEncounter2
engine/battle/wild_encounters.asm lines 26–53 at af51989 · upstream ↗ 1Route1WildMons: 2 def_grass_wildmons 25 ; encounter rate
data/wild/maps/Route1.asm lines 1–2 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefOn each step,
TryWildEncounterstarts a battle whenRandomis below the map's rate for the time of day (morning, day, or night) or its water rate; the Pokémon March or Ruins of Alph radio doubles the rate, and the Pokémon Lullaby or a Cleanse Tag in the party halves it.Codepret/pokecrystalHow we know
195.EncounterRate: 196 call GetMapEncounterRate 197 call ApplyMusicEffectOnEncounterRate 198 call ApplyCleanseTagEffectOnEncounterRate 199 call Random 200 cp b 201 ret ⋮ 214 ret ⋮ 217; Pokemon March and Ruins of Alph signal double encounter rate. 218; Pokemon Lullaby halves encounter rate. ⋮ 227 ret ⋮ 231 ret ⋮
engine/overworld/wildmons.asm lines 195–250 at 97187cd · upstream ↗ 1237 def_grass_wildmons ROUTE_29 1238 db 10 percent, 10 percent, 10 percent ; encounter rates: morn/day/nite
data/wild/johto_grass.asm lines 1237–1238 at 97187cd · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefghOn each step onto grass or water,
WildEncounterCheckmultiplies the area's rate by 16, applies bike, flute, Cleanse Tag, and lead-ability modifiers, and starts a battle whenRandom() % 2880is below it; Route 101's rate is 20.Codepret/pokeemeraldHow we know
495 if (Random() % MAX_ENCOUNTER_RATE < encounterRate) ⋮ 497 else ⋮ 504 encounterRate *= 16; 505 if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) 506 encounterRate = encounterRate * 80 / 100; 507 ApplyFluteEncounterRateMod(&encounterRate); 508 ApplyCleanseTagEncounterRateMod(&encounterRate); ⋮ 515 else if (ability == ABILITY_STENCH) 516 encounterRate /= 2; 517 else if (ability == ABILITY_ILLUMINATE) 518 encounterRate *= 2; ⋮ 520 encounterRate /= 2; ⋮
src/wild_encounter.c lines 493–529 at 731ad5b · upstream ↗ 27#define MAX_ENCOUNTER_RATE 2880src/wild_encounter.c line 27 at 731ad5b · upstream ↗ 39 "map": "MAP_ROUTE101", ⋮ 42 "encounter_rate": 20,
src/data/wild_encounters.json lines 39–42 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefg
GetBattleFormationpicks one of the area's 8 formations by indexinglut_RNGwith a counter that rises by 1 per battle; the low 6 bits select formations 0–3 with 12 chances in 64 each, 4 and 5 with 6, 6 with 3, and 7 with 1.CodeDisch, FF1 disassemblyHow we know
1293 INC battlecounter ; increment the battle counter 1294 LDX battlecounter ; and put it in X 1295 LDA lut_RNG, X ; use it as seed to get a random number ⋮ 1297 AND #$3F ; drop the 2 high bits of the random number 1298 TAX ; and put in X 1299 LDY lut_FormationWeight, X ; use that to index the formation weight LUT to know which formation to use
Final Fantasy Disassembly/bank_0F.asm lines 1293–1299 at cbb87d3 · upstream ↗ 1357lut_FormationWeight: 1358 .BYTE 0,0,0,0,0,0, 0,0,0,0,0,0 ; 12/64 chance of formation 0 ⋮ 1365 .BYTE 7 ; 1/64
Final Fantasy Disassembly/bank_0F.asm lines 1357–1365 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdefThe byte
hRandomSubthen picks one of the map's 10 slots, which have 51, 51, 39, 25, 25, 25, 13, 13, 11, and 3 chances in 256.Codepret/pokeredHow we know
54 ldh a, [hRandomSub] 55 ld b, a 56 ld hl, WildMonEncounterSlotChances
engine/battle/wild_encounters.asm lines 54–62 at af51989 · upstream ↗ 17 wild_chance 51 ; 51/256 = 19.9% chance of slot 0 ⋮ 26 wild_chance 3 ; 3/256 = 1.2% chance of slot 9
data/wild/probabilities.asm lines 11–28 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdeA second
Randomfrom 1 to 100 picks one of a grass area's 7 slots, at 30, 30, 20, 10, 5, 4, and 1 percent, or one of 3 water slots at 60, 30, and 10 percent.Codepret/pokecrystalHow we know
6GrassMonProbTable: ⋮ 8 mon_prob 30, 0 ; 30% chance ⋮ 14 mon_prob 100, 6 ; 1% chance ⋮ 17WaterMonProbTable: ⋮ 19 mon_prob 60, 0 ; 60% chance
data/wild/probabilities.asm lines 6–21 at 97187cd · upstream ↗ 274.randomloop 275 call Random 276 cp 100 277 jr nc, .randomloop 278 inc a ; 1 <= a <= 100
engine/overworld/wildmons.asm lines 274–278 at 97187cd · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdEmerald's 12 land slots come up 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, and 1 percent of the time.Codepret/pokeemerald
How we know
8 "type": "land_mons", 9 "encounter_rates": [ 10 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1
src/data/wild_encounters.json lines 7–11 at 731ad5b · upstream ↗ 182static u8 ChooseWildMonIndex_Land(void) ⋮ 184 u8 rand = Random() % ENCOUNTER_CHANCE_LAND_MONS_TOTAL;
src/wild_encounter.c lines 182–186 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcOn the overworld's zone 0, the slime-only region around Tantegel Castle, a second byte lets only half of those fights through, and a quarter on hills.Codenmikstas/dragon-warrior-disassembly · Ryan8bit, DW Formulas
How we know
2095LCEBD: AND #$0F ;data from OvrWrldEnGrid. 2096LCEBF: BNE GetEnemyRow ; ⋮ 2106LCECC: AND #$03 ;Do another check to avoid the fight. 25% chance the fight 2107LCECE: BEQ GetEnemyRow ;may not happen. Is fight going to happen? ⋮ 2112LCED3: AND #$01 ;Do another check to avoid the fight. 50% chance the fight
source_files/Bank03.asm lines 2093–2114 at ebe6a13 · upstream ↗ In the zones where you fight only Slimes and Red Slimes around Tantegel (which I call Zone 0), the encounter rates are significantly lower.
II.A, Encounters · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abThe NES manual describes encounters as meeting a monster on the map: "If you happen to bump into one of them, the game will automatically enter the fight mode."ManualDragon Warrior NES manual
How we know
When you leave a castle or town, lots of monsters will come out to attack you. If you happen to bump into one of them, the game will automatically enter the fight mode.
p. 13, Entering Commands During Fighting Mode · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abThe NES manual's terrain guide says fewer monsters live on plains, more lurk in forests, and mountains bring "many enemies".ManualDragon Warrior NES manual
How we know
You can walk about normally as fewer monsters live here.
p. 16, Getting to Know the Terrain · archived copy ↗ But more monsters are lurking here.
p. 16, Forests · archived copy ↗ Mountains will slow you down a bit. More importantly you'll come across many enemies.
p. 17, Mountains · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcdIn Dragon Warrior II (the North American NES release), each step draws a random byte from 1 to 255 and starts a fight when the terrain's rate is at least that byte: on the world map 10 on grass, 16 in forest, desert, and swamp, 25 on mountains, and 4 at sea; 8 on maps numbered $2B and up and in Moonbrooke, while the other maps below $2B have none.CodeNathan-R-Og/dq2 · “Dragon Warrior II (USA)”revised
How we know
54B04_802D: 55 jsr B0F_C3AB ; generate a random number and store it in $32-$33 (two passes)
src/us/prg/bank4.asm lines 54–58 at 0fb64a4 · upstream ↗ 63 cmp #$01 ; Map ID #$01: World Map ⋮ 65 cmp #$09 ; Map ID #$09: Moonbrooke ⋮ 68 sbc #$2B ; aside from the world map and Moonbrooke, map IDs < #$2B do not have random encounters 69 bcc B04_806D ; no encounter
src/us/prg/bank4.asm lines 62–69 at 0fb64a4 · upstream ↗ 161 lda B04_832C, x ; per-terrain encounter rates 162 cmp $32 ; RNG byte 0; compare to previously generated non-zero number 163 bcc B04_806D ; no encounter; encounter rate < RNG => no encounter
src/us/prg/bank4.asm lines 159–163 at 0fb64a4 · upstream ↗ 648B04_832C: 649.byte $0A ; Terrain ID #$00: Grass ⋮ 651.byte $08 ; Terrain ID #$02: Dungeon, Lava, Tower, Castle 652.byte $04 ; Terrain ID #$03: Sea 653.byte $10 ; Terrain ID #$04: Forest, Desert 654.byte $19 ; Terrain ID #$05: Mountain 655.byte $10 ; Terrain ID #$06: Swamp
src/us/prg/bank4.asm lines 648–656 at 0fb64a4 · upstream ↗ In the cartridge (“Dragon Warrior II (USA)”): bank 4 $832C, the eight rates as the ROM has them. We don't reproduce the bytes.
Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcdIn EarthBound Beginnings (English build), each step in an area with encounters starts a fight when a random byte is below a rate from the table 32, 21, 16, 13, 10, 8, 6, 5 (in 256), indexed by the area's frequency class (1–7) plus a counter, capped at the eighth entry. The counter rises by 1 with each encounter, up to 2, so the rate drops after fights; it returns to 0 in areas without encounters and after a fade-out transition.CodeNathan-R-Og/mother · “EarthBound Beginnings (USA, Europe) (Virtual Console)”
How we know
560DoWalkingStep: ⋮ 579 ;get areaEncounterDef based on area 580 ldx map_area 581 lda AREA_ENCOUNTER_LIST, x ⋮ 586 ;else, write 0 587 sta UNK_24
src/global/prg/title.asm lines 560–594 at e0b3e3f · upstream ↗ 615 @EncounterFrequencyExists: 616 clc ⋮ 618 ;if frequency is >= 9, cap it to 8 619 adc UNK_24 620 cmp #9 621 bcc @NoForceCap 622 lda #8 ⋮ 627 ;get a random value 628 jsr RNG_BYTE ⋮ 631 cmp AREA_FREQ_TABLE-1, x 632 ;if random value >= area_freq_table[x], leave 633 bcs @FrequencyFail ⋮
src/global/prg/title.asm lines 614–645 at e0b3e3f · upstream ↗ 694 AREA_FREQ_TABLE: 695 ;lookup table for frequencies 696 .byte 32,21,16,13,10,8,6,5
src/global/prg/title.asm lines 694–696 at e0b3e3f · upstream ↗ In the cartridge (“EarthBound Beginnings (USA, Europe) (Virtual Console)”): bank $14 $B58B, the eight rates as the ROM has them. We don't reproduce the bytes.
2761 ;fade out 2762B30_0b57: 2763 jsr BANKSET_H13 2764 jsr OverworldTransitionIntepreter ⋮ 2770 lda #0 2771 sta UNK_24
src/global/prg/constant.asm lines 2761–2771 at e0b3e3f · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abcdOn the world map, a step starts a battle when a random byte is under the rate loaded for the current world and vehicle; the listing's comments give those rates as 5 on foot, by canoe, or by ship, 7 underwater, and 18 for one chocobo case the disassembly marks with "???".Codeeverything8215, FF3 disassemblyrevised
How we know
46599; [ check random battle ] ⋮ 466183D/BC75: AD 47 9D LDA $9D47 ; 2E/9D47 (no vehicle battle rate: 5) ⋮ 466213D/BC7C: AD 48 9D LDA $9D48 ; 2E/9D48 (canoe battle rate: 5) ⋮ 466243D/BC83: AD 49 9D LDA $9D49 ; 2E/9D49 (ship battle rate: 5) ⋮ 466503D/BCB8: AD 4E 9D LDA $9D4E ; 2E/9D4E (chocobo ??? battle rate: 18) ⋮ 466553D/BCC2: AD 4F 9D LDA $9D4F ; 2E/9D4F (underwater battle rate: 7) 466563D/BCC5: 85 80 STA $80 466573D/BCC7: 20 11 C7 JSR $C711 ; get random number 466583D/BCCA: C5 80 CMP $80 466593D/BCCC: 90 03 BCC $BCD1 ; battle if (0..255) < (battle rate)
ff3j.asm lines 46599–46659 at 1acef81 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcOn the overworld, each step reads a rate from an 8 × 8 grid of map regions (7, 8, or 10) and starts a battle when a byte from a fixed random table, plus an offset that grows by $11 each time the step counter wraps, is below it.Codeeverything8215, FF4 disassembly
How we know
19OverworldBattleRate: 20 .byte 10,10,10, 8, 8,10,10,10 21 .byte 10,10,10, 8, 8,10,10,10 22 .byte 10,10,10, 8, 8,10,10,10 23 .byte 10,10, 7, 8, 8, 8,10,10 24 .byte 8, 8, 7, 7, 8, 8,10,10 25 .byte 8, 8, 7, 7, 8,10,10,10 26 .byte 8, 8, 8, 8, 8,10,10,10 27 .byte 8, 8, 8, 8, 8,10,10,10
field/rand_battle.asm lines 19–27 at a360e2e · upstream ↗ 96@8b6b: inc $88 97 inc $86 98 bne @8b7a 99 lda $17ef 100 clc 101 adc #$11 102 sta $17ef ⋮ 106; overworld ⋮ 110 sta $06 ⋮ 113 clc ⋮ 115 tax 116 lda f:OverworldBattleRate,x ⋮
field/rand_battle.asm lines 93–129 at a360e2e · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abcdAfter a battle,
EnterMapsets a counter of 3 that each step decrements, and no wild battle can start while it is above 0.Codepret/pokeredHow we know
13 bit BIT_WILD_ENCOUNTER_COOLDOWN, [hl] 14 jr z, .skipGivingThreeStepsOfNoRandomBattles 15 ld a, 3 ; minimum number of steps between battles 16 ld [wNumberOfNoRandomBattleStepsLeft], a 17.skipGivingThreeStepsOfNoRandomBattles
home/overworld.asm lines 12–17 at af51989 · upstream ↗ 69 ld hl, wStatusFlags2 70 set BIT_WILD_ENCOUNTER_COOLDOWN, [hl]
engine/battle/end_of_battle.asm lines 69–70 at af51989 · upstream ↗ 6661 ld a, [wNumberOfNoRandomBattleStepsLeft] 6662 and a 6663 ret nz
engine/battle/core.asm lines 6661–6663 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abYellow's
TryDoWildEncountertests the bottom-left tile of the player's half-block where Red and Blue test the bottom-right, so “left shore” half-blocks, such as Cinnabar Island's east coast, no longer load grass encounters; the rest of the routine is unchanged.Codepret/pokeyellow · pret/pokeredHow we know
27; is the bottom left tile (8,9) of the half-block we're standing in a grass/water tile? 28; note that by using the bottom left tile, this prevents the "left-shore" tiles from generating grass encounters 29 hlcoord 8, 9
engine/battle/wild_encounters.asm lines 27–29 at b6696f2 · upstream ↗ 27; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? 28 hlcoord 9, 9 29 ld c, [hl] 30 ld a, [wGrassTile] 31 cp c 32 ld a, [wGrassRate] 33 jr z, .CanEncounter 34 ld a, $14 ; in all tilesets with a water tile, this is its id 35 cp c 36 ld a, [wWaterRate] 37 jr z, .CanEncounter
engine/battle/wild_encounters.asm lines 27–37 at af51989 · upstream ↗ 66 ld hl, wGrassMons 67 lda_coord 8, 9 68 cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? 69 jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default 70 ld hl, wWaterMons 71; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not, 72; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
engine/battle/wild_encounters.asm lines 64–72 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-25.
Checked by a second AI model, 2026-10-21.
Checked by a second AI model, 2026-10-25.
- ^ abRuby and Sapphire multiply the area's encounter rate by 16, cut it to 80% on the Mach or Acro Bike, apply the flute and Cleanse Tag modifiers, halve it for a lead with Stench and double it for Illuminate, cap it at 2,880, and start a battle when
Random() % 2880is below it. Emerald keeps the roll and adds more ability modifiers.Codepret/pokeruby · pret/pokeemeraldrevisedHow we know
21#define MAX_ENCOUNTER_RATE 2880src/wild_encounter.c line 21 at 5784633 · upstream ↗ 377static bool8 DoWildEncounterRateDiceRoll(u16 encounterRate) ⋮ 379 if (Random() % MAX_ENCOUNTER_RATE < encounterRate)
src/wild_encounter.c lines 377–381 at 5784633 · upstream ↗ 403static bool8 DoWildEncounterTest(u32 encounterRate, bool8 ignoreAbility) ⋮ 405 encounterRate *= 16; 406 if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) 407 encounterRate = encounterRate * 80 / 100; 408 ApplyFluteEncounterRateMod(&encounterRate); 409 ApplyCleanseTagEncounterRateMod(&encounterRate); ⋮ 416 if (ability == ABILITY_STENCH) 417 encounterRate /= 2; 418 if (ability == ABILITY_ILLUMINATE) 419 encounterRate *= 2; ⋮ 422 if (encounterRate > MAX_ENCOUNTER_RATE) 423 encounterRate = MAX_ENCOUNTER_RATE; ⋮
src/wild_encounter.c lines 403–424 at 5784633 · upstream ↗ 495 if (Random() % MAX_ENCOUNTER_RATE < encounterRate) ⋮ 526 if (encounterRate > MAX_ENCOUNTER_RATE) 527 encounterRate = MAX_ENCOUNTER_RATE;
src/wild_encounter.c lines 495–527 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcA step onto a tile whose behavior differs from the last one skips the encounter check 40% of the time.Codepret/pokeemerald
How we know
531// When you first step on a different type of metatile, there's a 40% chance it 532// skips the wild encounter check entirely. 533static bool8 AllowWildCheckOnNewMetatile(void) ⋮ 535 if (Random() % 100 >= 60) 536 return FALSE;
src/wild_encounter.c lines 531–539 at 731ad5b · upstream ↗ 599 else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) 600 return FALSE; ⋮ 602 return FALSE;
src/wild_encounter.c lines 599–602 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abcAfter a battle starts, and whenever a map loads, the next 4 encounter checks are skipped.Codepret/pokeemerald
How we know
662void RestartWildEncounterImmunitySteps(void) ⋮ 664 // Starts at 0 and counts up to 4 steps. 665 sWildEncounterImmunitySteps = 0; ⋮ 670 if (sWildEncounterImmunitySteps < 4) ⋮ 672 sWildEncounterImmunitySteps++;
src/field_control_avatar.c lines 662–675 at 731ad5b · upstream ↗ 369 SetMainCallback2(CB2_InitBattle); 370 RestartWildEncounterImmunitySteps();
src/battle_setup.c lines 369–370 at 731ad5b · upstream ↗ 800 RestartWildEncounterImmunitySteps();src/overworld.c line 800 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ abFireRed and LeafGreen roll encounters on their own generator, , seeded at a new game; a check passes when its value mod 1,600 is below 16 times the area's rate, cut to 80% on a bike, plus 16/200 of a buff to which every failed check adds the area's rate, reset by a battle or a Repel.Codepret/pokefireredrevised
How we know
20#define MAX_ENCOUNTER_RATE 1600src/wild_encounter.c line 20 at ce6406d · upstream ↗ 304 if (WildEncounterRandom() % MAX_ENCOUNTER_RATE < encounterRate) ⋮ 311 encounterRate *= 16; 312 if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) 313 encounterRate = encounterRate * 80 / 100; 314 encounterRate += sWildEncounterData.encounterRateBuff * 16 / 200;
src/wild_encounter.c lines 302–314 at ce6406d · upstream ↗ 372 if (DoWildEncounterRateTest(gWildMonHeaders[headerId].landMonsInfo->encounterRate, FALSE) != TRUE) ⋮ 374 AddToWildEncounterRateBuff(gWildMonHeaders[headerId].landMonsInfo->encounterRate);
src/wild_encounter.c lines 372–374 at ce6406d · upstream ↗ 667static u16 WildEncounterRandom(void) ⋮ 669 sWildEncounterData.rngState = ISO_RANDOMIZE2(sWildEncounterData.rngState); 670 return sWildEncounterData.rngState >> 16;
src/wild_encounter.c lines 667–671 at ce6406d · upstream ↗ 18#define RAND_MULT 1103515245 ⋮ 20#define ISO_RANDOMIZE2(val)(RAND_MULT * (val) + 12345)
include/random.h lines 18–20 at ce6406d · upstream ↗ 778static void AddToWildEncounterRateBuff(u8 encounterRate) ⋮ 780 if (VarGet(VAR_REPEL_STEP_COUNT) == 0) 781 sWildEncounterData.encounterRateBuff += encounterRate; 782 else 783 sWildEncounterData.encounterRateBuff = 0;
src/wild_encounter.c lines 778–784 at ce6406d · upstream ↗ 103 SeedWildEncounterRng(Random());src/new_game.c line 103 at ce6406d · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abBefore that roll, FireRed and LeafGreen require a minimum number of steps since the last battle, 8 − ⌊rate/10⌋ (0 at a rate of 80 or more, 8 below 10), and before then let a check through only on a 5-in-100 roll; the flutes, a Cleanse Tag, and the lead's Stench or Illuminate scale both numbers.Codepret/pokefirered
How we know
682 if (gWildMonHeaders[headerIdx].landMonsInfo->encounterRate >= 80) 683 return 0; 684 if (gWildMonHeaders[headerIdx].landMonsInfo->encounterRate < 10) 685 return 8; 686 return 8 - (gWildMonHeaders[headerIdx].landMonsInfo->encounterRate / 10);
src/wild_encounter.c lines 682–686 at ce6406d · upstream ↗ 717 minSteps *= 256; 718 encRate = 5 * 256; ⋮ 749 if (sWildEncounterData.stepsSinceLastEncounter >= minSteps) 750 return TRUE; 751 sWildEncounterData.stepsSinceLastEncounter++; 752 if ((Random() % 100) < encRate) 753 return TRUE;
src/wild_encounter.c lines 716–755 at ce6406d · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^When a step ends on grass or water, HeartGold and SoulSilver roll twice, each
LCRandom() % 100. The first roll must fall below a gate that starts at 40, loses 20 unless the player is cycling or surfing or an unnamed avatar check (sub_0205DE98, still assembly) passes, gains 40 in very tall grass or else 30 when cycling, gains 30, 40, or 60 once a counter of reversed facings (reverseTurnFrameSteps) reaches 2, 3, or 4, and gains or loses 25 for the Pokémon March or the Pokémon Lullaby on the radio, capped at 100. The second must fall below the map's own rate for that terrain, capped at 100. A check comes only once a step counter (encounterInhibitSteps), which a wild battle or a warp clears, is past 3. Platinum's gate is 40, plus 30 in very tall grass or when cycling, adjusted on special dates, with no walking penalty, facing counter, or radio. Before its gate, Platinum adds a grace roll: while its count of attempts is below for the rate it is passed (computed), each attempt adds 1 to the count and goes on only ifLCRNG_RandMod(100)is below 5; a comment says this covers the first attempts after each map transition or wild battle. HeartGold and SoulSilver's check has no such roll; they skip the check outright while the step counter is 3 or less.Codepret/pokeheartgold · pret/pokeplatinumrevisedHow we know
565static BOOL FieldSystem_EncounterRateRoll(FieldSystem *fieldSystem, u8 encounterRate, u8 metatileBehavior) { 566 if (encounterRate > 100) { 567 encounterRate = 100; ⋮ 569 int avatarState = PlayerAvatar_GetState(fieldSystem->playerAvatar); 570 u8 modifiedRate = 40; 571 if (avatarState != PLAYER_STATE_CYCLING && avatarState != PLAYER_STATE_SURFING && !sub_0205DE98(fieldSystem->playerAvatar)) { 572 modifiedRate -= 20; ⋮ 574 if (MetatileBehavior_IsVeryTallGrass(metatileBehavior)) { 575 modifiedRate += 40; 576 } else if (avatarState == PLAYER_STATE_CYCLING) { 577 modifiedRate += 30; ⋮ 579 modifiedRate += getStepCountEncounterRateBoost(fieldSystem->reverseTurnFrameSteps); ⋮
src/field/encounter_check.c lines 565–590 at 6988158 · upstream ↗ 595static u8 getStepCountEncounterRateBoost(u16 stepCount) { ⋮ 598 if (stepCount >= 4) { 599 result = 60; 600 } else if (stepCount >= 3) { 601 result = 40; 602 } else if (stepCount >= 2) { 603 result = 30;
src/field/encounter_check.c lines 595–607 at 6988158 · upstream ↗ 623static BOOL FieldSystem_SecondEncounterRoll(FieldSystem *fieldSystem, u16 encounterRate) { ⋮ 626 if (LCRandRange(100) < encounterRate) {
src/field/encounter_check.c lines 623–627 at 6988158 · upstream ↗ 30static inline u16 LCRandRange(const u16 maximum) { ⋮ 35 u16 result = LCRandom() % maximum;
include/math_util.h lines 30–35 at 6988158 · upstream ↗ 1397static void FieldSystem_UpdateTurnFrameCounter(FieldSystem *fieldSystem) { 1398 u8 facingDirection = PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar); ⋮ 1401 case DIR_NORTH: 1402 if (fieldSystem->lastFacingDirection == DIR_SOUTH) { 1403 isTurnFrame = TRUE; ⋮ 1408 isTurnFrame = TRUE; ⋮ 1413 isTurnFrame = TRUE; ⋮ 1418 isTurnFrame = TRUE; ⋮ 1425 if (isTurnFrame && fieldSystem->reverseTurnFrameSteps < 0xFFFF) { 1426 ++fieldSystem->reverseTurnFrameSteps; ⋮ 1428 fieldSystem->lastFacingDirection = facingDirection;
src/field/encounter_check.c lines 1397–1428 at 6988158 · upstream ↗ 215BOOL FieldSystem_PerformLandOrSurfEncounterCheck(FieldSystem *fieldSystem) { 216 if (fieldSystem->encounterInhibitSteps <= 3) { 217 return FALSE; ⋮ 230 encounterRate = FieldSystem_GetTileEncounterTypeAndRate(fieldSystem, metatileBehavior, &encounterType); 231 if (encounterRate == 0) { 232 return FALSE; ⋮ 234 FieldSystem_UpdateTurnFrameCounter(fieldSystem);
src/field/encounter_check.c lines 215–234 at 6988158 · upstream ↗ 315 if (found) { 316 sub_02050B08(fieldSystem, battleSetup); 317 fieldSystem->encounterInhibitSteps = 0; 318 fieldSystem->reverseTurnFrameSteps = 0;
src/field/encounter_check.c lines 315–318 at 6988158 · upstream ↗ 268 fieldSystem->encounterInhibitSteps = 0; 269 fieldSystem->reverseTurnFrameSteps = 0;
src/field_warp_tasks.c lines 268–269 at 6988158 · upstream ↗ 471static BOOL FieldSystem_CheckWildEncounter(FieldSystem *fieldSystem) { 472 if (fieldSystem->encounterInhibitSteps < 0xFFFF) { 473 fieldSystem->encounterInhibitSteps++;
src/field/field_control.c lines 471–474 at 6988158 · upstream ↗ 1031static int FieldSystem_GetLandEncounterRate(FieldSystem *fieldSystem) { 1032 const EncounterData *encData = MapEvents_GetLoadedEncTable(fieldSystem); 1033 return encData->encounterRate_walking; ⋮ 1037 const EncounterData *encData = MapEvents_GetLoadedEncTable(fieldSystem); 1038 return encData->encounterRate_surfing;
src/field/encounter_check.c lines 1031–1039 at 6988158 · upstream ↗ 763 // flat 60% chance for the encounter attempt to fail, which is decreased by long grass, biking, and on certain dates. 764 u8 flatEncounterRate = 40; ⋮ 766 if (TileBehavior_IsVeryTallGrass(tileBehavior)) { 767 flatEncounterRate += 30; 768 } else if (PlayerAvatar_GetPlayerState(fieldSystem->playerAvatar) == PLAYER_AVATAR_CYCLING) { 769 flatEncounterRate += 30; ⋮ 772 flatEncounterRate = SpecialDates_ModifyEncounterRate(flatEncounterRate, FieldSystem_HasPenalty(fieldSystem)); ⋮ 778 return LCRNG_RandMod(100) < flatEncounterRate && CheckEncounterRateSuccess(fieldSystem, encounterRate);
src/overlay006/wild_encounters.c lines 763–778 at 49f78f3 · upstream ↗ 750static BOOL ShouldGetRandomEncounter(FieldSystem *fieldSystem, const u32 encounterRate, const u8 tileBehavior) ⋮ 752 u32 encRate = encounterRate << 8; ⋮ 754 // lowers effective encounter rate by 95% for the first few steps after each encounter. 755 if (!GracePeriodStepsUsed(fieldSystem, encRate)) { 756 fieldSystem->wildBattleMetadata.encounterAttempts++; ⋮ 758 if (LCRNG_RandMod(100) >= 5) { 759 return FALSE;
src/overlay006/wild_encounters.c lines 750–761 at 49f78f3 · upstream ↗ 797// Suppresses the first few encounter attempts after each map transition or wild battle. 798static BOOL GracePeriodStepsUsed(FieldSystem *fieldSystem, u32 encounterRate) ⋮ 800 encounterRate = (encounterRate / 10) >> 8; ⋮ 802 if (encounterRate > 8) { 803 encounterRate = 8; ⋮ 806 encounterRate = 8 - (encounterRate); // higher encounter rates also lower the grace period. ⋮ 808 return fieldSystem->wildBattleMetadata.encounterAttempts >= encounterRate;
src/overlay006/wild_encounters.c lines 797–808 at 49f78f3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Revised after a check by a second AI model, 2026-10-22.
- ^Before the two rolls, HeartGold and SoulSilver adjust the map's rate in this order: the lead Pokémon's ability (unless it is an Egg) doubles it for Arena Trap, No Guard, or Illuminate, halves it for White Smoke, Quick Feet, or Stench, or for Snow Cloak in snow, capped at 100; the Black Flute halves it and the White Flute raises it by half; and a Cleanse Tag or Pure Incense held by the lead Pokémon cuts it to 2/3. Gold and Silver instead double the rate for the Pokémon March or the Ruins of Alph radio and halve it for the Pokémon Lullaby or a Cleanse Tag.Codepret/pokeheartgold · pret/pokegold
How we know
244 encounterRate = ApplyAbilityEffectToEncounterRate(FALSE, encounterRate, &encounterGen, LocalFieldData_GetWeatherType(Save_LocalFieldData_Get(fieldSystem->saveData)), leadMon); 245 ApplyFluteEffectToEncounterRate(fieldSystem, &encounterRate); 246 ApplyLeadMonHeldItemEffectToEncounterRate(leadMon, &encounterRate); 247 BOOL ret = FieldSystem_EncounterRateRoll(fieldSystem, encounterRate, metatileBehavior) ? TRUE : FALSE;
src/field/encounter_check.c lines 244–247 at 6988158 · upstream ↗ 1123 if (!encounterGen->isEgg) { ⋮ 1126 ret *= 2; ⋮ 1128 } else if (encounterGen->ability == ABILITY_ARENA_TRAP || encounterGen->ability == ABILITY_NO_GUARD || encounterGen->ability == ABILITY_ILLUMINATE) { 1129 ret *= 2; 1130 } else if (encounterGen->ability == ABILITY_SNOW_CLOAK) { 1131 if (weatherType == WEATHER_SNOW) { 1132 ret /= 2; ⋮ 1134 } else if (encounterGen->ability == ABILITY_WHITE_SMOKE || encounterGen->ability == ABILITY_QUICK_FEET || encounterGen->ability == ABILITY_STENCH) { 1135 ret /= 2; ⋮ 1137 if (ret > 100) { 1138 ret = 100;
src/field/encounter_check.c lines 1120–1140 at 6988158 · upstream ↗ 720 if (heldItem == ITEM_CLEANSE_TAG || heldItem == ITEM_PURE_INCENSE) { 721 *pEncounterRate = *pEncounterRate * 2 / 3; ⋮ 727 if (flute == FLUTE_BLACK) { 728 *pEncounterRate /= 2; 729 } else if (flute == FLUTE_WHITE) { 730 *pEncounterRate += *pEncounterRate / 2;
src/field/encounter_check.c lines 718–731 at 6988158 · upstream ↗ 214 call ApplyMusicEffectOnEncounterRate 215 call ApplyCleanseTagEffectOnEncounterRate ⋮ 234; Pokemon March and Ruins of Alph signal double encounter rate. 235; Pokemon Lullaby halves encounter rate. ⋮ 251; Cleanse Tag halves encounter rate.
engine/overworld/wildmons.asm lines 212–251 at fc702b6 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^HeartGold and SoulSilver have 12 grass slots and 5 surfing slots, picked by one
LCRandom() % 100against bounds inEncounterSlot_WildMonSlotRoll_LandandEncounterSlot_WildMonSlotRoll_Surfing, so they come up 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, and 1 percent and 60, 30, 5, 4, and 1 percent (computed from the bounds). Platinum'sGetGroundEncounterSlotandGetWaterEncounterSlothave the same bounds. Gold and Silver have 7 grass slots and 3 water slots, with cumulative bounds inGrassMonProbTable(30, 60, 80, 90, 95, 99, 100) andWaterMonProbTable(60, 90, 100), so 30, 30, 20, 10, 5, 4, and 1 percent and 60, 30, and 10 percent (computed from the differences).Codepret/pokeheartgold · pret/pokeplatinum · pret/pokegoldrevisedHow we know
632static u8 EncounterSlot_WildMonSlotRoll_Land(void) { 633 u8 rnd = LCRandRange(100); ⋮ 635 if (rnd < 20) { 636 return 0; 637 } else if (rnd >= 20 && rnd < 40) { 638 return 1; ⋮ 640 return 2; ⋮ 642 return 3; ⋮ 644 return 4; ⋮ 651 } else if (rnd >= 90 && rnd < 94) { 652 return 8; 653 } else if (rnd >= 94 && rnd < 98) { ⋮
src/field/encounter_check.c lines 632–676 at 6988158 · upstream ↗ 820static u8 GetGroundEncounterSlot(void) ⋮ 822 u8 roll = LCRNG_RandMod(100); ⋮ 824 if (roll < 20) { 825 return 0; ⋮ 827 return 1; ⋮ 829 return 2; ⋮ 831 return 3; ⋮ 833 return 4; ⋮ 842 } else if (roll >= 94 && roll < 98) { 843 return 9; 844 } else if (roll == 98) { 845 return 10; ⋮
src/overlay006/wild_encounters.c lines 820–866 at 49f78f3 · upstream ↗ 6GrassMonProbTable: 7 table_width 2 8 mon_prob 30, 0 ; 30% chance 9 mon_prob 60, 1 ; 30% chance 10 mon_prob 80, 2 ; 20% chance 11 mon_prob 90, 3 ; 10% chance 12 mon_prob 95, 4 ; 5% chance 13 mon_prob 99, 5 ; 4% chance 14 mon_prob 100, 6 ; 1% chance ⋮ 17WaterMonProbTable: 18 table_width 2 19 mon_prob 60, 0 ; 60% chance ⋮
data/wild/probabilities.asm lines 6–21 at fc702b6 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Revised after a check by a second AI model, 2026-10-22.
- ^A HeartGold or SoulSilver map's encounter record holds one walking rate and three full species lists for its 12 grass slots, morning, day, and night, sharing one list of levels. Gold and Silver keep a separate grass rate for each time of day and three sets of 7 slots. Platinum keeps one 12-slot list and swaps only slots 2 and 3 for their day or night species outside the morning.Codepret/pokeheartgold · pret/pokegold · pret/pokeplatinum
How we know
23typedef struct LandEncounterData { 24 u8 levels[NUM_ENCOUNTERS_LAND]; // shared between times of day 25 u16 species_morn[NUM_ENCOUNTERS_LAND]; 26 u16 species_day[NUM_ENCOUNTERS_LAND]; 27 u16 species_nite[NUM_ENCOUNTERS_LAND]; 28} LandEncounterData;
include/wild_encounter.h lines 23–28 at 6988158 · upstream ↗ 36typedef struct EncounterData { 37 u8 encounterRate_walking; // 0x00 38 u8 encounterRate_surfing; // 0x01 ⋮ 44 LandEncounterData landSlots; // 0x08
include/wild_encounter.h lines 36–44 at 6988158 · upstream ↗ 133 for (int i = 0; i < NUM_ENCOUNTERS_LAND; ++i) { 134 encSlots[i].species = slotSpecies[i]; 135 encSlots[i].maxLevel = encData->landSlots.levels[i]; 136 encSlots[i].minLevel = encData->landSlots.levels[i];
src/field/encounter_check.c lines 133–136 at 6988158 · upstream ↗ 220GetMapEncounterRate: 221 ld hl, wMornEncounterRate 222 call CheckOnWater 223 ld a, wWaterEncounterRate - wMornEncounterRate 224 jr z, .ok 225 ld a, [wTimeOfDay] 226.ok
engine/overworld/wildmons.asm lines 212–251 at fc702b6 · upstream ↗ 283 ld a, [wTimeOfDay] 284 ld bc, NUM_GRASSMON * 2 285 call AddNTimes
engine/overworld/wildmons.asm lines 283–286 at fc702b6 · upstream ↗ 181// Default encounters are morning. They get replaced by this if it is not morning. 182void WildEncounters_ReplaceTimedEncounters(const WildEncounters *encounterData, int *timedSlot1, int *timedSlot2) ⋮ 184 int timeOfDay = GetTimeOfDay(); ⋮ 186 if (timeOfDay == TIMEOFDAY_DAY || timeOfDay == TIMEOFDAY_TWILIGHT) { 187 *timedSlot1 = encounterData->dayEncounters[0]; ⋮ 189 } else if (timeOfDay == TIMEOFDAY_NIGHT || timeOfDay == TIMEOFDAY_LATE_NIGHT) { 190 *timedSlot1 = encounterData->nightEncounters[0];
src/overlay006/wild_encounters.c lines 181–193 at 49f78f3 · upstream ↗ 334 WildEncounters_ReplaceTimedEncounters(encounterData, &encounterTable[2].species, &encounterTable[3].species);src/overlay006/wild_encounters.c line 334 at 49f78f3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^ abOn each step, Gold and Silver's
TryWildEncounterreads the map's encounter rate for the current time of day (morning, day, or night), or its water rate, doubles it for the Pokémon March or Ruins of Alph radio, halves it for the Pokémon Lullaby or a Cleanse Tag, and starts a battle whenRandomis below it; Crystal keeps this unchanged.Codepret/pokegold · pret/pokecrystalHow we know
212.EncounterRate: 213 call GetMapEncounterRate 214 call ApplyMusicEffectOnEncounterRate 215 call ApplyCleanseTagEffectOnEncounterRate 216 call Random 217 cp b 218 ret ⋮ 220GetMapEncounterRate: 221 ld hl, wMornEncounterRate 222 call CheckOnWater 223 ld a, wWaterEncounterRate - wMornEncounterRate 224 jr z, .ok ⋮
engine/overworld/wildmons.asm lines 212–251 at fc702b6 · upstream ↗ engine/overworld/wildmons.asm#L176-L251 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abThe time of day picks which of a grass area's three sets of 7 slots is used; a roll from 1 to 100 then picks a slot at 30, 30, 20, 10, 5, 4, and 1 percent, or one of 3 water slots at 60, 30, and 10 percent. Crystal's routine and table are the same.Codepret/pokegold · pret/pokecrystalrevised
How we know
283 ld a, [wTimeOfDay] 284 ld bc, NUM_GRASSMON * 2 285 call AddNTimes 286 ld de, GrassMonProbTable ⋮ 291.randomloop 292 call Random 293 cp 100 294 jr nc, .randomloop 295 inc a ; 1 <= a <= 100
engine/overworld/wildmons.asm lines 283–295 at fc702b6 · upstream ↗ 6GrassMonProbTable: 7 table_width 2 8 mon_prob 30, 0 ; 30% chance 9 mon_prob 60, 1 ; 30% chance 10 mon_prob 80, 2 ; 20% chance 11 mon_prob 90, 3 ; 10% chance 12 mon_prob 95, 4 ; 5% chance 13 mon_prob 99, 5 ; 4% chance 14 mon_prob 100, 6 ; 1% chance ⋮ 18 table_width 2 19 mon_prob 60, 0 ; 60% chance 20 mon_prob 90, 1 ; 30% chance ⋮
data/wild/probabilities.asm lines 6–21 at fc702b6 · upstream ↗ 6GrassMonProbTable: ⋮ 14 mon_prob 100, 6 ; 1% chance
data/wild/probabilities.asm lines 6–21 at 97187cd · upstream ↗ engine/overworld/wildmons.asm#L252-L348 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^ abcdIn Dragon Warrior III (the North American NES release), each step reads the area's encounter class: classes 0–2 first pass a roll of 16, 64, or 128 in 256 and then use a multiplier of 1, and classes 3–7 use 1, 2, 4, 8, or 16. The multiplier times the terrain's odds, capped at 100, is then compared with a random byte; the overworld's odds rise at night (grass 10 by day and 13 by night, forest 18 and 22, hills 25 and 31, and 4 and 5 aboard the ship, which uses terrain 0), and carrying the Golden Claw sets them to 100.Code“Dragon Warrior III (USA)” · zeromus/DragonWarrior3revised
How we know
In the cartridge (“Dragon Warrior III (USA)”): bank 0 $838D-$83F2, the class roll, the day or night table, the Golden Claw, the cap, and the final roll; bank 0 $8628, the class table 16, 64, 128, 1, 2, 4, 8, 16; bank 0 $8934 and $893D, the day and night odds by terrain. We don't reproduce the bytes.
606sub_838D: ⋮ 617 LDA byte_8628,X ⋮ 621 JSR _rand 622 CMP byte_4D ⋮ 638 LDA _random_encounter_overworld_probability_daytime_tbl,X ⋮ 641 LDA _random_encounter_overworld_probability_nighttime_tbl,X ⋮ 656 CMP #$64 ; clamp u8[$4D] at #$64 ⋮ 663 CMP byte_4D
disassembly/bank00.inc lines 606–665 at b35d5fd · upstream ↗ 1444_random_encounter_overworld_probability_daytime_tbl: 1445 .BYTE 4, $F, $A, $F,$12,$19,$54,$12, $A 1446_random_encounter_overworld_probability_nighttime_tbl:
disassembly/bank00.inc lines 1444–1447 at b35d5fd · upstream ↗ 1TILE_OVERWORLD_SAND = $01 2TILE_OVERWORLD_GRASS = $02 3TILE_OVERWORLD_SHRUBS = $03 4TILE_OVERWORLD_FOREST = $04 5TILE_OVERWORLD_HILLS = $05
disassembly/tile_ids.inc lines 1–5 at b35d5fd · upstream ↗ In the cartridge (“Dragon Warrior III (USA)”): bank 0 $82DC-$82F9; on the ship ($2C = 1) the terrain index $4F is set to 0. We don't reproduce the bytes.
502 LDA _player_vehicle ; vehicle type 503 CMP #1 504 BEQ .check_encounter_ship ; branch for ship ⋮ 507.check_encounter_ship: ⋮ 509 STA byte_4F ; meaning unsure
disassembly/bank00.inc lines 500–510 at b35d5fd · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^The North American handbook says time passes while the party moves in the field; some people appear only by day or only by night, most castles turn visitors away and most stores close at night, and monsters come more often at night. A night at an inn brings morning, and the spell Day-Night swaps day and night.ManualDragon Warrior III Explorer's Handbook · Dragon Quest III Famicom manual
How we know
you may find certain people only during the day and others only during the night. … Only while moving in the field, will time pass. … At most castles, guards will stop you from entering if you visit at night. … Most stores close at night … The chance of encountering enemies increases at night. … Chanting this magic spell will turn day into night and night into day.
p. 17, Day and Night · archived copy ↗ 宿屋は夜も営業しており、泊まると朝になります。
p. 17, 宿屋 · archived copy ↗ The quote matches our archived copy.
- ^ abcEach step on a normal map adds the map's rate to a random-battle counter ($E0 at the normal rate; $40, $180, or $200 at the others), and a battle starts when a byte from the random table, plus an offset that grows by $11 each time its pointer wraps, is under the counter's high byte.Codeeverything8215, FF5 disassembly
How we know
21620; [ check random battles (normal map) ] ⋮ 21646 lda $06 21647 shorta 21648 lda f:SubBattleRate,x ⋮ 21658 lda $16a8 ; random battle counter 21659 clc 21660 adc f:_c0cb09,x ; add probability value 21661 bcc @cabf 21662 lda #$ff00 ; max $ff00 21663@cabf: sta $16a8 21664 lda $06 21665 shorta ⋮
src/field/field-main.asm lines 21620–21670 at 997c87d · upstream ↗ 21700_c0cb09: 21701 .word $00e0, $0040, $0180, $0200
src/field/field-main.asm lines 21700–21701 at 997c87d · upstream ↗ 21861_c0cc52: 21862@cc52: phx 21863 inc $4f 21864 bne @cc60 21865 lda $0b60 21866 clc 21867 adc #$11 21868 sta $0b60 21869@cc60: lda $4f 21870 tax 21871 lda f:RNGTbl,x 21872 clc ⋮
src/field/field-main.asm lines 21861–21873 at 997c87d · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abEach step on a town or dungeon map adds the map's rate to a random-battle counter ($70 per step at the normal rate; $40, $160, or $200 at the low, high, and very high ones; the Charm Bangle halves them and the Moogle Charm zeroes them), and a battle starts when a byte from the random table, plus an offset that grows by 17 each time its pointer wraps, is under the counter's high byte. A battle clears the counter, so each step without one makes the next likelier.Codeeverything8215, FF6 disassembly
How we know
264; normal map random battle rates 265; 8 bytes each (normal, low, high, very high) 266SubBattleRateTbl: 267 .word $0070,$0040,$0160,$0200 ; normal 268 .word $0038,$0020,$00b0,$0100 ; charm bangle 269 .word $0000,$0000,$0000,$0000 ; moogle charm
src/field/battle.asm lines 264–270 at 8130132 · upstream ↗ 376 lda $11df ; moogle charm and charm bangle effect ⋮ 386 lda $1f6e ; random battle counter 387 adc f:SubBattleRateTbl,x ; add random battle rate (max #$ff00) 388 bcc :+ 389 lda #$ff00 390: sta $1f6e 391 shorta0 392 jsr UpdateBattleRng 393 cmp $1f6f 394 bcs Done ; return if counter didn't overflow 395 stz $1f6e ; clear random battle counter 396 stz $1f6f
src/field/battle.asm lines 374–396 at 8130132 · upstream ↗ 470; [ update random number for random battle ] ⋮ 472.proc UpdateBattleRng 473 phx 474 inc $1fa1 ; increment random number pointer 475 bne :+ 476 lda $1fa4 477 clc 478 adc #17 ; add 17 to random number counter 479 sta $1fa4 480: lda $1fa1 481 tax 482 lda f:RNGTbl,x ; add random number to counter ⋮
src/field/battle.asm lines 470–485 at 8130132 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abFinal Fantasy VI keeps Final Fantasy V's random-battle counter, which each step raises by the map's rate and which a byte from the random table, offset each time its pointer wraps, is tested against; it halves the normal rate from $E0 to $70 per step and changes the high one from $180 to $160.Codeeverything8215, FF5 disassembly · everything8215, FF6 disassembly
How we know
21700_c0cb09: 21701 .word $00e0, $0040, $0180, $0200
src/field/field-main.asm lines 21700–21701 at 997c87d · upstream ↗ 21658 lda $16a8 ; random battle counter 21659 clc 21660 adc f:_c0cb09,x ; add probability value ⋮ 21666 jsr _c0cc52 ; update random number for random battles 21667 cmp $16a9
src/field/field-main.asm lines 21658–21670 at 997c87d · upstream ↗ 264; normal map random battle rates 265; 8 bytes each (normal, low, high, very high) 266SubBattleRateTbl: 267 .word $0070,$0040,$0160,$0200 ; normal
src/field/battle.asm lines 264–267 at 8130132 · upstream ↗ 386 lda $1f6e ; random battle counter 387 adc f:SubBattleRateTbl,x ; add random battle rate (max #$ff00) ⋮ 392 jsr UpdateBattleRng 393 cmp $1f6f
src/field/battle.asm lines 386–393 at 8130132 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Checked by a second AI model, 2026-10-21.
- ^ abOn the world map, the sector that picks the battle rate and group is read from $1F60 and $1F61. While the player walks, the world map's movement code copies the current position there only in the branch taken after a random battle starts, so the rate and group stay as they were until a battle or another writer (world map start, events, entrances) updates them; the disassembly marks this as a bug.Codeeverything8215, FF6 disassemblyrevised
How we know
125; *** bug *** 126; The x and y positions used below do not get updated when the player moves on 127; the world map. They only update when the world map loads (when entering the 128; world map, after closing the menu, or after a battle). Thus, these are the 129; only times that the random battle group and probability rate will change.
src/field/battle.asm lines 125–129 at 8130132 · upstream ↗ 130 lda $1f61 ; y sector (0 to 7) ⋮ 133 lda $1f60 ; x position (0 to 7)
src/field/battle.asm lines 130–134 at 8130132 · upstream ↗ 884 jsl CheckBattleWorld_ext 885 cmp #$00 886 beq @1e1c ; branch if no random battle ⋮ 891 lda f:$000ae0 892 sta $1f60 893 lda f:$000ae2 894 sta $1f61
src/world/move.asm lines 884–894 at 8130132 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-21.
Revised after a check by a second AI model, 2026-10-21.
- ^
lut_RNG, the 256-byte table at$F100, holds every byte from$00to$FFexactly once.Code“Final Fantasy (USA)” · Disch, FF1 disassemblyHow we know
In the cartridge (“Final Fantasy (USA)”): bank $0F $F100-$F1FF, lut_RNG. We don't reproduce the bytes.
11326;; RNG scrambling lookup table [$F100 :: 0x3F110] ⋮ 11328;; This table is $100 bytes in size, and simply consists of every number ⋮ 11333lut_RNG: 11334 .INCBIN "bin/0F_F100_rngtable.bin"
Final Fantasy Disassembly/bank_0F.asm lines 11326–11334 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^ ab
BattleStepRNGreturnslut_RNG[i]for a counter that steps by 1 per call; each time it wraps to 0, a sign byte gains$A0, and its top bit sets the direction of the next pass.CodeDisch, FF1 disassemblyHow we know
1315;; Random numbers are generated by stepping through a RNG LUT. Once it 1316;; cycles through the entire LUT, it cycles through it again -- potentially 1317;; in a reversed direction. Which direction it's going depends on battlestep_sign. ⋮ 1323BattleStepRNG: 1324 BIT battlestep_sign ; see if sign indicates a decrement 1325 BMI @Negative ⋮ 1339 ADC #$A0 1340 STA battlestep_sign ⋮ 1343 LDX battlestep ; put battlestep in X 1344 LDA lut_RNG, X ; use it to get a random number from the LUT
Final Fantasy Disassembly/bank_0F.asm lines 1315–1345 at cbb87d3 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^
TryRunlets the hero escape when Agility × a random byte is at least the monster's defense byte × a roll whose range grows with the monster: 0–63 from Slime to Druinlord, 0–94 from Drollmagi to Werewolf, 0–127 from Green Dragon to Blue Dragon, and 0–255 from Stoneman on. Running from a sleeping monster always works.Codenmikstas/dragon-warrior-disassembly · Ryan8bit, DW FormulasHow we know
7191LE894: BIT PlayerFlags ;Is the enemy asleep? 7192LE896: BVS RunSuccessful ;If so, branch for a successful run. ⋮ 7194LE898: JSR TryRun ;($EE91)Determine if player can run.
source_files/Bank03.asm lines 7191–7195 at ebe6a13 · upstream ↗ 8260LEE96: CMP #EN_STONEMAN ;Dragonlord 1 or Dragonlord 2? ⋮ 8263LEE9A: LDA RandNumUB ;Load a random number and keep all the bits(0-255). ⋮ 8276LEEAC: BCC CalcWhoIsNext ;If not, branch. ⋮ 8279LEEB0: AND #$3F ; ⋮ 8284LEEB9: AND #$1F ;previous number to get a range of 0-95. 8285LEEBB: ADC MultNum2LB ;
source_files/Bank03.asm lines 8256–8293 at ebe6a13 · upstream ↗ 970.alias EN_DRUINLORD $13 ;Druinlord. 971.alias EN_DROLLMAGI $14 ;Drollmagi. ⋮ 981.alias EN_GDRAGON $1E ;Green dragon. ⋮ 986.alias EN_STONEMAN $23 ;Stoneman.
source_files/Dragon_Warrior_Defines.asm lines 970–986 at ebe6a13 · upstream ↗ Group 1: #00 (Slime) - #19 (Druinlord)
II.B, Running · archived copy ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^In a wild battle,
TryRunningFromBattlelets the player escape when their Pokémon's Speed is at least the foe's ; otherwise it computes , adds 30 for each earlier attempt, and escapes when a random byte is at most the result, or at once when the result passes 255.Codepret/pokeredHow we know
1498 jp z, .canEscape ; jump if it's a ghost battle ⋮ 1501 jp z, .canEscape ; jump if it's a safari battle ⋮ 1504 jp z, .canEscape ⋮ 1507 jr nz, .trainerBattle ; jump if it's a trainer battle 1508 ld a, [wNumRunAttempts] 1509 inc a 1510 ld [wNumRunAttempts], a ⋮ 1525 jr nc, .canEscape ; jump if player speed greater than enemy speed ⋮ 1528 ld a, 32 ⋮ 1538; divide enemy speed by 4 ⋮ 1544 jr z, .canEscape ; jump if enemy speed divided by 4, mod 256 is 0 ⋮ 1551 ld a, [wNumRunAttempts] ⋮
engine/battle/core.asm lines 1496–1578 at af51989 · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^Emerald's
Randomis a linear congruential generator, , returning the top 16 bits; pret's comment traces the multiplier to the examplerandin the ISO C standard.Codepret/pokeemeraldHow we know
8COMMON_DATA u32 gRngValue = 0; ⋮ 11u16 Random(void) ⋮ 13 gRngValue = ISO_RANDOMIZE1(gRngValue); 14 sRandCount++; 15 return gRngValue >> 16;
src/random.c lines 8–16 at 731ad5b · upstream ↗ 14// The number 1103515245 comes from the example implementation of rand and srand 15// in the ISO C standard. 16#define ISO_RANDOMIZE1(val) (1103515245 * (val) + 24691) 17#define ISO_RANDOMIZE2(val) (1103515245 * (val) + 12345)
include/random.h lines 14–17 at 731ad5b · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-20.
Checked by a second AI model, 2026-10-21.
- ^Dragon Quest (developer Chunsoft, publisher Enix) came out for the Famicom in Japan on 27 May 1986, and Dragon Warrior for the NES in North America in August 1989.WikidataWikidata
How we know
+1986-05-27T00:00:00Z … +1989-08-00T00:00:00Z
Q2313869, P178 developer, P123 publisher, and P577 publication date qualified by P291 place and P400 platform · archived copy ↗ The quote matches our archived copy.
Checked by a second AI model, 2026-10-21.
- ^Pokémon Emerald (developer Game Freak, publisher Nintendo, Game Boy Advance, and Generation III core series) came out in Japan on 16 September 2004 and North America on 1 May 2005.WikiBulbapedia, “Pokémon Emerald Version”
How we know
Developer: Game Freak … Publisher: Nintendo … Part of: Generation III core series … Japan: September 16, 2004 … North America: May 1, 2005
infobox, Basic info and Release dates · archived copy ↗ The quote matches our archived copy.
Sources
Code
- nmikstas. 2023. “dragon-warrior-disassembly: NES Dragon Warrior software disassembly.” Commit ebe6a13. nmikstas/dragon-warrior-disassembly @ ebe6a13 · licence, all uses
- Disch. 2019. “Final Fantasy Disassembly.” Commit cbb87d3. BenWenger/FinalFantasyDisassembly @ cbb87d3 · licence, all uses
- pret contributors. 2026. “pokered: disassembly of Pokémon Red and Blue.” pret. Commit af51989. pret/pokered @ af51989 · licence, all uses
- pret contributors. 2026. “pokecrystal: disassembly of Pokémon Crystal.” pret. Commit 97187cd. pret/pokecrystal @ 97187cd · licence, all uses
- pret contributors. 2026. “pokeemerald: decompilation of Pokémon Emerald.” pret. Commit 731ad5b. pret/pokeemerald @ 731ad5b · licence, all uses
- Nathan-R-Og. 2026. “dq2: Disassembly of NES Dragon Warrior II.” Commit 0fb64a4. Nathan-R-Og/dq2 @ 0fb64a4 · licence, all uses
- n.d. “Dragon Warrior II (USA).” · licence, all uses
- n.d. “Dragon Warrior III (USA).” · licence, all uses
- zeromus and CaH4e3. 2024. “DragonWarrior3: Dragon Warrior III Reverse Engineering & Reconstructing.” Commit b35d5fd. zeromus/DragonWarrior3 @ b35d5fd · licence, all uses
- 1990. “Final Fantasy (USA).” · licence, all uses
- everything8215. 2022. “Final Fantasy III (NES) disassembly and ROM info.” Commit 1acef81. everything8215/ff3 @ 1acef81 · licence, all uses
- everything8215. 2022. “Final Fantasy IV Disassembly.” Commit a360e2e. everything8215/ff4 @ a360e2e · licence, all uses
- everything8215. 2026. “Final Fantasy V Disassembly.” Commit 997c87d. everything8215/ff5 @ 997c87d · licence, all uses
- everything8215. 2026. “Final Fantasy VI Disassembly.” Commit 8130132. everything8215/ff6 @ 8130132 · licence, all uses
- pret contributors. 2026. “pokeyellow: disassembly of Pokémon Yellow.” pret. Commit b6696f2. pret/pokeyellow @ b6696f2 · licence, all uses
- pret contributors. 2026. “pokegold: disassembly of Pokémon Gold and Silver.” pret. Commit fc702b6. pret/pokegold @ fc702b6 · licence, all uses
- pret contributors. 2026. “pokeruby: decompilation of Pokémon Ruby and Sapphire.” pret. Commit 5784633. pret/pokeruby @ 5784633 · licence, all uses
- pret contributors. 2026. “pokefirered: decompilation of Pokémon FireRed and LeafGreen.” pret. Commit ce6406d. pret/pokefirered @ ce6406d · licence, all uses
- Nathan-R-Og. 2026. “mother: Disassembly of Mother/Earthbound Zero/Earthbound Beginnings for the NES.” Commit e0b3e3f. Nathan-R-Og/mother @ e0b3e3f · licence, all uses
- n.d. “EarthBound Beginnings (USA, Europe) (Virtual Console).” · licence, all uses
Primary
- America, Nintendo of. 1989. “Dragon Warrior instruction booklet (NES, North America).” Nintendo of America. original · archived · licence, all uses
Secondary
- Björk, Staffan. 2018. “Ephemeral Goals.” Gameplay Design Patterns wiki (gdp3, Chalmers University of Technology). revision 26300. original · archived · licence, all uses
- Ryan8bit. 2011. “Dragon Warrior (NES) Formulas.” GameFAQs. v1.0. original · archived · licence, all uses
- Wikidata contributors. 2026. “Wikidata.” Wikimedia Foundation. original · licence, all uses
- Bulbapedia contributors. 2026. “Pokémon Emerald Version.” Bulbapedia (Bulbagarden). revision 4629817. original · archived · licence, all uses