gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > newb: Sprites and BGs

#106368 - soivex - Wed Oct 18, 2006 12:16 pm

Hi.
My problem is that i need to display 64X64 (256 color mode) sprites. A lot of them. But i can only dislay 8 of them (i'm right?).
I'm in mode:
videoSetModeSub( MODE_5_2D | DISPLAY_SPR_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_1D );
and banks are:
vramSetMainBanks( VRAM_A_MAIN_BG, VRAM_B_MAIN_BG_0x6020000, VRAM_C_SUB_BG_0x6200000 , VRAM_D_SUB_SPRITE );

So, can i use vramSetBankI(VRAM_I_SUB_SPRITE);
to display additional sprites ?
So i have found no way to access to this additional memory.
If SPRITE_GFX_SUB is used for VRAM_D_SUB_SPRITE, so what memory address is used for VRAM_I_SUB_SPRITE ?

And it is possible:

MainMode: 5_2D | BG_3 | BG_2
SubMode 5_2D | BG_3 | BG_2 | SPRITES ?

In this case what banks should i use?

Thanks!

#106383 - PypeBros - Wed Oct 18, 2006 4:04 pm

afaik, you will not extend how much sprite memory you map just by mapping SUB_SPRITES several times. That works with MAIN_BG because you can map either MAIN_BG_600000 or MAIN_BG_620000. there's no more magic there.

btw, you're allowed 128K of sprites, right ? and 64x64 sprites takes what ... 4K of memory. That still means 32 sprites allowed (okay, not much impressive for a shoot-m-up, but better than 8, isn't it?)

Have you considered the option of having several OAMs pointing at the same tiles data or rewriting tiles data during the animation (rather than just changing the OAM tile number to a new frame)?
_________________
SEDS: Sprite Edition on DS :: modplayer

#106533 - soivex - Fri Oct 20, 2006 8:57 am

Thanks for replay but...

64x64 sprites takes 4k memory it's ok, but it takes 128 tiles each.
And there is only 1024 tiles that i can choose from for the attribute[2].

So i can display only 1024/128=8 sprites at time ? I need about 10 at time, and they all different.

Or i'm misunderstanding something ?

Thanks!

#106536 - PypeBros - Fri Oct 20, 2006 9:33 am

there's a register that can be used to multiply the tile index given in the OAM attributes. That'd mean you can use more than 128 tiles if you're ready to accept you can only use sprites with tileno=0, tileno=4, tileno=8 ...

Quote:

/* DISPLAY_SPR_1D_SIZE_32: fine for 16-colours if you need tile-granularity
* DISPLAY_SPR_1D_SIZE_64: tile-granularity for 256-colours sprites
* DISPLAY_SPR_1D_SIZE_128: vram = index*2. 'odd' tiles cannot be used alone,
* but that lets us use the whole 128KB of sprites tiles memory on engine B
* DISPLAY_SPR_1D_SIZE_256: vram = index*4. TeH only way to use full 256 VRAM
* for sprites on engine A.
*/

_________________
SEDS: Sprite Edition on DS :: modplayer