Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert internal sprite data format to binary #143

Open
Esshahn opened this issue May 1, 2019 · 3 comments
Open

Convert internal sprite data format to binary #143

Esshahn opened this issue May 1, 2019 · 3 comments
Labels

Comments

@Esshahn
Copy link
Owner

Esshahn commented May 1, 2019

The current sprite data uses 0,1,2,3 to represent the sprite colors transparent, single color, mc1 and mc2. This is a typical sprite in multicolor:

[2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0]

screenshot 2019-05-01 um 12 04 39

This causes all kinds of hacks, e.g. that multicolor changes only every second value and ignores the rest (so that only 12 values instead of 24 are read).

Instead, the file format should properly represent the bit values, like

0 = 00
1 = 01
2 = 10
3 = 11

I see two options to go for:

  1. Split the bit value into two numbers
0,1,1,1,0,0,1,0,0,1 etc.

The sprite array would remain at 24x21 size, but two numbers would make up for either one multicolor or two singlecolor values.

  1. Use 0,1,2,3 and split it into bit value
0,2,1,1,3,2,1 etc.

The sprite array would become half the size at 12x21.
Another advantage could be that if there's every going to be a version of Spritemate that supports other systems and color ranges, this format would work better.

Which one is the better approach?

@Esshahn
Copy link
Owner Author

Esshahn commented May 1, 2019

Could use your advice here, @nurpax :)

@nurpax
Copy link
Contributor

nurpax commented May 1, 2019

Option 2 seems better, if the rest of your code can handle 24x21 vs 12x21 array sizes.

The choice kind of depends on how your code is structured, but it does kind of feel like say looping over pixels would iterate over whole integer elements (one int == one pixel).

@nurpax
Copy link
Contributor

nurpax commented May 1, 2019

Agreed that should you add say 8 bit colors with a color palette, then option 2 would support that better.

@Esshahn Esshahn added this to the Backlog & Ideas milestone May 1, 2019
@Esshahn Esshahn added the EPIC label May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants