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 > Exceeding 128 Sprite Limit

#168512 - manycowsmoo - Sat May 02, 2009 3:29 am

I'm working on developing a port of Cultris (free multiplayer tetris) for the DS. I've looked at Patater's guide as a basis and that worked out great. The problem is, it says there's a sprite limit of 128. However, Cultris has 10 columns and 18 rows for a max of 180 pieces/sprites.

I've done some research and it looks like my options are use write to the OAM between frames or use the 3D mode and set up my sprites through that. But, I'm not sure how to do either of these. Could someone explain it to me or send me a tutorial/example?

Thanks for the help! :D

#168514 - Dwedit - Sat May 02, 2009 3:32 am

Simple answer: Don't use sprites.
Unless you need pieces which jiggle around or elaborately jump off when they're cleared, you can use background tiles for placed pieces.
If you aren't using a piece size which is a multiple of 8, you can still use affine backgrounds to get sizes which aren't multiples of 8.

Edit: I just looked at the game.
I see that the pieces jump down line by line after you clear lines below them. This effect can still be done with background tiles by varying the scroll position line by line, but it's tricky, and easier to do with sprites.
Your choices are either to use the 3D hardware to get more sprites, or use sprite multiplexing like on the GBA.

Piece shadows look tricky to do, since the DS only has full transparency in 3D mode.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#168521 - headspin - Sat May 02, 2009 12:17 pm

Dwedit wrote:
Piece shadows look tricky to do, since the DS only has full transparency in 3D mode.


I wonder if he could use the BLEND_CR register with the BLEND_ALPHA bit set. He might be able to do it by using priorties so only the "shadow" sprites are blended.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#168522 - AxemRed - Sat May 02, 2009 2:16 pm

Dwedit wrote:
Piece shadows look tricky to do, since the DS only has full transparency in 3D mode.

You can get per-pixel alpha blending if you also draw the background layer(s) with the 3d hardware.

#168523 - a128 - Sat May 02, 2009 3:06 pm

Multiplexing sprites on DS

http://blea.ch/wiki/index.php/Thsprite
_________________
"Hey! It compiles! Ship it!"

#168524 - hacker013 - Sat May 02, 2009 3:38 pm

you could use ulibrary, a 2d library which uses the 3d engine.
_________________
Website / Blog

Let the nds be with you.

#168548 - manycowsmoo - Mon May 04, 2009 5:15 pm

Thanks for the quick replies! My current goal is to get a very basic GUI done and then get the game up and running. After that I can add in all the fancy effects.

So to do shadows, I would pretty much need use the 3D hardware?

Also, if I were to use the 3D hardware, does that have any disadvantages rather than using sprite multiplexing? The only thing I can think of is it would use more power thus less battery life and I could only use one screen at a time (not an issue).

#168553 - Miked0801 - Mon May 04, 2009 9:43 pm

If you can use the 3D hardware for sprites. The system is MUCH more flexible than straight 2D and allows for better alpha and other effects that 2D just can't handle.

#168560 - Echo49 - Tue May 05, 2009 10:39 am

Miked0801 wrote:
and allows for better alpha and other effects that 2D just can't handle.

Do you have any information on the alpha? If I fade at different rates two separate quads that are overlapping, unless their z values are differing by about 0.003f or more they tend to fight for who appears on top (eg. flickering).

#168562 - Miked0801 - Tue May 05, 2009 6:39 pm

Per pixel alpha rocks. A3I5 mode and A5I3 allow you to do some awesome blend effects. That is in addition to full poly alpha.

On Z fighting, in a 2D scene, put it in Orthomode and don't move things around in much. That should take care of any roundoff flickering.

(P.S. - I'm using official devkit libs and such. I am not at all familiar with homebrew libs in this area.)