Pokémon species data structure (Generation II): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
(adding information on 0x11)
m (Text replacement - "}}<br>↵{{Project Games notice" to "}} {{Project Games notice")
 
(25 intermediate revisions by 16 users not shown)
Line 1: Line 1:
==Specs==
The '''Pokémon species data structure''' is a 32-byte piece of data.


A '''base stats structure''' is a 32-byte piece of data.  
Every [[Pokémon|Pokémon species]] in the [[Generation II]] {{pkmn|games}} has a 32-byte data structure stored in the game's ROM somewhere. It determines all information inherent to the species, such as base stats, [[type]]s, [[catch rate]] and [[Egg Group]]s. The Pokémon species' names are not part of this structure, but are instead stored [[#Names|elsewhere]].


Every [[Pokémon|Pokémon species]] in the [[Generation II]] {{pkmn|games}} has a 32-byte base stats structure stored in the game's ROM somewhere. It determines all information inherent to the species, such as base Defense, [[Elemental types|Types]], [[catch rate]] and [[egg groups]].
{| class="roundy" style="width:auto; text-align:center; background: #ccf; border: 3px solid blue;"
 
{| {{bluetable}}
|-  
|-  
! style="text-align: center; background: #ccf;" | '''Offset'''
! '''Offset'''
! style="text-align: center; background: #ccf;" | '''Contents'''
! '''Contents'''
! style="text-align: center; background: #ccf;" | '''Size'''
! '''Size'''
|-
|- style="background:#F8F8FF"
| 0x00 || [[Johto Pokédex|Pokédex number]] || byte
| 0x00 || [[List of Pokémon by Johto Pokédex number|Pokédex number]] || byte
|-
|- style="background:#F8F8FF"
| 0x01 || [[Base stats|Base HP]] || byte
| 0x01 || [[Base stats|Base HP]] || byte
|-
|- style="background:#F8F8FF"
| 0x02 || Base Attack || byte
| 0x02 || Base Attack || byte
|-
|- style="background:#F8F8FF"
| 0x03 || Base Defense || byte
| 0x03 || Base Defense || byte
|-  
|- style="background:#F8F8FF"
| 0x04 || Base Speed || byte
| 0x04 || Base Speed || byte
|-
|- style="background:#F8F8FF"
| 0x05 || Base Sp. Attack || byte
| 0x05 || Base Sp. Attack || byte
|-
|- style="background:#F8F8FF"
| 0x06 || Base Sp. Defense || byte
| 0x06 || Base Sp. Defense || byte
|-
|- style="background:#F8F8FF"
| 0x07 || [[Elemental types|Type]] 1 || byte
| 0x07 || [[Type]] 1 || byte
|-
|- style="background:#F8F8FF"
| 0x08 || Type 2 || byte
| 0x08 || Type 2 || byte
|-
|- style="background:#F8F8FF"
| 0x09 || [[Catch rate]] || byte
| 0x09 || [[Catch rate]] || byte
|-
|- style="background:#F8F8FF"
| 0x0a || [[Experience|Base Exp. Yield]] || byte
| 0x0a || [[Experience|Base Exp. Yield]] || byte
|-
|- style="background:#F8F8FF"
| 0x0b || [[List of items by index number (Generation II)|Wild held item]] 1 || byte
| 0x0b || [[List of items by index number in Generation II|Wild held item]] 1 || byte
|-
|- style="background:#F8F8FF"
| 0x0c || Wild held item 2 || byte
| 0x0c || Wild held item 2 || byte
|-
|- style="background:#F8F8FF"
| 0x0d || Gender ratio || byte
| 0x0d || Gender ratio || byte
|-
|- style="background:#F8F8FF"
| 0x0e || {{tt|Unknown|Always 0x64 (100). Max level?}} || byte
| 0x0e || {{tt|Unknown|Always 0x64 (100)}} || byte
|-
|- style="background:#F8F8FF"
| 0x0f || [[Egg cycles]] || byte
| 0x0f || [[Egg cycles]] || byte
|-
|- style="background:#F8F8FF"
| 0x10 || {{tt|Unknown|Always 0x05. Level of baby?}} || byte
| 0x10 || {{tt|Unknown|Always 0x05}} || byte
|-
|- style="background:#F8F8FF"
| 0x11 || Dimensions of front sprite || byte
| 0x11 || Dimensions of frontsprite || byte
|-
|- style="background:#F8F8FF"
| 0x12-0x15 || {{tt|Blank|Always 00 00 00 00}} || 4 bytes
| 0x12-0x15 || {{tt|Blank|Always 00 00 00 00}} || 4 bytes
|-
|- style="background:#F8F8FF"
| 0x16 || [[Experience|Growth rate]] || byte
| 0x16 || [[Experience|Growth rate]] || byte
|-
|- style="background:#F8F8FF"
| 0x17 || [[Egg groups]] || byte
| 0x17 || [[Egg Group]]s || byte
|-
|- style="background:#F8F8FF"
| 0x18-0x1f || TM and HM flags || 8 bytes
| 0x18-0x1f || TM and HM flags || 8 bytes
|}
|}
Line 58: Line 56:
==Notes==
==Notes==
===Types===
===Types===
For a single-type Pokémon, both types are set to the same value.
* 0x00: {{t|Normal}}
* 0x01: {{t|Fighting}}
* 0x02: {{t|Flying}}
* 0x03: {{t|Poison}}
* 0x04: {{t|Ground}}
* 0x05: {{t|Rock}}
* 0x06: {{t|Bird}}
* 0x07: {{t|Bug}}
* 0x08: {{t|Ghost}}
* 0x09: {{t|Steel}}
* 0x0a:-0x12: blank
* 0x13: {{t|???}}
* 0x14: {{t|Fire}}
* 0x15: {{t|Water}}
* 0x16: {{t|Grass}}
* 0x17: {{t|Electric}}
* 0x18: {{t|Psychic}}
* 0x19: {{t|Ice}}
* 0x1a: {{t|Dragon}}
* 0x1b: {{t|Dark}}


For a single-typed Pokémon, both types are set to the same value.
===Wild held items===
{{main|List of Pokémon by wild held item (Generation II)}}
The item entries refer to items by their [[List of items by index number in Generation II|index number]]. The first item has a 23% chance of being held when the Pokémon is encountered in the wild, while the second has a 2% chance of being held. However, if a special flag is set for a given battle, the Pokémon will always be holding its first item; this is used for {{p|Snorlax}}, {{p|Lugia}}, and {{p|Ho-Oh}} (although Lugia never has a held item).


* 0x00: Normal
===Gender ratio===
* 0x01: Fighting
The gender ratio is expressed as a 1-byte threshold for the Pokémon to be male. The possible values are:  
* 0x02: Flying
* 0x03: Poison
* 0x04: Ground
* 0x05: Rock
* 0x06: [[Bird (type)|Bird]]
* 0x07: Bug
* 0x08: Ghost
* 0x09: Steel
* 0x0a:-0x12: blank
* 0x13: [[??? (type)|???]]
* 0x14: Fire
* 0x15: Water
* 0x16: Grass
* 0x17: Electric
* 0x18: Psychic
* 0x19: Ice
* 0x1a: Dragon
* 0x1b: Dark


===Wild Held Items===
{| class="roundy" style="text-align:center; background: #C0C0FF; border: 3px solid blue; margin-bottom: 10px"
! colspan="2" | Gender threshold
! colspan="2" | Gender ratio
|-
! Binary
! Decimal
! Male
! Female
|- style="background:#fff"
| <code>11111111</code>
| 255
| colspan="2" | Gender unknown
|- style="background:#fff"
| <code>11111110</code>
| 254
| 0.0%
| 100.0%
|- style="background:#fff"
| <code>10111111</code>
| 191
| 25.0%
| 75.0%
|- style="background:#fff"
| <code>01111111</code>
| 127
| 50.0%
| 50.0%
|- style="background:#fff"
| <code>00111111</code>
| 63
| 75.0%
| 25.0%
|- style="background:#fff"
| <code>00011111</code>
| 31
| 87.5%
| 12.5%
|- style="background:#fff"
| <code>00000000</code>
| 0
| 100.0%
| 0.0%
|}


Sources disagree about the exact chance for each slot. [http://upokecenter.com/games/gs/attachments.php UPC] says 25% and 8%, [http://serebii.net/gs/attach.shtml Serebii] says 25% and 1.5%.
A Pokémon's gender is calculated based on this threshold value and the Pokémon's Attack IV, following [[Individual values#Gender|a certain set of rules]].


Note that, unlike subsequent generation of games, if both item slots are set to the same item, the chance is ''not'' 100%.
===Frontsprite dimensions===
One [[wp:nybble|nybble]] each for width and height in 8×8 pixel tiles.  They always match and are always 5, 6, or 7 tiles.


=== Growth Rate ===
===Blank===
In the GB games, this is where the Pokémon's Lv.1 moves were stored. In GSC, Lv.1 moves were moved in with the rest of the moves.


===Growth rate===
* 0. Medium Fast
* 0. Medium Fast
* 3. Medium Slow
* 3. Medium Slow
Line 95: Line 144:
* 5. Slow
* 5. Slow


=== Blank ===
===Egg Groups===
 
In the GB games, this is where the Pokémon's Lv.1 moves were stored. In GSC, Lv.1 moves were moved in with the rest of the moves.
 
=== Frontsprite dimensions ===
 
One [[wp:nybble|nybble]] each for width and height in 8×8 pixel tiles.  They always match and are always 5, 6, or 7 tiles.
 
=== Egg Groups ===
 
The low nybble is one group, and the high nybble is another. For a Pokémon in only one group, both are set to the same value.
The low nybble is one group, and the high nybble is another. For a Pokémon in only one group, both are set to the same value.


* 0x01: Monster
* 0x01: {{egg|Monster}}
* 0x02: Water 1
* 0x02: {{egg|Water 1}}
* 0x03: Bug
* 0x03: {{egg|Bug}}
* 0x04: Flying
* 0x04: {{egg|Flying}}
* 0x05: Ground
* 0x05: {{egg|Ground}}
* 0x06: Fairy
* 0x06: {{egg|Fairy}}
* 0x07: Plant
* 0x07: {{egg|Plant}}
* 0x08: Humanshape
* 0x08: {{egg|Humanshape}}
* 0x09: Water 3
* 0x09: {{egg|Water 3}}
* 0x0a: Mineral
* 0x0a: {{egg|Mineral}}
* 0x0b: Indeterminate
* 0x0b: {{egg|Indeterminate}}
* 0x0c: Water 2
* 0x0c: {{egg|Water 2}}
* 0x0d: Ditto
* 0x0d: {{egg|Ditto}}
* 0x0e: Dragon
* 0x0e: {{egg|Dragon}}
* 0x0f: No Eggs
* 0x0f: {{egg|No Eggs}}


=== TMs ===
===TMs===
The TMs which a Pokémon can learn are stored as a bunch of flags. Starting from the LSB of the first byte, and ending with the MSB of the last byte. The seven HMs are treated as TMs 51-57.
The TMs which a Pokémon can learn are stored as a bunch of flags. Starting from the LSB of the first byte, and ending with the MSB of the last byte. The seven HMs are treated as TMs 51-57.


Line 145: Line 185:


===Crystal===
===Crystal===
<pre style="overflow: auto;">
<pre style="overflow: auto">
01 2D 31 31 2D 41 41 16 03 2D 40 00 00 1F 64 14 05 55 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // BULBASAUR
01 2D 31 31 2D 41 41 16 03 2D 40 00 00 1F 64 14 05 55 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // BULBASAUR
02 3C 3E 3F 3C 50 50 16 03 2D 8D 00 00 1F 64 14 05 66 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // IVYSAUR
02 3C 3E 3F 3C 50 50 16 03 2D 8D 00 00 1F 64 14 05 66 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // IVYSAUR
Line 160: Line 200:


==Storage==
==Storage==
The following are ROM offsets for the first entry (Bulbasaur) in each GBC game:
The following are ROM offsets for the first entry (Bulbasaur) in each GBC game:


* Gold (en): 0x051b0b
{| class="roundy" style="text-align: center; background: #C0C0FF; border: 3px solid blue; margin-bottom: 10px"
* Silver (en): 0x051b0b
! Game || English || Japanese
* Crystal (en): 0x051424
|- style="background:#F8F8FF"
| '''{{color2|{{gold color}}|Pokémon Gold and Silver Versions|Gold}}'''
| <code>0x051B0B</code>
| <code>0x051AA9</code>
|- style="background:#F8F8FF"
| '''{{color2|{{silver color}}|Pokémon Gold and Silver Versions|Silver}}'''
| <code>0x051B0B</code>
| <code>0x051AA9</code>
|- style="background:#F8F8FF"
| '''{{color2|{{crystal color}}|Pokémon Crystal Version|Crystal}}'''
| <code>0x051424</code>
| <code>0x0514BA</code>
|}


{{data structure}}
{{data structure}}
{{Project Games notice|data structure}}

Latest revision as of 17:32, 16 September 2024

The Pokémon species data structure is a 32-byte piece of data.

Every Pokémon species in the Generation II games has a 32-byte data structure stored in the game's ROM somewhere. It determines all information inherent to the species, such as base stats, types, catch rate and Egg Groups. The Pokémon species' names are not part of this structure, but are instead stored elsewhere.

Offset Contents Size
0x00 Pokédex number byte
0x01 Base HP byte
0x02 Base Attack byte
0x03 Base Defense byte
0x04 Base Speed byte
0x05 Base Sp. Attack byte
0x06 Base Sp. Defense byte
0x07 Type 1 byte
0x08 Type 2 byte
0x09 Catch rate byte
0x0a Base Exp. Yield byte
0x0b Wild held item 1 byte
0x0c Wild held item 2 byte
0x0d Gender ratio byte
0x0e Unknown byte
0x0f Egg cycles byte
0x10 Unknown byte
0x11 Dimensions of frontsprite byte
0x12-0x15 Blank 4 bytes
0x16 Growth rate byte
0x17 Egg Groups byte
0x18-0x1f TM and HM flags 8 bytes

Notes

Types

For a single-type Pokémon, both types are set to the same value.

Wild held items

Main article: List of Pokémon by wild held item (Generation II)

The item entries refer to items by their index number. The first item has a 23% chance of being held when the Pokémon is encountered in the wild, while the second has a 2% chance of being held. However, if a special flag is set for a given battle, the Pokémon will always be holding its first item; this is used for Snorlax, Lugia, and Ho-Oh (although Lugia never has a held item).

Gender ratio

The gender ratio is expressed as a 1-byte threshold for the Pokémon to be male. The possible values are:

Gender threshold Gender ratio
Binary Decimal Male Female
11111111 255 Gender unknown
11111110 254 0.0% 100.0%
10111111 191 25.0% 75.0%
01111111 127 50.0% 50.0%
00111111 63 75.0% 25.0%
00011111 31 87.5% 12.5%
00000000 0 100.0% 0.0%

A Pokémon's gender is calculated based on this threshold value and the Pokémon's Attack IV, following a certain set of rules.

Frontsprite dimensions

One nybble each for width and height in 8×8 pixel tiles. They always match and are always 5, 6, or 7 tiles.

Blank

In the GB games, this is where the Pokémon's Lv.1 moves were stored. In GSC, Lv.1 moves were moved in with the rest of the moves.

Growth rate

  • 0. Medium Fast
  • 3. Medium Slow
  • 4. Fast
  • 5. Slow

Egg Groups

The low nybble is one group, and the high nybble is another. For a Pokémon in only one group, both are set to the same value.

TMs

The TMs which a Pokémon can learn are stored as a bunch of flags. Starting from the LSB of the first byte, and ending with the MSB of the last byte. The seven HMs are treated as TMs 51-57.

In Pokémon Crystal, 3 bits after the HMs are used to indicate the ability to be taught Flamethrower, Thunderbolt, and/or Ice Beam by the Move Tutor.

Fingerprint

Gold/Silver

01 2D 31 31 2D 41 41 16 03 2D 40 00 00 1F 64 14 05 55 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // BULBASAUR
02 3C 3E 3F 3C 50 50 16 03 2D 8D 00 00 1F 64 14 05 66 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // IVYSAUR
03 50 52 53 50 64 64 16 03 2D D0 00 00 1F 64 14 05 77 00 00 00 00 03 17 36 5E 3D C4 86 18 45 00  // VENUSAUR
04 27 34 2B 41 3C 32 14 14 2D 41 00 00 1F 64 14 05 55 00 00 00 00 03 1E A7 16 D9 CC E6 98 25 00  // CHARMANDER
05 3A 40 3A 50 50 41 14 14 2D 8E 00 00 1F 64 14 05 66 00 00 00 00 03 1E A7 16 D9 CC E6 98 25 00  // CHARMELEON
06 4E 54 4E 64 6D 55 14 02 2D D1 00 00 1F 64 14 05 77 00 00 00 00 03 1E B7 56 D9 CE F6 D8 2D 00  // CHARIZARD
07 2C 30 41 2B 32 40 15 15 2D 42 00 00 1F 64 14 05 55 00 00 00 00 03 12 AF B2 5B CC 87 18 B0 01  // SQUIRTLE
08 3B 3F 50 3A 41 50 15 15 2D 8F 00 00 1F 64 14 05 66 00 00 00 00 03 12 AF B2 5B CC 87 18 B0 01  // WARTORTLE
09 4F 53 64 4E 55 69 15 15 2D D2 00 00 1F 64 14 05 77 00 00 00 00 03 12 BF F2 5B CE 87 18 B0 01  // BLASTOISE
0A 2D 1E 23 2D 14 14 07 07 FF 35 00 00 7F 64 0F 05 55 00 00 00 00 00 33 00 00 00 00 00 00 00 00  // CATERPIE
...

Crystal

01 2D 31 31 2D 41 41 16 03 2D 40 00 00 1F 64 14 05 55 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // BULBASAUR
02 3C 3E 3F 3C 50 50 16 03 2D 8D 00 00 1F 64 14 05 66 00 00 00 00 03 17 26 1E 3D C4 86 18 45 00  // IVYSAUR
03 50 52 53 50 64 64 16 03 2D D0 00 00 1F 64 14 05 77 00 00 00 00 03 17 36 5E 3D C4 86 18 45 00  // VENUSAUR
04 27 34 2B 41 3C 32 14 14 2D 41 00 00 1F 64 14 05 55 00 00 00 00 03 1E A7 16 D9 CC E6 98 25 02  // CHARMANDER
05 3A 40 3A 50 50 41 14 14 2D 8E 00 00 1F 64 14 05 66 00 00 00 00 03 1E A7 16 D9 CC E6 98 25 02  // CHARMELEON
06 4E 54 4E 64 6D 55 14 02 2D D1 00 00 1F 64 14 05 77 00 00 00 00 03 1E B7 56 D9 CE F6 D8 2D 02  // CHARIZARD
07 2C 30 41 2B 32 40 15 15 2D 42 00 00 1F 64 14 05 55 00 00 00 00 03 12 AF B2 5B CC 87 18 B0 09  // SQUIRTLE
08 3B 3F 50 3A 41 50 15 15 2D 8F 00 00 1F 64 14 05 66 00 00 00 00 03 12 AF B2 5B CC 87 18 B0 09  // WARTORTLE
09 4F 53 64 4E 55 69 15 15 2D D2 00 00 1F 64 14 05 77 00 00 00 00 03 12 BF F2 5B CE 87 18 B0 09  // BLASTOISE
0A 2D 1E 23 2D 14 14 07 07 FF 35 00 00 7F 64 0F 05 55 00 00 00 00 00 33 00 00 00 00 00 00 00 00  // CATERPIE
...

Storage

The following are ROM offsets for the first entry (Bulbasaur) in each GBC game:

Game English Japanese
Gold 0x051B0B 0x051AA9
Silver 0x051B0B 0x051AA9
Crystal 0x051424 0x0514BA


Data structure in the Pokémon games
General Character encoding
Generation I Pokémon speciesPokémonPoké MartCharacter encodingSave
Generation II Pokémon speciesPokémonTrainerCharacter encoding (Korean) • Save
Generation III Pokémon species (EvolutionPokédexType chart)
Pokémon (substructures) • MoveContestContest moveItem
Trainer TowerBattle FrontierCharacter encoding (GameCube) • Save
Generation IV Pokémon species (EvolutionLearnsets)
PokémonSaveCharacter encoding (Wii)
Generation V–present Character encoding
Generation VIII Save
TCG GB and GB2 Character encoding
Project Games logo.png This data structure article is part of Project Games, a Bulbapedia project that aims to write comprehensive articles on the Pokémon games.