#20973 - aaronphughes - Thu May 20, 2004 10:10 pm
I am wondering how I might accomplish the following. Say I have a sprite in a text/scrolling background (Mode 0). I would like my sprite to shoot a laser blast (say about 20 pixels wide), across the whole screen (one end to the other). Now my question is, does this have to be done with sprites and/or tiles? Can it be done by directly writing to VRAM (similar to how it would be done in Mode 3)?
I ask this because, it seems like be more work with the sprite approach, as well as using up many sprites, and if a couple characters were doing this at the same time, I imagine I would run out of sprites (past the 128 limit).
Thanks
AH.
_________________
urpNO_SPAM_MAN@canerdian.ca
http://www.canerdian.ca
#20981 - Miked0801 - Fri May 21, 2004 12:15 am
You can directly access VRAM if you want, but you need to do it across char boundaries which makes it far more complex than in Mode 3. I'd personally use a sprite to do this just to keep it simple. You can do a BG write for it later if you absolutely had to (perhaps reserve a BG layer just for special effects and do it there with alpha blending enabled)
#20992 - poslundc - Fri May 21, 2004 2:43 am
You can span the width of the screen using only 4 sprites if they are 64 pixels wide.
Dan.
#21005 - Lupin - Fri May 21, 2004 3:25 pm
If it is only 1 line you can just use the scanline interrupt and setup a sprite on the correct position (do it for every scanline, you just need to know the change in X coordinate). The sprite should just contain a single pixel.
I think a direct write doesn't exist since the gfx hardware of the gba renders all backgrounds and sprites while the screen gets drawn ("on-the-fly") and therefor there is no memory to access.
_________________
Team Pokeme
My blog and PM ASM tutorials
#21017 - Miked0801 - Fri May 21, 2004 6:25 pm
You can access Video RAM directly. You just write to BG chars that are displaying on the screen.
#21092 - Lupin - Sun May 23, 2004 8:27 pm
but you would need to have char memory covering all the screen, it's a waste of memory...
_________________
Team Pokeme
My blog and PM ASM tutorials
#21114 - Miked0801 - Mon May 24, 2004 1:34 am
Yet - it is possible to do - and truthfully, I'd rather waste 600 Chars and than use bitmap mode and waste 3 planes and half of sprite RAM :)
#21116 - poslundc - Mon May 24, 2004 1:55 am
Nothing is free. The big issue with direct-drawing in modes 0-2 (and also with sprites) - more than the memory consumption; you have 64K of BG VRAM after all - is drawing across tile boundaries. Very often there is a big tradeoff in computational requirements to do this compared with the regular planar buffer you get in modes 3-5.
90% of the work that has gone into both my font engine and my sprite scaler has been in optimizing this problem. There isn't too much you can do to avoid giving the CPU work, though. The best thing seems to be arranging the tiles in your map into vertical columns, so at least the vertical addressing space is easy to calculate.
Of course, for displaying still images, if you're smart you'll write a tool that breaks your image right up into the appropriate tiles so you can load it in just as easily as you would load in a static image in modes 3-5.
Dan.
#21138 - Miked0801 - Mon May 24, 2004 6:41 pm
That's fair - our font engine is complex for the same reasons. But most (not all) of the time, I'll take a bit higher CPU overhead for the gains I mentioned in the previous post.