SPRITE frame size limit

SGDK only sub forum

Moderator: Stef

Post Reply
hotrodx
Interested
Posts: 49
Joined: Thu Mar 21, 2019 1:23 pm

SPRITE frame size limit

Post by hotrodx » Thu Nov 07, 2019 3:37 pm

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.

Stef
Very interested
Posts: 2990
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: SPRITE frame size limit

Post by Stef » Fri Nov 08, 2019 9:14 am

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).

hotrodx
Interested
Posts: 49
Joined: Thu Mar 21, 2019 1:23 pm

Re: SPRITE frame size limit

Post by hotrodx » Fri Nov 08, 2019 10:42 am

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?

Stef
Very interested
Posts: 2990
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: SPRITE frame size limit

Post by Stef » Fri Nov 15, 2019 10:43 am

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 :-/

hotrodx
Interested
Posts: 49
Joined: Thu Mar 21, 2019 1:23 pm

Re: SPRITE frame size limit

Post by hotrodx » Sat Nov 16, 2019 5:25 am

Thanks for looking into it, anyway.

Post Reply