I'm about to implement a new metasprite format that increases the efficicency of coding sprites dramatically, as suggested by Drag.
It is backwards compatible with the old format, so that when I implement it I can slowly change my sprites and test them ones after eachother without having all the "not yet converted to new format" ones display as garbage.
I don't know but I feel like it should be possible to improve it even further. Like by using the rarely used priority bit for compression.
Anyhow, here is the format :
1) 1st sprite is NEVER compressed
2) Extra bits in the attribute byte specify how the *next* sprite is compressed, as follows :
It is backwards compatible with the old format, so that when I implement it I can slowly change my sprites and test them ones after eachother without having all the "not yet converted to new format" ones display as garbage.
I don't know but I feel like it should be possible to improve it even further. Like by using the rarely used priority bit for compression.
Anyhow, here is the format :
1) 1st sprite is NEVER compressed
2) Extra bits in the attribute byte specify how the *next* sprite is compressed, as follows :
Code:
** THIS IS DEPREDATED -- SEE MY LATER POST FOR A BETTER VARIANT **
yyyyyyyy --- Sprite Y coordinate (ommited if compression 1, 2, 3, 5, 6, 7)
vhbcccpp --- Attribute byte (always)
||||||||
||||||++---- Sprite Colour
|||+++------ Compression bits : 000 - next sprite is not compressed (next has : Y, AT, Tile, X)
||| 001 - next sprite has X coordinate = current X + 8, and Y = current Y (next has : AT, Tile)
||| 010 - next sprite has Y coordinate = current Y + 8 (next has : AT, Tile, X)
||| 011 - next sprite has Y coordinate = current Y + 8, and X = first sprite's X (next has : AT, Tile)
||| 100 - this is the last sprite of the metasprite (no next sprite)
||| 101 - same as 001, with tile # = current tile # + 1 (next has : AT)
||| 110 - same as 010, with tile # = current tile # + 16 (next has : AT, X)
||| 111 - same as 011, with tile # = current tile # + 1 (next has : AT)
||+--------- Behind BG : If set, the sprite is behind background
|+---------- Horizontal flipping
+----------- Vertical flipping
tttttttt --- Tile number (ommited if compression 5, 6, 7)
xxxxxxxx --- Sprite X coordinate (ommited if compression 1, 3, 5, 7)
yyyyyyyy --- Sprite Y coordinate (ommited if compression 1, 2, 3, 5, 6, 7)
vhbcccpp --- Attribute byte (always)
||||||||
||||||++---- Sprite Colour
|||+++------ Compression bits : 000 - next sprite is not compressed (next has : Y, AT, Tile, X)
||| 001 - next sprite has X coordinate = current X + 8, and Y = current Y (next has : AT, Tile)
||| 010 - next sprite has Y coordinate = current Y + 8 (next has : AT, Tile, X)
||| 011 - next sprite has Y coordinate = current Y + 8, and X = first sprite's X (next has : AT, Tile)
||| 100 - this is the last sprite of the metasprite (no next sprite)
||| 101 - same as 001, with tile # = current tile # + 1 (next has : AT)
||| 110 - same as 010, with tile # = current tile # + 16 (next has : AT, X)
||| 111 - same as 011, with tile # = current tile # + 1 (next has : AT)
||+--------- Behind BG : If set, the sprite is behind background
|+---------- Horizontal flipping
+----------- Vertical flipping
tttttttt --- Tile number (ommited if compression 5, 6, 7)
xxxxxxxx --- Sprite X coordinate (ommited if compression 1, 3, 5, 7)