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.

Beginners > Sprite multiplexing

#58118 - blacksun - Fri Oct 21, 2005 12:16 am

I was wondering if there are any tutorials out for this? In order for me to do what I want I will need over the 128 sprite limit. Either that or create a bunch of different sprites. I have searched the forums and am getting a basic understanding of how it works. I just need to know how to implement it. I already have interrupts set up so that's not a problem.

#58193 - thegamefreak0134 - Fri Oct 21, 2005 4:02 pm

What on earth could you possibly need more than 128 sprites for?
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#58196 - tepples - Fri Oct 21, 2005 4:09 pm

Lots of enemies and bullets in a shooter, perhaps? The Neo-Geo had 380 sprites.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#58207 - poslundc - Fri Oct 21, 2005 4:55 pm

There are no tutorials I'm aware of. It's not really a tutorial-oriented topic.

To implement it, write different values to the relevant OAM entries in HBlank, making sure that the force HBlank processing bit is turned on in REG_DISPCNT. Which values you write to and on which scanlines is going to be entirely tuned to your game design. You're going to have to come up with your own system to determine that.

Dan.

#58218 - blacksun - Fri Oct 21, 2005 6:56 pm

Ok I guess I get to mess with that now.

The reason I need more than 128 sprites is I am having a puzzle game with numbers. The numbers can go up to 1000. The grid size is 12x7 tiles, which is 84. At least double that for numbers and you get well over 128. I've tried with a background to represent the numbers but since the blocks are 11x11 the spacing doesn't work out. My only other option is to make all the blocks and their numbers sprites, but that will take a lot of time and more storage. Either way, I will be swapping data around.

#58220 - keldon - Fri Oct 21, 2005 7:13 pm

why not try using the bitmap modes for this instead

#58234 - tepples - Fri Oct 21, 2005 8:32 pm

Is there a reason why you need to use 11-pixel-wide tiles?

If you want to use a grid with spaces that are 12 pixels wide, that can be done with two overlapping tile-mode backgrounds. Go get Luminesweeper, start game left in VBA, play for a while, and open the map viewer. Puyo Pop by Sega uses the same technique.

Could you use an image editor to make a mockup of what you want the screen to look like so that we can suggest the best display mode for the job?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#58249 - blacksun - Fri Oct 21, 2005 10:11 pm

I've chosen 11x11 just because it looks good at that size. right now they are 16x16 sprites with transparency.

This is a screenshot of the playfield. This is the max number of blocks that will be on the screen. I will want the numbers separate from the blocks as well. I would like to use sprites on player 2s field, but I have smaller using a text background at the moment.

http://kickforthedarkside.home.comcast.net/Storage/screen_shot.bmp

#58252 - tepples - Fri Oct 21, 2005 10:38 pm

blacksun wrote:
I've chosen 11x11 just because it looks good at that size.

Given your screenshot, they'll look just as good at 12x12.

PROTIP: It's best to post screenshots in PNG format, either at 1x or with the "Simple 2x" filter. It saves space and bandwidth vs. BMP.

Quote:
I will want the numbers separate from the blocks as well.

How many distinct number/block combinations will there be?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#58255 - blacksun - Fri Oct 21, 2005 11:05 pm

Well its either 24 unique sprites, 10 for the numbers and 14 for the blocks, or a lot more if I put the numbers on the sprites, probably over 300.

Also, I don't think I can do it with the multiple backgrounds. One because I would be using too many and two my playfield will be slowly moving upwards like tetris attack. Just altering the background tiles wont work for that.

#58261 - tepples - Sat Oct 22, 2005 12:28 am

If you're doing something like TA then you'll need sprite multiplexing of some sort.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#58568 - thegamefreak0134 - Mon Oct 24, 2005 5:16 pm

You can too do it with multiple backgrounds. You don't alter the tiles themselves to scroll a multiple bg, you move the entire bg. That way, your code only has to keep trask of where the bg is scrolled to and move to the bottom once it reaches the top, or vise versa. It's a little complicated, but it would work. If you use a tile size that fits, this could totally solve your sprites issue, requiring you to only have sprites for the cursor and effects.

I also don't think you'd run out of backgrounds. Think about it. You need one for the 1 player, one for the 2 player, and 1 or 2 for the bg and possibly score. Thats 4, and I think it can be done in one of the modes if memory serves me right.

Using 11x11 tiles, although it may fit, isn't really practical at all simply because you're running into this problem. I recommend using something easier to work with.

Given the screenshot, it seems like it would work ( and look good too ) to give your numbers a one-pixel cushion. Just a thought.

EDIT: ??? this just clicked. How on earth are you going to have a player 2? This is a GBA system, and the player 2's screen, it seems, should be on the other GBA... Well, unless you wanted a computer player or something.

If I'm wrong on any of this, more expirienced people feel free to shoot me down.
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#58602 - tepples - Mon Oct 24, 2005 9:22 pm

thegamefreak0134 wrote:
I also don't think you'd run out of backgrounds.

With 12-pixel-wide tiles and two independently scrollable playfields, you will need two layers for each playfield. That makes two for each player, and you have to do the background and foreground in sprites.

Quote:
How on earth are you going to have a player 2? This is a GBA system, and the player 2's screen, it seems, should be on the other GBA... Well, unless you wanted a computer player or something.

Puyo Pop and Super Puzzle Fighter II Turbo put both playfields on the same screen, which is mirrored on both machines. They use the same screen layout for player vs. CPU and player vs. player. I guess the reasoning is that there is tactical value in being able to see the other playfield. This is especially evident in Tetrinet.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#58779 - blacksun - Tue Oct 25, 2005 11:16 pm

Ya that was the idea of having both playfields. And I do have a background using 8x8 tiles for player 2, so I could not worry about their sprite count. But if I am going to have to do multiplexing I don't think I am going to bother with that.

And like tepples said, I would need to use all 4 backgrounds just to represent the player grids. If I didn't need to have the second player presented, either cpu or human, then I could use the duel background trick.