sprite engine init cacheSize

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

sprite engine init cacheSize

Post by matteus » Thu Sep 17, 2015 2:20 pm

I understand that SPR_init defines the tile allocation size. Must this number contain the total number of tiles for a complete animation of a sprite? So if I define a 10 x 6 (60 tile sprite) that has 10 frames of animation must I init the engine with 600 tiles or 60 tiles?

From my own observations of VRAM I'm going to say 60 but I'd like confirmation :)

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

Re: sprite engine init cacheSize

Post by Stef » Thu Sep 17, 2015 7:58 pm

SPR_init(..) defines the number of reserved tiles in VRAM for sprite display.
You don't have to reserve tiles for all animation, i would say you just need to reserve as much tiles that visible sprites are using... but that is not totally true. As you may have sort of "double buffering" (mean we load tiles for a new sprite animation frame while the previous is still displayed) it is usually better to reserve more. Imagine you want to display 10 sprites of 16 tiles each then a good cache size will be 16*10*2 (320).

Post Reply