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.

Graphics > Large Maps - revisited

#10777 - goro - Mon Sep 15, 2003 12:44 pm

I'm using Mode 0 and 16-color tiles. I'm a little confused as to the best way to display a large scrollable map (for this example, I only want horizontal scroll-both ways).

I looked at this post : http://forum.gbadev.org/viewtopic.php?t=67
And I've studied various tutorials but I still have the following questions :-

Q1. Do I simply use a 256x256 map and just update the off screen tiles and then

Q2. Am I right in assuming that I only need to update the edge-row or column? and then,

Q3. Do I use the hardware scroll to bring them onto screen or some other method?

Q4. Do I have to use the backbuffer in tile modes?

Q5. When I use mapEd095 to create a map array larger than 256x256,
I get large(8x8)horizontal line-gaps on the screen. Why?

Q6. Even my 256x256 map seems to have a vertical misalignment in the
middle of it (only around one pixel off). Why?

I want smooth scrolling without 'jumpiness' or screen artifacts/relics.

my code is:-
Code:
   for(loop = 0; loop < 4182; loop++)  //load tile image data
      bg1.tileData[loop] = bgTiles[loop]; //4128

   //load the map image data
   temp = (u16*)map;
   for(loop = 0; loop < 32*32/1; loop++)
      bg1.mapData[loop] = temp[loop];



A code example (that doesn't use dma, cos I haven't learnt that yet) or a mod of my code would be great!!

#10782 - Nessie - Mon Sep 15, 2003 3:01 pm

mapEd v0.95 Lite only allows creation of primary layers that are 256x256 or smaller....older versions had a 128x128 limit. Is this something you are seeing with a secondary layer?

#10786 - tepples - Mon Sep 15, 2003 3:44 pm

goro wrote:
Q1. Do I simply use a 256x256 map and just update the off screen tiles and then

Q2. Am I right in assuming that I only need to update the edge-row or column? and then,

Q3. Do I use the hardware scroll to bring them onto screen or some other method?

Correct.

Quote:
Q4. Do I have to use the backbuffer in tile modes?

No. Tile maps have small enough data that you can do all the necessary updating during vblank, so you won't need to use a hardware page flip.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#10788 - goro - Mon Sep 15, 2003 5:40 pm

Quote:
mapEd v0.95 Lite only allows creation of primary layers that are 256x256 or smaller


Nessie : -Sorry I was unclear :- I meant 256x256 pixels not 256x256 tiles.

- Im using the 'import bitmap' feature so it's probably a secondary layer in MapEd.
When I 'view map' in vba 1.6, I seem to get artifacts on all layers/bg's.

Tepples : re Q2 - You said in the other post that this may take more than 1 vblank. Is this true in my case?

Tepples : re: Q3 -I was looking for a 'one or the other' answer not a yes or no answer. I.e -"goro - use hardware scrolling" or -"goro use 'some other' method" -again, sorry for being unclear.


New question : In my case - will DMA copying make my BG scroll smoother or should I use this existing method and save dma for music & other stuff??

New question 2 : Is there something wrong with my code that would cause said misalignment on the vertical axis?

Code:
u16 temp;
   bg->tileData = (u16*)CharBaseBlock(bg->charBaseBlock);
   bg->mapData = (u16*)ScreenBaseBlock(bg->screenBaseBlock);
   temp = bg->size | (bg->charBaseBlock<<CHAR_SHIFT) | (bg->screenBaseBlock<<SCREEN_SHIFT)
      | bg->colorMode | bg->mosaic | bg->wraparound;


Also - Any chance of getting -
Quote:
A code example (that doesn't use dma, cos I haven't learnt that yet) or a mod of my code...

#10789 - sgeos - Mon Sep 15, 2003 6:04 pm

tepples wrote:
goro wrote:
Q4. Do I have to use the backbuffer in tile modes?

No. Tile maps have small enough data that you can do all the necessary updating during vblank, so you won't need to use a hardware page flip.


One could use a couple of screen base blocks like a backbuffer if desired. I'm not convinced that you wish to in this case.

goro wrote:
New question : In my case - will DMA copying make my BG scroll smoother?


Maybe. DMA copying is faster. I don't know if moving your bg data faster is helpful.

-Brendan Sechter

#10792 - tepples - Mon Sep 15, 2003 8:45 pm

goro wrote:
re Q2 - You said in the other post that this may take more than 1 vblank. Is this true in my case?

What other post? I'm guessing that in another post I may have been talking about modes 3, 4, or 5, which do take longer to develop.

Quote:
re: Q3 -I was looking for a 'one or the other' answer not a yes or no answer. I.e -"goro - use hardware scrolling" or -"goro use 'some other' method" -again, sorry for being unclear.

I saw it as "should I use hardware scrolling?" and answered "yes". Yes, you should use hardware scrolling.

Quote:
New question : In my case - will DMA copying make my BG scroll smoother

DMA copying doesn't work at 64 byte intervals, which is required for updating vertical strips of map data when scrolling horizontally. I'd suggest not using DMA for map data, though you should use DMA for tile data and sprite cel data.

Quote:
or should I use this existing method and save dma for music & other stuff??

This is a typical assignment of DMA channels.
DMA[0]: video raster effects
DMA[1]: sound FIFO filling
DMA[2]: possibly more raster effects, or stereo sound
DMA[3]: free for any memcpy() or memset() operations

I can't provide a code example right now because I haven't played around with big scrolling tile maps.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#10805 - goro - Tue Sep 16, 2003 3:04 pm

Thanks Tepples.

I really appreciate all your help.