Talk:Pokémon data structure (Generation I)
I'm wondering if we should rename these to "Pokémon data structure in Generation I", "II", "III", and so on. After all, we've had other GBC, GBA, and DS games with Pokémon, right? TTEchidna 10:47, 17 November 2007 (UTC)
- So this idea never went ahead? - TIMMY 12:16, 13 December 2008 (UTC)
Using this in Visual Boy Advance
Thanks for this page guys, i used this to find the codes in the memory viewer and edit my party! I wrote down the offsets for every piece of data for the pokemon using this guide (if you want a copy, just ask) and now it's easy to change the data of my pokemon. I also found the offsets for a couple of other things like the nicknames. You can change everything about the pokemon including the species. I also just cracked the GBC ones too, i didn't find the nicknames there though... Thanks for this page anyway. (GT4GTR 13:42, 21 December 2008 (UTC))
Maybe we can expand this page a little if anyone's intrested... ;) (GT4GTR 13:40, 21 December 2008 (UTC))
I tried to post what i found here but it didn't turn out quite right. (GT4GTR 13:42, 21 December 2008 (UTC))
- I fixed it for you:
|GT4GTR's list of Pokémon data memory locations in Red/Blue|
1st pkmn Species d164 byte Remaining HP d16c-d16d word ? d16e byte Status d16f byte ? d170-d172 3 bytes Attack 1 d173 byte Attack 2 d174 byte Attack 3 d175 byte Attack 4 d176 byte OT ID d177-d178 word Experience d179-d17b 3 bytes Effort data d17c-d185 10 bytes DVs d186-d187 word PP1 d188 byte PP2 d189 byte PP3 d18a byte PP4 d18b byte level d18c byte HP d18d-d18e word Attack d18f-d190 word Defense d191-d192 word Speed d193-d194 word Special d195-d196 word Name d2b5 10 bytes 2nd pkmn Species d165 byte Remaining HP d198-d199 word ? d19a byte Status d19b byte ? d19c-d19e 3 bytes Attack 1 d19f byte Attack 2 d1a0 byte Attack 3 d1a1 byte Attack 4 d1a2 byte OT ID d1a3-d1a4 word Experience d1a5-d1a7 3 bytes Effort data d1a8-d1b1 10 bytes DVs d1b2-d1b3 word PP1 d1b4 byte PP2 d1b5 byte PP3 d1b6 byte PP4 d1b7 byte level d1b8 byte HP d1b9-d1ba word Attack b1bb-d1bc word Defense d1bd-d1be word Speed d1bf-d1c0 word Special d1c1-d1c2 word Name d2c0 10 bytes 3rd pkmn Species d166 byte Remaining HP d1c4-d1c5 word ? d1c6 byte Status d1c7 byte ? d1c8-d1ca 3 bytes Attack 1 d1cb byte Attack 2 d1cc byte Attack 3 d1cd byte Attack 4 d1ce byte OT ID d1cf-d1d0 word Experience d1d1-d1d3 3 bytes Effort data d1d4-d1dd 10 bytes DVs d1de-d1df word PP1 d1e0 byte PP2 d1e1 byte PP3 d1e2 byte PP4 d1e3 byte level d1e4 byte HP d1e5-d1e6 word Attack d1e7-d1e8 word Defense d1e9-d1ea word Speed d1eb-d1ec word Special d1ed-d1ee word Name d2Cb 10 bytes 4th pkmn Species d167 byte Remaining HP d1f0-d1f1 word ? d1f2 byte Status d1f3 byte ? d1f4-d1f6 3 bytes Attack 1 d1f7 byte Attack 2 d1f8 byte Attack 3 d1f9 byte Attack 4 d1fa byte OT ID d1fb-d1fc word Experience d1fd-d1ff 3 bytes Effort data d200-d209 10 bytes DVs d20a-d20b word PP1 d20c byte PP2 d20d byte PP3 d20e byte PP4 d20f byte level d210 byte HP d211-d212 word Attack d213-d214 word Defense d215-d216 word Speed d217-d218 word Special d219-d21a word Name d2d6 10 bytes 5th pkmn Species d168 byte Remaining HP d21c-d21d word ? d21e byte Status d21f byte ? d220-d122 3 bytes Attack 1 d223 byte Attack 2 d224 byte Attack 3 d225 byte Attack 4 d226 byte OT ID d227-d228 word Experience d229-d22b 3 bytes Effort data d22c-d235 10 bytes DVs d236-d237 word PP1 d238 byte PP2 d239 byte PP3 d23a byte PP4 d23b byte level d23c byte HP d23d-d23e word Attack d23f-d240 word Defense d241-d242 word Speed d243-d244 word Special d245-d246 word Name d2e2 10 bytes 6th pkmn Species d169 byte Remaining HP d248-d249 word ? d24a byte Status d24b byte ? d24c-d24e 3 bytes Attack 1 d24f byte Attack 2 d250 byte Attack 3 d251 byte Attack 4 d252 byte OT ID d253-d254 word Experience d255-d257 3 bytes Effort data d258-d261 10 bytes DVs d262-d263 word PP1 d264 byte PP2 d265 byte PP3 d266 byte PP4 d267 byte level d268 byte HP d269-d26a word Attack d26b-d26c word Defense d26d-d26e word Speed d26f-d270 word Special d271-d272 word Name d2ec 10 bytes
I noticed some other things while poking around in the memory:
- Pokémon Red/Blue don't use ASCII. The alphabet is as follows:
- Character 50 terminates a string.
- Characters 60-6F are bold ABCDEFGHIVSLM, colon, and katakana small I and U. (I think)
- Characters 70-75 are both single quotes, both double quotes, floating dot, and floating ellipis.
- Characters 76-7E are small hiragana A, E and O, and five menu border characters.
- Character 7F is space.
- Characters 80-99 are uppercase A through Z.
- Characters 9A-9F are ():;.
- Characters A0-B9 are lowercase a through z.
- Characters BA-BF are é, 'd, 'l, 's, 't, and 'v.
- Characters C0-DF appear to be blank.
- Characters E1-E9 are PK, MN, -, 'r, 'm, ?, !, ., and small katakana A.
- Characters EA-EF are small katakana U, small katakana I, white right facing triangle, black right facing triangle, black down facing triangle, and the male symbol.
- Characters F0-F5 are the Pokédollar logo, multiplication cross, full stop, slash, comma, and female symbol.
- Characters F6-FF are the digits 0 through 9.
- Other characters seem to do weird things.
- Your trainer name appears at d158-d15e. d15f has a value of '50', "string end". The seven-character name limit might be so that the name fits in a convenient eight-byte spot, including a stop byte. Your trainer name appears again at d9ac. (Perhaps one of these is the Original Trainer of your first carried Pokémon?)
- d160-d162 appear to be 00. The eight bytes from d163-d16a store the current party. The first byte stores the number of Pokémon carried. This is followed by one byte giving the species of each Pokémon, followed by an 'FF' byte. If there are less than six Pokémon, all bytes after the FF are 00. (For example, a party of three Bulbasaurs (internal number 99) will read "03 99 99 99 FF 00 00 00".)
- After the eight-byte list comes the 44-byte data structure Pokémon #1 (in d16b-d196). Here's the weird thing: The Pokémon species number is duplicated here as the first byte, but the game only actually looks at the entry in the eight-byte list at the beginning. Changing the species ID in the structure has no effect. In fact, if you change the first species ID to Mew and the second to Krabby, then store it in the box and take it back out, even if you switched boxes in the meantime, the resulting Pokémon will be the same: appearing as a Mew, with Mew's species ID in the list, but Krabby's species ID still in the 44-byte structure.
- Current HP is actually stored as one lower: for example, if you have 5HP it will record "00 04". This is because it begins counting at 0.
- Your rival's name can be found from d34a-d351, at least while you fight him. This may be the case for trainers in general.
- Your opponent's data can be found at around D8A4.
- Your rival and random trainers have the same Trainer ID as you. It's reasonable to assume that this is the case for all trainers in at least all Generation I and II games.
- The one-byte mystery field and three-byte mystery field are still a mystery. The one-byte field appears to always remain at 00 (perhaps two bytes were initially reserved for status effects). The three-byte field on my Charmander read "14 14 2D", with my rival's Squirtle reading "15 15 2D" and a Bug Catcher's Pokémon "07 04 FF". Perhaps it's related to Secret ID, or DVs? Are any of these bytes used by Pokémon traded back from Generation II?
--JDigital 11:43, 6 May 2009 (UTC)
Action update: I went through the Pokémon Red in Japanese to see if the mystery bytes used to do something. It's still a mystery, but I discovered the following which may be of interest to someone:
- The three-byte field in a new Charmander is 14 14 2D, just as it was in an English game. It's thus probably not a checksum or Secret ID, nor is it a random value. The one-byte field is 00; perhaps status was originally two bytes but the interactions of multiple statuses was undesirable.
- The Pokémon data which begins at D16x in English begins at D12x in JP. Eight-bite party data is D123-D12A and Pokémon #1 is from D12B-D156.
- You may have noticed a gap at the beginning of D160 in the English version, and wondered if anything was there originally. In the JP version, the player's trainer name was stored here, from D11D to D122. Presumably the Trainer ID location was moved in the English version because it wouldn't fit: trainer names are five characters in JP, seven characters in EN. The extra length of trainer names may explain why EN-JP trades don't function correctly.
- Original trainer names for the current Pokémon are stored in a thirty-six byte set (six bytes per Pokémon) from D233-D256.
- Nicknames for the current Pokémon are stored in a thirty-six byte set (six bytes per Pokémon) from D257-D27A, followed by "08" at D27B.
- The alphabet is as follows:
- Character 50 terminates a string.
- Characters 60-6F are bold ABCDEFGHIVSLM, colon, and katakana small I and U.
- Characters 70-75 are both thin quotes, both thick quotes, floating dots and floating ellipis.
- Characters 76-7E are small hiragana A, E and O, and five menu border characters (different to English).
- Character 7F is space.
- Characters 80-B0 are katakana.
- Characters B1-E2 are hiragana.
- Characters E3-E9 are dash, dot, tenten, ?, !, full stop, and small katakana A.
- Characters E9-EF are small katakana U, small katakana I, white right facing triangle, black right facing triangle, black down facing triangle, and the male symbol. (same as Eng)
- Characters F0-F5 are the currency symbol, multiplication cross, full stop, slash, small katakana O, and female symbol.
- Characters F6-FF are the digits 0 through 9, as in Character.
- Low characters such as 0A-0F represent characters with 'tenten' applied (two dashes, or a dot). (in English these characters just make weird stuff happen)
- Other characters seem to do weird things.
- The odd character mapping of the English version (A = 0x80, rather than 0x41 in ASCII) makes sense when you consider that the Japanese characters used the second half of the byte values (0x80-0xFF), as foreign character sets tend to do so as not to clash with ASCII which uses the first half (0x00-0x7F). The developers eventually did use some of the first half after they ran out of space in the upper half and needed more characters (small hiragana vowels, characters with tenten applied, quote marks). The English translators took the most straightforward approach and replaced the Japanese characters with English, rather than move special characters around and reprogram it to use ASCII.
- When a Pokémon battle begins and the trainer unleashes a Pokémon, parts of data from the trainer's current Pokémon are copied to a structure beginning at D000. The first three bytes (D000-D002) are the "mystery bytes"; other data includes stats, attacks, level, DVs, and I possibly trainer ID. If the mystery 3 bytes are edited before battle they are still copied, though I can't see that they have any effect.
--JDigital 06:11, 7 May 2009 (UTC)
Is it possible that one of the unknown bytes is the held item when traded to G/S/C? After all, when you trade a Pokémon from R/B/Y to G/S/C, it almost always (if not always) holds some item. And sometimes the items are different in Yellow! And when you give a Pokémon an item and then trade to R/B/Y, the R/B/Y game somehow remembers what item it's holding... Blaziken257 07:21, 13 April 2009 (UTC)
- That sounds nice. --Kyoufu Kawa 19:49, 23 May 2009 (UTC)
I just did a major cleanup of this article, to wikify it, clarify some fields of the data structure from elements of this talk page, copyedit for grammar and spelling, and modify the tone of the article.
Feel free to criticise, edit further with more information, etc. I took the liberty to remove the stub template and cleanup template; add them back if needed. Looce 03:58, 24 October 2009 (UTC)