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 > Double buffering problem, also looking for examples

#24699 - Kris Allen - Tue Aug 10, 2004 1:08 am

Hi, (first post, woo)

I've just started on the path to GBA dev and I've been reading up on some tutorials,and it's been going pretty well, but now I really need to learn how to use double buffering in my games. I saw a 'half-article' on double buffering on PERN, which didn't really make much sense to me.

I did a bit of googling and found a few examples of double buffering. However they all use direct pixel plots to create a fullscreen image that just swaps... is this the only way to do double buffering? I'm wondering where sprites come into the equation - can they be buffered, or do I have to plot the images by hand?

so, to get the point, I need to find a method (and example if possible) of using double buffering with sprites and a background (preferably in Mode 4). could anyone help?

Thanks!

#24708 - sajiimori - Tue Aug 10, 2004 3:01 am

Maybe you could describe what it is you're trying to do (i.e. what problem you feel double buffering will solve). It's possible that the GBA's hardware can solve the problem for you.

Have you written some programs for each of GBA's modes (or at least 1 tile and 1 bmp mode) yet, and created some sprites? Taking that sort of "grand tour" can clarify what kind of tools the system provides before you try to tackle larger problems.

#24726 - Kris Allen - Tue Aug 10, 2004 2:35 pm

Thanks for the reply,

I'm used to using double buffering with Allegro (C++ directx wrapper) because as you already know, it gives the effect of nice smooth animation and movement (I want to make fast pace games like platformers).

I found another tutorial (Programming the GBA: The unofficial guide) which shows an example of double buffering where the images are drawn pixel-by-pixel - is this fast enough to support moving characters, or are sprites my only choice?

I'll try what you suggested about the different modes - so far I've only looked at mode 4

#24731 - sajiimori - Tue Aug 10, 2004 5:14 pm

Things are very different on GBA. The way to get fluid animation is by using the hardware available to you, not by writing super-optimized blitters. I can't tell you whether software sprites will be fast enough for your purposes, but I can say that they will be much, much slower than hardware sprites.

#24735 - Kris Allen - Tue Aug 10, 2004 6:49 pm

Ah, ok, i'll stick with sprites then.

In that case, is double buffering necessary or even possible, or do sprites only need/use a single buffer?

#24739 - poslundc - Tue Aug 10, 2004 7:42 pm

Double buffering in the traditional sense is irrelevant to hardware sprites (although its underlying principles may still be useful in some aspects of sprites within a game's architecture). Read the tutorials and learn how the GBA uses the VDraw/VBlank phases to create fluid animation without screen tearing.

Dan.

#24741 - sajiimori - Tue Aug 10, 2004 8:33 pm

Yeah, reading the tutorials will tell you all this stuff, but in short: GBA tile backgrounds and sprites don't use framebuffers -- the hardware renders them on the fly as the LCD is being refreshed.

#24742 - Kris Allen - Tue Aug 10, 2004 8:50 pm

ah great :D makes the job a lot easier then. I'll take a deeper look at these tutorials...