Page 1 of 1

SPRITE frame size limit

Posted: Thu Nov 07, 2019 3:37 pm
by hotrodx
Rescomp imposes a limit for a sprite frame to be 128px by 128px max. Is it a limit imposed by the MegaDrive hardware? Or can the sprite frame be larger than 128px by 128px as long as the final optimized cut of a sprite is less than 16 VDP sprites?

I ask because sprites can have empty spaces/tiles, so can't the tile savings be used outside the 128px x 128px boundary? Saves the hassle of handling two SPRITE structures.

Re: SPRITE frame size limit

Posted: Fri Nov 08, 2019 9:14 am
by Stef
Hardware sprite are limited to 32x32 pixels.
Rescomp limit (meta) sprite size to 128x128 to spare ROM space on sprite metadata (hardware sprite position) so it could use s8 type to define offset and collision information. Having > 128 w or h sprites would require using 16 bit offsets for both hard sprite position and collision informations.
Sprite metadata size can become "a problem" when you have many animation frames. For instance a single sonic sprite having about 10 animations with about 8 frames by animation, and each frame using 3 hardware sprites requires about 2KB of extra data when using s16 position offset compared to s8 offset (that is just for position, without taking collision in account).
So that's not really a limitation of the sprite engine by itself but just a trade off to limit ROM size, and also because you rarely have to use sprite biggger than 128 px (but that can happen indeed, in which case you have to split your sprite in several sprites).

Re: SPRITE frame size limit

Posted: Fri Nov 08, 2019 10:42 am
by hotrodx
Wouldn't it be possible to just use u8 to get the full 8bit range rather than s8? After all, a Sprite structure's natural anchor is upperleft anyway. Or is the sign bit used for something?

Re: SPRITE frame size limit

Posted: Fri Nov 15, 2019 10:43 am
by Stef
I tried to use u8 but remember it didn't worked for some reasons i forgot. I have to re-investigate it but almost certain it couldn't be done that easy :-/

Re: SPRITE frame size limit

Posted: Sat Nov 16, 2019 5:25 am
by hotrodx
Thanks for looking into it, anyway.