Show 30 Sprites or more [solved]

SGDK only sub forum

Moderator: Stef

Post Reply
User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Show 30 Sprites or more [solved]

Post by cloudstrifer » Thu Apr 26, 2018 5:09 pm

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!
Last edited by cloudstrifer on Mon Apr 30, 2018 8:26 pm, edited 1 time in total.

User avatar
carpediem
Newbie
Posts: 4
Joined: Fri Nov 10, 2017 9:02 pm
Location: Brazil
Contact:

Re: Show 30 Sprites or more

Post by carpediem » Thu Apr 26, 2018 5:40 pm

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 ;)
If i'ts greater than 0, is breathing or can do bankswitching, everything is possible :D

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

Re: Show 30 Sprites or more

Post by Stef » Fri Apr 27, 2018 7:11 am

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.

User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Re: Show 30 Sprites or more

Post by cloudstrifer » 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!

mix256
Very interested
Posts: 96
Joined: Thu Jan 25, 2018 2:08 pm
Location: Sweden
Contact:

Re: Show 30 Sprites or more

Post by mix256 » Sat Apr 28, 2018 6:57 am

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.

User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Re: Show 30 Sprites or more

Post by cloudstrifer » Mon Apr 30, 2018 1:43 pm

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 355 times

:(

mix256
Very interested
Posts: 96
Joined: Thu Jan 25, 2018 2:08 pm
Location: Sweden
Contact:

Re: Show 30 Sprites or more

Post by mix256 » Mon Apr 30, 2018 2:42 pm

Show us all the code?

User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Re: Show 30 Sprites or more

Post by cloudstrifer » Mon Apr 30, 2018 3:41 pm

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!

mix256
Very interested
Posts: 96
Joined: Thu Jan 25, 2018 2:08 pm
Location: Sweden
Contact:

Re: Show 30 Sprites or more

Post by mix256 » Mon Apr 30, 2018 4:50 pm

That's hardly all your code, is it?

User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Re: Show 30 Sprites or more

Post by cloudstrifer » Mon Apr 30, 2018 7:04 pm

Basicaly this is my code.
Attachments
test.rar
(130.59 KiB) Downloaded 13 times

User avatar
cloudstrifer
Interested
Posts: 23
Joined: Mon Feb 19, 2018 7:31 pm

Re: Show 30 Sprites or more

Post by cloudstrifer » Mon Apr 30, 2018 8:25 pm

:shock: So dumb!

Code: Select all

SPR_init(80, 256, 256);

Thank you!

mix256
Very interested
Posts: 96
Joined: Thu Jan 25, 2018 2:08 pm
Location: Sweden
Contact:

Re: Show 30 Sprites or more [solved]

Post by mix256 » Tue May 01, 2018 5:55 am

:D

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest