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

Rescomp could detect duplicate frames in case of same sprite sheet with different colors #300

Open
thomasgoldstein opened this issue Nov 18, 2023 · 2 comments
Assignees

Comments

@thomasgoldstein
Copy link

Hi.

Consider the following scenario: 2 character sprite sheets that contain the exact same character frames, just with different colors (color indexes). In that case, rescomp will not realize it could avoid performing the sprite cutting on the second sheet.

I believe this is a relatively common scenario to work around the harsh color palette limitations of the Mega Drive. Xeno Crisis does this for the green and blue variants of the playable characters, for example.

What I guess you're doing internally in rescomp's sprite cutting logic is only care about which pixel is opaque or transparent, you don't care about the colors used, right? That means you could use that opaque vs transparent pixel matrix as a reference to determine whether a frame is a clone of an already-processed frame or not, which would cover the need above.

Just an idea. Thanks for entertaining the idea!

PS: This also makes me wonder if, ROM data wise, any data could be shared across such similar sprite sheets in order to reduce the footprint of similar sheets.

@thomasgoldstein
Copy link
Author

Here are example sprite sheets for your convenience.
Rescomp commands:

SPRITE sprite "sonic_blue.png" 11 11 NONE 0 NONE TILE
SPRITE sprite "sonic_red.png" 11 11 NONE 0 NONE TILE

sonic_blue

sonic_red

@Stephane-D Stephane-D self-assigned this Nov 23, 2023
@Stephane-D
Copy link
Owner

Stephane-D commented Nov 23, 2023

Hi @thomasgoldstein

Thanks the detailed report and the sprite sheets !
Indeed rescomp doesn't perform any check about duplicated sprite mask (opaque pixels shape) along all the sprite frames / animations / sheets and it would avoid recomputing the sprite cutting in that case as you said. Still that is not that easy to compare sprite mask along all already processed sprites, i guess I could compute a hash code based on the mask shape instead of the content...
I qualified your issue as enhancement and keep it open until i find sometime to work on that !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants