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 > How to Render Simple Game?

#122017 - purplemaji - Fri Mar 16, 2007 12:38 pm

I'm just getting started developing, and I want to make a simple puzzle game similar to one I've played online. Basically it involves moving around a bunch of square pieces to match them with ones of like color and eliminate them.

I have gone through a couple of tutorials, and haven't had any trouble following them, but now that I have to come up with my own rendering scheme, I need some advice/pointers to put me in the right direction.

At first, I though I would render each block as a sprite, so as it gets moved/slid around, it can be dealt with easily. However, the board will probably me 14 x 9 or 14 x 10, which would eliminate the possibility due to too many (128 sprite max, correct?).

So then I was thinking of tiled, because in the normal state of things, the blocks are arranged in a nice grid that lends itself to tiling. But when a player moves a piece, they slide it into an adjacent spot, and with tiling, I wouldn't be able to slide it over, right? I guess that is what I want to confirm. If I use a tiled scheme, do the tiles fit into a grid only, or can they be in between?

So, assuming you have a 2d array of pieces, each composed of one of 5 styles, what would be your recommended way of rendering them, knowing that 1 or more (up to board size -2) may be moving at any given time? Would you just use framebuffer and blit the pieces into place? Is that fast enough? Is there an easier way?

Sorry for the basic question. This will be my first game dev, and dev on a limited hardware device at the same time, so I just need a little help getting off on the right foot.

Thanks in advance!

PM

#122055 - tepples - Fri Mar 16, 2007 7:43 pm

purplemaji wrote:
I'm just getting started developing, and I want to make a simple puzzle game similar to one I've played online. Basically it involves moving around a bunch of square pieces to match them with ones of like color and eliminate them.

Is it Bejeweled or Tetris Attack or something else?

Quote:
At first, I though I would render each block as a sprite, so as it gets moved/slid around, it can be dealt with easily. However, the board will probably me 14 x 9 or 14 x 10, which would eliminate the possibility due to too many (128 sprite max, correct?).

Not necessarily, if you swap OAM during horizontal blanking. Super Puzzle Fighter II for GBA does this.

Quote:
So then I was thinking of tiled, because in the normal state of things, the blocks are arranged in a nice grid that lends itself to tiling. But when a player moves a piece, they slide it into an adjacent spot, and with tiling, I wouldn't be able to slide it over, right?

Erase tiles from grid, draw them as sprites for a few frames, put tiles back in grid in new positions. This is what Tetris Attack for Super NES does.

How many tiles wide and high is the playfield?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#122070 - purplemaji - Fri Mar 16, 2007 9:25 pm

Quote:

Is it Bejeweled or Tetris Attack or something else?

Actually, more like JT's blocks (yahoo game). I wanted a fairly simple first project. Might try a Bejeweled type next if this goes well. That seems okay, right?


Quote:

Not necessarily, if you swap OAM during horizontal blanking. Super Puzzle Fighter II for GBA does this.

Do you have an example of this, or a link to something describing it? I'm not even sure what this means.

Quote:

Erase tiles from grid, draw them as sprites for a few frames, put tiles back in grid in new positions. This is what Tetris Attack for Super NES does.

How many tiles wide and high is the playfield?

That was the only other idea I had as well, but I think it still fails in a worst case scenario.

The field is (at least) 14x9. Which is 126 squares. Worst case scenario would be 124 of the squares moving at once in that case. I guess that could scrape by if there were no other effects that use any sprites.

How do you know what those other games do?

Sorry if the questions are not reasonable. As I say, I am just getting started here. The tutorials and example code I have seen so far have been very helpful in getting me started with code that works, but I am still having a hard time actually understanding it all, and I want to make sure I'm not just copying code I don't understand.

Thanks for the help!

PM

#122091 - josath - Fri Mar 16, 2007 11:28 pm

purplemaji wrote:

Quote:

Not necessarily, if you swap OAM during horizontal blanking. Super Puzzle Fighter II for GBA does this.

Do you have an example of this, or a link to something describing it? I'm not even sure what this means.


This might be useful to you: http://lywenn.eu.org/projets/mtpx/
He performs something similar to what tepples mentions, to get tons of sprites onscreen

#122127 - tepples - Sat Mar 17, 2007 4:19 am

JT's Blocks appears to be a SameGame clone. I'd suggest the following:
  1. Use two "text" backgrounds to display the playfield.
  2. Draw each tile as 16x16 pixels.
  3. Put all "still" tiles in BG1 and all "falling" tiles in BG0.
  4. Scroll BG0 to move the tiles down.

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#122149 - purplemaji - Sat Mar 17, 2007 11:26 am

Quote:

1. Use two "text" backgrounds to display the playfield.
2. Draw each tile as 16x16 pixels.
3. Put all "still" tiles in BG1 and all "falling" tiles in BG0.
4. Scroll BG0 to move the tiles down.


Ah, this makes perfect sense now that I've seen it stated. Since all the blocks move together, this simplifies things greatly.

Thanks for your help, I'll let you know how it goes. (and probably be back with more questions!)

PM