Talk:Pokémon data structure (Generation III): Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
mNo edit summary
(→‎Trainer ID: new section)
(One intermediate revision by one other user not shown)
Line 485: Line 485:
[[User:Mew151|<span style="color: #0e0151">Mew151</span>]] 16:50, 6 August 2009 (UTC)
[[User:Mew151|<span style="color: #0e0151">Mew151</span>]] 16:50, 6 August 2009 (UTC)
: The data you seek is right before your own party's data. All six slots. Wild encounters, trainer battles, trades, it all happens there. --[[User:Kyoufu Kawa|Kyoufu Kawa]] 19:51, 6 August 2009 (UTC)
: The data you seek is right before your own party's data. All six slots. Wild encounters, trainer battles, trades, it all happens there. --[[User:Kyoufu Kawa|Kyoufu Kawa]] 19:51, 6 August 2009 (UTC)
== Corrupted markings ==
I noticed something interesting in Werster's glitch hunting streams. Some of his bad eggs in the PC end up with a corrupted graphic in place of the circle/square/triangle/heart icons.
Since each icon corresponds to the state of one bit in the Pokemon data, it doesn't really make sense that there can be a state which displays corrupted icons. But perhaps the game is doing something strange with those extra bits nearby. Maybe it expects them to always be zero and fails to calculate which icon graphic to show if they're not. Or maybe some of those bits are an unused feature that would show some alternate graphic here, but the graphic is deleted? [[User:HyperHacker|⬡]] ([[User talk:HyperHacker|talk]]) 22:08, 13 May 2014 (UTC)
== Trainer ID ==
What order is this stored in - visible ID then secret ID, or the other way around? [[User:Seafarer|Seafarer]] ([[User talk:Seafarer|talk]]) 07:30, 23 September 2015 (UTC)

Revision as of 07:30, 23 September 2015

I'm gonna leave this to the experts here. WHAT IN THE WORLD DOES THIS MEAN?--Machamp ion 16:44, 10 August 2007 (UTC)

It's how the game is coded. Pretty complex stuff, but interesting nonetheless. TTEchidna 11:02, 3 September 2007 (UTC)
Yeah, basically each individual Pokémon in the game is defined by this structure. You got your wild encounter data and trainer data and that's just a simple species/level pair but when you actually encounter those monsters, they get a full 100 byte structure built up. Any specific questions? --Kyoufu Kawa 17:28, 5 September 2007 (UTC)

Using the Data

This page is beautiful. I was part way into cracking the data structure myself, having finally figured out the character set by making a Pokemon be named ABCDEEEE, and then searching the pattern in memory. I googled to see if anyone else had started documenting it, and I found the page for the 100-byte data structures! Anyways, how can you possible use this thing, with the damned "The save file is deleted" message? Easy: 1. Save the game state in VBA - you know the "Save Game - Oldest Slot" routing. The file that it makes is a GZIP'd copy of the GBA's RAM. So to edit it, just ungzip it!

zcat "Pokemon Sapphire7.sg2" > PS-7

2. Then run your hex editor on the PS-7 file... then put it back:

gzip PS-7
ren PS-7.gz "Pokemon Sapphire7.sg2"

A consequence of the fact that the last 20 bytes are discarded when the poke is boxed means you can play with those without triggering the bad-egg problem in the game right away; realistically speaking if the checksum is computed based on the 80 byte value it can't possibly cover the 100-byte value as well, right? More to come... Iliekmudkips 02:24, 25 September 2007 (UTC)

It is possible to change the original trainer name field without triggering the "Bad Egg" error, however I triggered it when playing with the personality of the pokemon sorta randomly. Perhaps not all values are actually in the checksum? Iliekmudkips 02:50, 25 September 2007 (UTC)

Damn right it doesn't. Only the substructures are actually checked. The live stats and name aren't. --Kyoufu Kawa 19:46, 25 September 2007 (UTC)
I have been able to perform a manual trade of sorts between saved states of VBA v1.8 with success. The 80 bytes values in the VBA saved state can literally be copy and pasted between games. The simplest way to do this is to paste the 80 bytes right on top of a Poke already in the box. Basically you follow the above procedure for step one above, but on two saved files. Open both in the hex editor, and copy/paste the value from one into the other, on top of a Poke that you don't mind "trading" out, like Magikarp. I have not yet tested this between different flavors of Gen 3, but it definitely works for Sapphire to Sapphire trades.
It'll work. I mentioned on my talk page that I'm working on that I'm working on an opensource G3 clone? Any monster it generates can be hand-copied to any original G3 game, the full 100 bytes. And yes, they'll be Outsiders, so they get boosted experiece and give you the finger if you lack badges. --Kyoufu Kawa 18:20, 27 September 2007 (UTC)
I saw something about openpoke, but didn't look long enough or couldn't find the source. I was considering a Boxed Trade Reader tool that would read a saved-state, rip the up to 420 Pokémon present in the user's box into compressed ASCII strings or simple hex. It would complement the Boxed Trade Writer tool, which would simply search for one particular Pokémon and replace it with another, as specified by the user using compressed strings or simple hex generated by the previous utility.
Boxed Trade Writer would consist of nothing more than decompression/recompression wrapping and sed, made user friendly, regardless of what type of saved memory dump it was editing.
Boxed Trade Reader would ideally be a little more advanced; if the Pokémon Box weren't at the anticipated location in memory, it ought to contain enough data analysis logic to be able to search out the general region of the boxed Pokémon. Finding repeats of 80 that don't repeat every 40 or every 16 bytes as well is pretty simple math, but verifying it all with the Pokémon checksum would make it foolproof, which is why I was most interested in your source code.
I may document this better in the future, also, I don't expect that 100% manual trading between game-based saves will ever work because of the whole ROM-checksum issue, there will always be some calculator or something needed.
I just used the Memory Viewer. Bit of a misnomer, cos it edits fine. --Kyoufu Kawa 18:20, 27 September 2007 (UTC)
Worth mention: The manually traded Poke will behave just like a wire-traded one, including boosted experience, if the original trainer ID is different.

Markings image

That thing's unnecesarily huge! I have a 1:1 scale version of the same if it's okay... --Kyoufu Kawa 18:19, 11 August 2008 (UTC)

I removed it, it was getting to be an eyesore. PuppyBoy 10:28, 3 October 2008 (UTC)
I guess that works too. Thank you. --Kyoufu Kawa 18:55, 3 October 2008 (UTC)

Level Recalc'ed using Experience

Spr RS Bird Keeper.png
PuppyBoy:
TALK - 09:19, 6 October 2008 (UTC)
Is there any documentation of how levels are recalculated? It can't simply be a simple division based on the species' growth speed can it?

Edit: 09:37, 6 October 2008 (UTC)

Never mind, it covers this in experience...


Sanity?

What on earth is the sanity byte? Is it the flag so that a pokemon will obey its trainer? Atomix26 23:00, 18 January 2009 (UTC)

Spr RS Bird Keeper.png
PuppyBoy:
TALK - 16:48, 6 March 2009 (UTC)
Kyoufu Kawa has a bit of research into sanity bytes on his user page -> User:Kyoufu_Kawa#Font_and_Sanity. It's apparently used in part to determine whether the poké is an egg or not.


Position in Save Data

Spr RS Bird Keeper.png
PuppyBoy:
TALK - 16:55, 6 March 2009 (UTC)
Is it worth opening this up to include information about the position of the data in actual save data? I'm not sure if it's out of scope or against Bulba guildlines.


I've seen data offsets on Bulbapedia before. The main problem is that the save data is encrypted and, I think, shifting. Including it would be useless IMHO. --Kyoufu Kawa 18:56, 6 March 2009 (UTC)

Wild Pokemon

Where is the data for wild Pokémon stored? The data can't be generated when you catch it. Mew151 16:50, 6 August 2009 (UTC)

The data you seek is right before your own party's data. All six slots. Wild encounters, trainer battles, trades, it all happens there. --Kyoufu Kawa 19:51, 6 August 2009 (UTC)

Corrupted markings

I noticed something interesting in Werster's glitch hunting streams. Some of his bad eggs in the PC end up with a corrupted graphic in place of the circle/square/triangle/heart icons.

Since each icon corresponds to the state of one bit in the Pokemon data, it doesn't really make sense that there can be a state which displays corrupted icons. But perhaps the game is doing something strange with those extra bits nearby. Maybe it expects them to always be zero and fails to calculate which icon graphic to show if they're not. Or maybe some of those bits are an unused feature that would show some alternate graphic here, but the graphic is deleted? (talk) 22:08, 13 May 2014 (UTC)

Trainer ID

What order is this stored in - visible ID then secret ID, or the other way around? Seafarer (talk) 07:30, 23 September 2015 (UTC)