Page 1 of 1

Show 30 Sprites or more [solved]

Posted: Thu Apr 26, 2018 5:09 pm
by cloudstrifer
Hi, I want to show 30 Sprites or more at once.

I have 5 (16x16 px) different sprites, is there a way to show more than 16?

Thank you!

Re: Show 30 Sprites or more

Posted: Thu Apr 26, 2018 5:40 pm
by carpediem
I don't know if it's a SGDK limitation because out of the box, Genny can display 80 sprites simulltaneously,
the only limitation to 16 I'm aware is about different sprite dimensions.

Maybe Stef could clarify this one for us ;)

Re: Show 30 Sprites or more

Posted: Fri Apr 27, 2018 7:11 am
by Stef
It depends about how much VRAM you allocate to the sprite engine, but of course you can display more than 30 16x16 sprites.
Still remember you can't display more than 20/16 sprites (H40/H32) on a single scanline.

Re: Show 30 Sprites or more

Posted: Fri Apr 27, 2018 1:22 pm
by cloudstrifer
It shows only first 16 sprites.
Sorry, but i don't know how to inspect VRAM.

Item, objects, enemy and icons are 16x16px.
char01 and char02, enemy2, enemy3 are 24x40px (width x height).

Code: Select all

arrPlayers[0] = SPR_addSprite(&char01_sprite, 160, 160, TILE_ATTR(PAL1, TRUE, FALSE, FALSE));
arrPlayers[1] = SPR_addSprite(&char02_sprite, 176, 160, TILE_ATTR(PAL1, TRUE, FALSE, FALSE));

icon_p1 = SPR_addSprite(&icon_sprite, 6, 10, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
icon_p2 = SPR_addSprite(&icon2_sprite, 272, 10, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

// init item sprites
arrItens[0] = SPR_addSprite(&item_sprite, 16, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[1] = SPR_addSprite(&item_sprite, 16, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[2] = SPR_addSprite(&item_sprite, 32, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[3] = SPR_addSprite(&item_sprite, 48, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[4] = SPR_addSprite(&item2_sprite, 64, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[5] = SPR_addSprite(&item3_sprite, 80, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[6] = SPR_addSprite(&item4_sprite, 96, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

arrObjects[0] = SPR_addSprite(&object_sprite, 16, 144, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[1] = SPR_addSprite(&object_sprite, 16, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[2] = SPR_addSprite(&object_sprite, 32, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[3] = SPR_addSprite(&object_sprite, 48, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[4] = SPR_addSprite(&object_sprite, 48, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[5] = SPR_addSprite(&object_sprite, 64, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[6] = SPR_addSprite(&object_sprite, 80, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[7] = SPR_addSprite(&object2_sprite, 96, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[8] = SPR_addSprite(&object2_sprite, 112, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[9] = SPR_addSprite(&object2_sprite, 128, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[10] = SPR_addSprite(&object3_sprite, 144, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

arrEnemies[0] = SPR_addSprite(&enemy_sprite, 160, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[1] = SPR_addSprite(&enemy_sprite, 160, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[2] = SPR_addSprite(&enemy_sprite, 176, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[3] = SPR_addSprite(&enemy_sprite, 176, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[4] = SPR_addSprite(&enemy2_sprite, 208, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[5] = SPR_addSprite(&enemy3_sprite, 208, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

SPR_update();
Thank you!

Re: Show 30 Sprites or more

Posted: Sat Apr 28, 2018 6:57 am
by mix256
Try to set as few as possible on the same row to see how that affect things.
Y-pos 112 and 128 are the same row for a 24x32 sprite.

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 1:43 pm
by cloudstrifer
Same problem, I can't show more than 16 sprites.

I have distributed the sprites by all screen, changed priority, creating one by one by pressing buttons.
Sem títulox.png
Sem títulox.png (8.7 KiB) Viewed 2032 times

:(

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 2:42 pm
by mix256
Show us all the code?

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 3:41 pm
by cloudstrifer
cloudstrifer wrote:
Fri Apr 27, 2018 1:22 pm
It shows only first 16 sprites.
Sorry, but i don't know how to inspect VRAM.

Item, objects, enemy and icons are 16x16px.
char01 and char02, enemy2, enemy3 are 24x40px (width x height).

Code: Select all

arrPlayers[0] = SPR_addSprite(&char01_sprite, 160, 160, TILE_ATTR(PAL1, TRUE, FALSE, FALSE));
arrPlayers[1] = SPR_addSprite(&char02_sprite, 176, 160, TILE_ATTR(PAL1, TRUE, FALSE, FALSE));

icon_p1 = SPR_addSprite(&icon_sprite, 6, 10, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
icon_p2 = SPR_addSprite(&icon2_sprite, 272, 10, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

// init item sprites
arrItens[0] = SPR_addSprite(&item_sprite, 16, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[1] = SPR_addSprite(&item_sprite, 16, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[2] = SPR_addSprite(&item_sprite, 32, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[3] = SPR_addSprite(&item_sprite, 48, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[4] = SPR_addSprite(&item2_sprite, 64, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[5] = SPR_addSprite(&item3_sprite, 80, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrItens[6] = SPR_addSprite(&item4_sprite, 96, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

arrObjects[0] = SPR_addSprite(&object_sprite, 16, 144, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[1] = SPR_addSprite(&object_sprite, 16, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[2] = SPR_addSprite(&object_sprite, 32, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[3] = SPR_addSprite(&object_sprite, 48, 160, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[4] = SPR_addSprite(&object_sprite, 48, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[5] = SPR_addSprite(&object_sprite, 64, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[6] = SPR_addSprite(&object_sprite, 80, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[7] = SPR_addSprite(&object2_sprite, 96, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[8] = SPR_addSprite(&object2_sprite, 112, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[9] = SPR_addSprite(&object2_sprite, 128, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrObjects[10] = SPR_addSprite(&object3_sprite, 144, 176, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

arrEnemies[0] = SPR_addSprite(&enemy_sprite, 160, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[1] = SPR_addSprite(&enemy_sprite, 160, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[2] = SPR_addSprite(&enemy_sprite, 176, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[3] = SPR_addSprite(&enemy_sprite, 176, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[4] = SPR_addSprite(&enemy2_sprite, 208, 112, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
arrEnemies[5] = SPR_addSprite(&enemy3_sprite, 208, 128, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));

SPR_update();
Thank you!

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 4:50 pm
by mix256
That's hardly all your code, is it?

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 7:04 pm
by cloudstrifer
Basicaly this is my code.

Re: Show 30 Sprites or more

Posted: Mon Apr 30, 2018 8:25 pm
by cloudstrifer
:shock: So dumb!

Code: Select all

SPR_init(80, 256, 256);

Thank you!

Re: Show 30 Sprites or more [solved]

Posted: Tue May 01, 2018 5:55 am
by mix256
:D