Talk:Pokémon data structure (Generation I)

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search

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)

Yeah, it's a good idea. File:Ani154MS.gifNetto-kunFile:Ani394MS.gif 11:05, 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:

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 "01 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)

Held Items?

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)

Article rename

It may be more consistent to rename this article to "Pokémon data structure (Generation I)", and the same with other articles. --JDigital 00:44, 5 May 2009 (UTC)