Jump to content

Sprite compression (Generation I): Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1:
{{incomplete|needs proper analysis. The official method may also have been in the source code}}
 
'''Sprite compression''' is the means in Generation I for where pure graphics data is compressed into a Pokémon or Trainer sprite. The sprite is decompressed again using [[Sprite decompression (Generation I)|the sprite decompression routine]] and allocates use of SRAM bank 0/"unbanked" SRAM. While the source compressor code is not in the ROMs; there are a few rules for a compressed sprite:
 
*The image to compress is usually a maximum of 56x56 pixels. Other Pokémon sprites can be 32x32, 40x40, 48x48, or 56x56 pixels48x48.
*Each nybble of the starting offset to the compressed sprite is dimensions/8. Front sprites can be of various sizes; a 56x56 sprite is represented as 0x77, a 48x48 one as 0x66, a 40x40 one as 0x55, a 32x32 as 0x44.
*Backsprites are internally 32x32 pixels (0x44). Usually, these backsprites also have a little white space at the bottom (hidden by the battle menu).
*White space occupies smaller sprites to add up to 56x56.
*Unofficially, a .2bpp file can be converted into a compressed Pokémon sprite using the tool pkmncompress, and a .PNG into a compatible .2bpp file using rgbds. "Sprite import tools for RBY" can be downloaded within Evie's Google Sites backup(see [https://drive.google.com/drive/folders/1DAVPYay9sAuXwi4qXbDQfPU2sIDI_mXH?usp=sharingexternal here]links) (based on the previous work of the GB Dev and Skeetendo communities).
*It is possible for the sprite to be flipped for a non-00 value in memory address 0xD0AA ([[Pokémon Red and Blue]]) or 0xD0A9 ([[Pokémon Yellow]]). The [[inverse sprites glitch]] corrupts these memory addresses, possibly leading to glitched sprites.
 
Unintended compressed sprites with dimensions of 0 are known for their memory overflows, such as Yellow [[MissingNo.]]'s sprite (treated as dimensions of 256, or (256/8)=32).
 
If copying individual rows from a VRAM viewer, it may be necessary to rearrange the bytes; i.e. in this sample image for a 56x56 (0x44) sprite:
 
<pre>
00000000000000000100010206050506000000000000000019041D02CA15946B0000000000000000B7400EF131DEFD9200000000000000004000C020F010F010
5100FF001D00000001000102060105021000FE00D805080019041D02CA15946B0000A200ED100000B7400EF131DEF9920000000055000000400080201804040007000102060109000201010000000000730D37086B145CA3CDF753EF2FD7B1CE2FD0FD0211018C00C59EFB8E8E5FDF0E04000400000448807C5040303040C0200000000000000000000000000000000066DD87FFEF5DAD7EBB7CDC3FB17F3DFE570CEF00D500FF00E91741BE2CD7F30C7000A04020C0C080C000E08040C0E0C000000000000000000000000000000000F17F3DFADE7D3CFFEF7F26FF32FD3EFF22DDAFF06FF105FB3BD542BF25DF37C860C000E0A060C020806000E060E000E0
07040506020301010201010000000000F30DF708EB145CA3CDF753EF2FD7B1CE2FD0FD0211018C00C59EFB8E8E5FDF0E7090709070907090705050303040C020
0000000000000000000000000000000066DD87FFEF5DAD7EBB7CDC3FB17F3DFE570CEF00D500FF00E91741BE2CD7F30C7000A04020C0C080C000E08040C0E0C0
00000000000000000000000000000000F17F3DFADE7D3CFFEF7F26FF32FD3EFF22DDAFF06FF105FB3BD542BF25DF37C860C000E0A060C020806000E060E000E0
</pre>
 
Line 18 ⟶ 24:
 
<pre>
00000000000000000100010206050506|000000000000000019041D02CA15946B|0000000000000000B7400EF131DEFD92|00000000000000004000C020F010F010
5100FF001D0000000100010206010502|1000FE00D805080019041D02CA15946B|0000A200ED100000B7400EF131DEF992|00000000550000004000802018040400
0700010206010900020101000000000007040506020301010201010000000000|730D37086B145CA3CDF753EF2FD7B1CEF30DF708EB145CA3CDF753EF2FD7B1CE|2FD0FD0211018C00C59EFB8E8E5FDF0E|04000400000448807C5040303040C0207090709070907090705050303040C020
00000000000000000000000000000000|66DD87FFEF5DAD7EBB7CDC3FB17F3DFE|570CEF00D500FF00E91741BE2CD7F30C|7000A04020C0C080C000E08040C0E0C0
00000000000000000000000000000000|F17F3DFADE7D3CFFEF7F26FF32FD3EFF|22DDAFF06FF105FB3BD542BF25DF37C8|60C000E0A060C020806000E060E000E0
Line 27 ⟶ 33:
 
<pre>
00000000000000000100010206050506070405060203010102010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019041D02CA15946BF30DF708EB145CA3CDF753EF2FD7B1CE66DD87FFEF5DAD7EBB7CDC3FB17F3DFEF17F3DFADE7D3CFFEF7F26FF32FD3EFF0000000000000000B7400EF131DEFD922FD0FD0211018C00C59EFB8E8E5FDF0E570CEF00D500FF00E91741BE2CD7F30C22DDAFF06FF105FB3BD542BF25DF37C800000000000000004000C020F010F0107090709070907090705050303040C0207000A04020C0C080C000E08040C0E0C060C000E0A060C020806000E060E000E0
5100FF001D00000001000102060105020700010206010900020101000000000000000000000000000000000000000000000000000000000000000000000000001000FE00D805080019041D02CA15946B730D37086B145CA3CDF753EF2FD7B1CE66DD87FFEF5DAD7EBB7CDC3FB17F3DFEF17F3DFADE7D3CFFEF7F26FF32FD3EFF0000A200ED100000B7400EF131DEF9922FD0FD0211018C00C59EFB8E8E5FDF0E570CEF00D500FF00E91741BE2CD7F30C22DDAFF06FF105FB3BD542BF25DF37C80000000055000000400080201804040004000400000448807C5040303040C0207000A04020C0C080C000E08040C0E0C060C000E0A060C020806000E060E000E0
</pre>
 
Line 33 ⟶ 39:
 
<pre>
44BE1D54ECF6653AA4642AA541999A8B51707B0C63743EF0EE324CEFB0A21C36143C8CA6048970A8522212E0DC84329B0C8EE2A0A260A230E0A71CA5C341418942C1B3187DD0C5BB082EC62B555EB0A22A5D54BAAAA3D3DF4AD54849CF45533BD55DDD44AE550C1734173D1AA082D21048CC5642470C1C1321408261C12B07444168464A2861FB97A09861434F4D9095026B5AC182110AF959557863DB2150654AAAE820B487B2A09BC11E80
44BE9B70D04EA91B0AA9506666A2D45C1EC318D5043EF0EE324C70BEC28870D850F232206048970A852221250837210CA6C323B86182898288C3829C72970D0506250B06CC626D0C5BB082EC62B2FAC288A97552D210A3A62239AB9DEE9DFE42A0C72BA0FFFBA72791E8385B37FF777EE82BFFFFFE844C0A47DFFFF7742861A458C83FDFC3E17F77E0E8587EF84BEFFFFB7FE161F5E83AB3FFEBDF8E0FDE1C8DBFDFFFD8487FF8EAFBDFFD4D8A0C560BBEEC17FF628C957DD0C1505410A46AB6732770</pre>
</pre>
 
(Can be applied with [[arbitrary sprites]] or ROM hacking)
 
[[File:Sprite compression sample.png|thumb|left|160px|Sample image loaded using [[arbitrary sprites]] ([[GlitchDex/Y:230|9ゥ (E6)]] with default palette); exported drawing of Torchic from Game Boy Camera]]
{{clr}}
==External links==
*[https://rgmechex.com/tech/gen1decompress.html Retro Game Mechanics Explained's tool to compress and decompress sprites online (supports PNGs)]
*"Sprite import tools for RBY" can be downloaded within Evie's Google Sites backup [https://drive.google.com/drive/folders/1DAVPYay9sAuXwi4qXbDQfPU2sIDI_mXH?usp=sharing here]
[[Category:Generation I mechanics]]
Cookies help us deliver our services. By using our services, you agree to our use of cookies.